(01ee2b7fd) More pronounced limping animation, don't restrict movement as much when legs are heavily damaged
This commit is contained in:
@@ -527,7 +527,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Limb leftLeg = GetLimb(LimbType.LeftLeg);
|
Limb leftLeg = GetLimb(LimbType.LeftLeg);
|
||||||
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
||||||
|
|
||||||
|
float limpAmount =
|
||||||
|
character.CharacterHealth.GetAfflictionStrength("damage", leftFoot, true) +
|
||||||
|
character.CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
||||||
|
limpAmount = MathHelper.Clamp(limpAmount / 100.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
float walkCycleMultiplier = 1.0f;
|
float walkCycleMultiplier = 1.0f;
|
||||||
if (Stairs != null)
|
if (Stairs != null)
|
||||||
{
|
{
|
||||||
@@ -556,13 +561,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float walkPosX = (float)Math.Cos(WalkPos);
|
float walkPosX = (float)Math.Cos(WalkPos);
|
||||||
float walkPosY = (float)Math.Sin(WalkPos);
|
float walkPosY = (float)Math.Sin(WalkPos);
|
||||||
|
|
||||||
|
|
||||||
Vector2 stepSize = StepSize.Value;
|
Vector2 stepSize = StepSize.Value;
|
||||||
stepSize.X *= walkPosX;
|
stepSize.X *= walkPosX;
|
||||||
stepSize.Y *= walkPosY;
|
stepSize.Y *= walkPosY;
|
||||||
|
|
||||||
float footMid = colliderPos.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
|
float footMid = colliderPos.X;
|
||||||
|
if (limpAmount > 0.0f)
|
||||||
|
{
|
||||||
|
//make the footpos oscillate when limping
|
||||||
|
footMid += ((float)Math.Max(Math.Abs(walkPosX) * limpAmount, 0.0f) * 0.3f);
|
||||||
|
}
|
||||||
|
|
||||||
movement = overrideTargetMovement == Vector2.Zero ?
|
movement = overrideTargetMovement == Vector2.Zero ?
|
||||||
MathUtils.SmoothStep(movement, TargetMovement, movementLerp) :
|
MathUtils.SmoothStep(movement, TargetMovement, movementLerp) :
|
||||||
@@ -576,7 +585,7 @@ namespace Barotrauma
|
|||||||
movement.Y = 0.0f;
|
movement.Y = 0.0f;
|
||||||
|
|
||||||
if (torso == null) { return; }
|
if (torso == null) { return; }
|
||||||
|
|
||||||
bool isNotRemote = true;
|
bool isNotRemote = true;
|
||||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer;
|
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer;
|
||||||
|
|
||||||
@@ -680,7 +689,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//make the character limp if the feet are damaged
|
//make the character limp if the feet are damaged
|
||||||
float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true);
|
float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true);
|
||||||
footPos *= MathHelper.Lerp(1.0f, 0.5f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
footPos.X *= MathHelper.Lerp(1.0f, 0.75f, MathHelper.Clamp(footAfflictionStrength / 50.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
if (onSlope && Stairs == null)
|
if (onSlope && Stairs == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1103,14 +1103,14 @@ namespace Barotrauma
|
|||||||
if (leftFoot != null)
|
if (leftFoot != null)
|
||||||
{
|
{
|
||||||
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true);
|
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true);
|
||||||
speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
|
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
|
||||||
if (rightFoot != null)
|
if (rightFoot != null)
|
||||||
{
|
{
|
||||||
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
||||||
speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
|
|||||||
Reference in New Issue
Block a user