Merge branch 'master' into moRags
This commit is contained in:
@@ -84,9 +84,13 @@ namespace Barotrauma
|
||||
{
|
||||
levitatingCollider = false;
|
||||
Collider.FarseerBody.FixedRotation = false;
|
||||
|
||||
Collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - Collider.SimPosition) * 20.0f;
|
||||
Collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
||||
|
||||
if (Math.Abs(Collider.Rotation-GetLimb(LimbType.Torso).Rotation)>Math.PI*0.6f)
|
||||
{
|
||||
Collider.SetTransform(Collider.SimPosition, MathHelper.WrapAngle(Collider.Rotation + (float)Math.PI));
|
||||
}
|
||||
Collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
||||
Collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - Collider.SimPosition) * 20.0f;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1083,8 +1087,6 @@ namespace Barotrauma
|
||||
|
||||
public override void HoldItem(float deltaTime, Item item, Vector2[] handlePos, Vector2 holdPos, Vector2 aimPos, bool aim, float holdAngle)
|
||||
{
|
||||
Holdable holdable = item.GetComponent<Holdable>();
|
||||
|
||||
if (character.IsUnconscious || character.Stun > 0.0f) aim = false;
|
||||
|
||||
//calculate the handle positions
|
||||
@@ -1102,7 +1104,6 @@ namespace Barotrauma
|
||||
|
||||
bool usingController = character.SelectedConstruction != null && character.SelectedConstruction.GetComponent<Controller>() != null;
|
||||
|
||||
|
||||
float itemAngle;
|
||||
if (Anim != Animation.Climbing && !usingController && character.Stun <= 0.0f && aim && itemPos != Vector2.Zero)
|
||||
{
|
||||
@@ -1114,6 +1115,7 @@ namespace Barotrauma
|
||||
|
||||
itemAngle = (torso.body.Rotation + holdAngle * Dir);
|
||||
|
||||
Holdable holdable = item.GetComponent<Holdable>();
|
||||
if (holdable.ControlPose)
|
||||
{
|
||||
head.body.SmoothRotate(itemAngle);
|
||||
|
||||
@@ -1339,13 +1339,34 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 positionError = serverPos.Position - localPos.Position;
|
||||
for (int i = localPosIndex; i < character.MemLocalState.Count; i++)
|
||||
Hull serverHull = Hull.FindHull(serverPos.Position, character.CurrentHull, false);
|
||||
Hull clientHull = Hull.FindHull(localPos.Position, serverHull, false);
|
||||
|
||||
Vector2 positionError = serverPos.Position - localPos.Position;
|
||||
float rotationError = serverPos.Rotation - localPos.Rotation;
|
||||
|
||||
if (serverHull!=clientHull && ((serverHull==null) || (clientHull==null) || (serverHull.Submarine != clientHull.Submarine)))
|
||||
{
|
||||
character.MemLocalState[i].Translate(positionError);
|
||||
//hull subs don't match => just teleport the player to exactly this position to avoid mismatches,
|
||||
//since this would completely break the camera
|
||||
positionError = Collider.SimPosition - serverPos.Position;
|
||||
character.MemLocalState.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = localPosIndex; i < character.MemLocalState.Count; i++)
|
||||
{
|
||||
Hull pointHull = Hull.FindHull(character.MemLocalState[i].Position, clientHull, false);
|
||||
if (pointHull != clientHull && ((pointHull == null) || (clientHull == null) || (pointHull.Submarine == clientHull.Submarine))) break;
|
||||
character.MemLocalState[i].Translate(positionError, rotationError);
|
||||
}
|
||||
}
|
||||
|
||||
Collider.SetTransform(Collider.SimPosition + positionError, Collider.Rotation);
|
||||
Collider.SetTransform(Collider.SimPosition + positionError, Collider.Rotation + rotationError);
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
limb.body.SetTransform(limb.body.SimPosition + positionError, limb.body.Rotation);
|
||||
}
|
||||
}
|
||||
|
||||
if (character.MemLocalState.Count > 120) character.MemLocalState.RemoveRange(0, character.MemLocalState.Count - 120);
|
||||
|
||||
Reference in New Issue
Block a user