mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
Fixed bola effect stacking (#34723)
(cherry picked from commit a71a79d7859bd2bc0329cc4839fa05b8397b0e7e)
This commit is contained in:
@@ -13,13 +13,13 @@ public sealed partial class EnsnareableComponent : Component
|
||||
/// <summary>
|
||||
/// How much should this slow down the entities walk?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public float WalkSpeed = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// How much should this slow down the entities sprint?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public float SprintSpeed = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,6 +40,12 @@ public sealed partial class EnsnaringComponent : Component
|
||||
[DataField]
|
||||
public float StaminaDamage = 55f;
|
||||
|
||||
/// <summary>
|
||||
/// How many times can the ensnare be applied to the same target?
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float MaxEnsnares = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Should this ensnare someone when thrown?
|
||||
/// </summary>
|
||||
|
||||
@@ -259,23 +259,18 @@ public abstract class SharedEnsnareableSystem : EntitySystem
|
||||
|| component.IgnoredTargets is not null && _entityWhitelist.IsValid(component.IgnoredTargets, target))
|
||||
return false;
|
||||
|
||||
// Need to insert before free legs check.
|
||||
Container.Insert(ensnare, ensnareable.Container);
|
||||
var numEnsnares = ensnareable.Container.ContainedEntities.Count;
|
||||
|
||||
var legs = _body.GetBodyChildrenOfType(target, BodyPartType.Leg).Count();
|
||||
var ensnaredLegs = (2 * ensnareable.Container.ContainedEntities.Count);
|
||||
var freeLegs = legs - ensnaredLegs;
|
||||
|
||||
if (freeLegs > 0)
|
||||
//Don't do anything if the maximum number of ensnares is applied.
|
||||
if (numEnsnares >= component.MaxEnsnares)
|
||||
return false;
|
||||
|
||||
// Apply stamina damage to target if they weren't ensnared before.
|
||||
if (ensnareable.IsEnsnared != true)
|
||||
Container.Insert(ensnare, ensnareable.Container);
|
||||
|
||||
// Apply stamina damage to target
|
||||
if (TryComp<StaminaComponent>(target, out var stamina))
|
||||
{
|
||||
if (TryComp<StaminaComponent>(target, out var stamina))
|
||||
{
|
||||
_stamina.TakeStaminaDamage(target, component.StaminaDamage, with: ensnare, component: stamina);
|
||||
}
|
||||
_stamina.TakeStaminaDamage(target, component.StaminaDamage, with: ensnare, component: stamina);
|
||||
}
|
||||
|
||||
component.Ensnared = target;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
staminaDamage: 20 # WD EDIT: 0 -> 20
|
||||
canThrowTrigger: true
|
||||
canMoveBreakout: true
|
||||
maxEnsnares: 1
|
||||
- type: LandAtCursor
|
||||
- type: LayDownOnCollide # WD EDIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user