Moved stun from AnimController to the character class, server notifies clients when the stun ends, husk infection included in character status messages
This commit is contained in:
@@ -13,26 +13,12 @@ namespace Barotrauma
|
||||
protected Character character;
|
||||
|
||||
protected float walkSpeed, swimSpeed;
|
||||
|
||||
protected float stunTimer;
|
||||
|
||||
|
||||
protected float walkPos;
|
||||
|
||||
protected readonly Vector2 stepSize;
|
||||
protected readonly float legTorque;
|
||||
|
||||
|
||||
|
||||
public float StunTimer
|
||||
{
|
||||
get { return stunTimer; }
|
||||
set
|
||||
{
|
||||
if (!MathUtils.IsValid(value)) return;
|
||||
stunTimer = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public AnimController(Character character, XElement element)
|
||||
: base(character, element)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Frozen) return;
|
||||
|
||||
if (character.IsDead || character.IsUnconscious || stunTimer > 0.0f)
|
||||
if (character.IsDead || character.IsUnconscious || character.Stun > 0.0f)
|
||||
{
|
||||
Collider.FarseerBody.FixedRotation = false;
|
||||
|
||||
@@ -63,12 +63,7 @@ namespace Barotrauma
|
||||
Collider.LinearVelocity = (MainLimb.SimPosition - Collider.SimPosition) * 60.0f;
|
||||
Collider.SmoothRotate(MainLimb.Rotation);
|
||||
}
|
||||
|
||||
if (stunTimer > 0)
|
||||
{
|
||||
stunTimer -= deltaTime;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +84,7 @@ namespace Barotrauma
|
||||
|
||||
if (strongestImpact > 0.0f)
|
||||
{
|
||||
stunTimer = MathHelper.Clamp(strongestImpact * 0.5f, stunTimer, 5.0f);
|
||||
character.Stun = MathHelper.Clamp(strongestImpact * 0.5f, character.Stun, 5.0f);
|
||||
strongestImpact = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,18 +67,13 @@ namespace Barotrauma
|
||||
Collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - Collider.SimPosition) * 20.0f;
|
||||
Collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
||||
|
||||
if (stunTimer > 0)
|
||||
{
|
||||
stunTimer -= deltaTime;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//stun (= disable the animations) if the ragdoll receives a large enough impact
|
||||
if (strongestImpact > 0.0f)
|
||||
{
|
||||
character.StartStun(MathHelper.Min(strongestImpact * 0.5f, 5.0f));
|
||||
character.SetStun(MathHelper.Min(strongestImpact * 0.5f, 5.0f));
|
||||
strongestImpact = 0.0f;
|
||||
return;
|
||||
}
|
||||
@@ -979,7 +974,7 @@ namespace Barotrauma
|
||||
|
||||
|
||||
float itemAngle;
|
||||
if (Anim != Animation.Climbing && !usingController && stunTimer <= 0.0f && aim && itemPos != Vector2.Zero)
|
||||
if (Anim != Animation.Climbing && !usingController && character.Stun <= 0.0f && aim && itemPos != Vector2.Zero)
|
||||
{
|
||||
Vector2 mousePos = ConvertUnits.ToSimUnits(character.CursorPosition);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user