Merge branch 'master' into new-netcode
Conflicts: Subsurface/Source/GUI/GUITextBlock.cs Subsurface/Source/GameMain.cs Subsurface/Source/Items/Components/Machines/Radar.cs Subsurface/Source/Networking/GameClient.cs
This commit is contained in:
@@ -214,7 +214,7 @@ namespace Barotrauma
|
||||
|
||||
Limb leftLeg = GetLimb(LimbType.LeftLeg);
|
||||
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
||||
|
||||
|
||||
float getUpSpeed = 0.3f;
|
||||
float walkCycleSpeed = movement.X * walkAnimSpeed;
|
||||
if (stairs != null)
|
||||
@@ -304,8 +304,11 @@ namespace Barotrauma
|
||||
torso.pullJoint.Enabled = true;
|
||||
head.pullJoint.Enabled = true;
|
||||
waist.pullJoint.Enabled = true;
|
||||
|
||||
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
|
||||
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
||||
|
||||
if (stairs != null)
|
||||
if (stairs != null || onSlope)
|
||||
{
|
||||
torso.pullJoint.WorldAnchorB = new Vector2(
|
||||
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
|
||||
@@ -351,20 +354,23 @@ namespace Barotrauma
|
||||
//progress the walking animation
|
||||
walkPos -= (walkCycleSpeed / runningModifier) * 0.8f;
|
||||
|
||||
MoveLimb(leftFoot,
|
||||
colliderPos + new Vector2(
|
||||
stepSize.X,
|
||||
(stepSize.Y > 0.0f) ? stepSize.Y : -0.15f),
|
||||
15.0f, true);
|
||||
for (int i = -1; i < 2; i += 2)
|
||||
{
|
||||
Limb foot = i == -1 ? leftFoot : rightFoot;
|
||||
Limb leg = i == -1 ? leftLeg : rightLeg;
|
||||
|
||||
MoveLimb(rightFoot,
|
||||
colliderPos + new Vector2(
|
||||
-stepSize.X,
|
||||
(-stepSize.Y > 0.0f) ? -stepSize.Y : -0.15f),
|
||||
15.0f, true);
|
||||
Vector2 footPos = stepSize * -i;
|
||||
if (stepSize.Y > 0.0f) stepSize.Y = -0.15f;
|
||||
|
||||
leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
if (onSlope && stairs == null)
|
||||
{
|
||||
footPos.Y *= 2.0f;
|
||||
}
|
||||
footPos.Y = Math.Min(waist.SimPosition.Y - colliderPos.Y - 0.4f, footPos.Y);
|
||||
|
||||
MoveLimb(foot, footPos + colliderPos, 15.0f, true);
|
||||
foot.body.SmoothRotate(leg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
}
|
||||
|
||||
if (runningModifier > 1.0f)
|
||||
{
|
||||
@@ -435,7 +441,11 @@ namespace Barotrauma
|
||||
{
|
||||
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
|
||||
}
|
||||
|
||||
|
||||
if (stairs == null)
|
||||
{
|
||||
footPos.Y = Math.Max(Math.Min(floorPos, footPos.Y + 0.5f), footPos.Y);
|
||||
}
|
||||
|
||||
var foot = i == -1 ? rightFoot : leftFoot;
|
||||
|
||||
|
||||
@@ -1100,7 +1100,12 @@ namespace Barotrauma
|
||||
{
|
||||
PhysicsBody refBody = refLimb == null ? Collider : refLimb.body;
|
||||
|
||||
Vector2 rayStart = refBody.SimPosition;
|
||||
return GetFloorY(refBody.SimPosition);
|
||||
}
|
||||
|
||||
protected float GetFloorY(Vector2 simPosition)
|
||||
{
|
||||
Vector2 rayStart = simPosition;
|
||||
Vector2 rayEnd = rayStart - new Vector2(0.0f, TorsoPosition);
|
||||
|
||||
var lowestLimb = FindLowestLimb();
|
||||
@@ -1129,7 +1134,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
return closestFraction;
|
||||
}
|
||||
}
|
||||
, rayStart, rayEnd);
|
||||
|
||||
|
||||
@@ -1141,7 +1146,6 @@ namespace Barotrauma
|
||||
{
|
||||
return rayStart.Y + (rayEnd.Y - rayStart.Y) * closestFraction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetPosition(Vector2 simPosition, bool lerp = false)
|
||||
|
||||
Reference in New Issue
Block a user