(e082ed22d) Fixed AllowRagdollButton settings not being synced with clients. Might be related to #1297
This commit is contained in:
@@ -121,90 +121,7 @@ namespace Barotrauma
|
|||||||
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
||||||
MainLimb.PullJointEnabled = true;
|
MainLimb.PullJointEnabled = true;
|
||||||
}
|
}
|
||||||
character.SelectedConstruction = character.MemState[0].SelectedItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character.MemState[0].Animation == AnimController.Animation.CPR)
|
|
||||||
{
|
|
||||||
character.AnimController.Anim = AnimController.Animation.CPR;
|
|
||||||
}
|
|
||||||
else if (character.AnimController.Anim == AnimController.Animation.CPR)
|
|
||||||
{
|
|
||||||
character.AnimController.Anim = AnimController.Animation.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 newVelocity = Collider.LinearVelocity;
|
|
||||||
Vector2 newPosition = Collider.SimPosition;
|
|
||||||
float newRotation = Collider.Rotation;
|
|
||||||
float newAngularVelocity = Collider.AngularVelocity;
|
|
||||||
Collider.CorrectPosition(character.MemState, out newPosition, out newVelocity, out newRotation, out newAngularVelocity);
|
|
||||||
|
|
||||||
newVelocity = newVelocity.ClampLength(100.0f);
|
|
||||||
if (!MathUtils.IsValid(newVelocity)) { newVelocity = Vector2.Zero; }
|
|
||||||
overrideTargetMovement = newVelocity.LengthSquared() > 0.01f ? newVelocity : Vector2.Zero;
|
|
||||||
|
|
||||||
Collider.LinearVelocity = newVelocity;
|
|
||||||
Collider.AngularVelocity = newAngularVelocity;
|
|
||||||
|
|
||||||
float distSqrd = Vector2.DistanceSquared(newPosition, Collider.SimPosition);
|
|
||||||
float errorTolerance = character.AllowInput ? 0.01f : 0.2f;
|
|
||||||
if (distSqrd > errorTolerance)
|
|
||||||
{
|
|
||||||
if (distSqrd > 10.0f || !character.AllowInput)
|
|
||||||
{
|
|
||||||
Collider.TargetRotation = newRotation;
|
|
||||||
SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Collider.TargetRotation = newRotation;
|
|
||||||
Collider.TargetPosition = newPosition;
|
|
||||||
Collider.MoveToTargetPosition(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//unconscious/dead characters can't correct their position using AnimController movement
|
|
||||||
// -> we need to correct it manually
|
|
||||||
if (!character.AllowInput)
|
|
||||||
{
|
|
||||||
float mainLimbDistSqrd = Vector2.DistanceSquared(MainLimb.PullJointWorldAnchorA, Collider.SimPosition);
|
|
||||||
float mainLimbErrorTolerance = 0.1f;
|
|
||||||
//if the main limb is roughly at the correct position and the collider isn't moving (much at least),
|
|
||||||
//don't attempt to correct the position.
|
|
||||||
if (mainLimbDistSqrd > mainLimbErrorTolerance || Collider.LinearVelocity.LengthSquared() > 0.05f)
|
|
||||||
{
|
|
||||||
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
|
||||||
MainLimb.PullJointEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
character.MemLocalState.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//remove states with a timestamp (there may still timestamp-based states
|
|
||||||
//in the list if the controlled character switches from timestamp-based interpolation to ID-based)
|
|
||||||
character.MemState.RemoveAll(m => m.Timestamp > 0.0f);
|
|
||||||
|
|
||||||
for (int i = 0; i < character.MemLocalState.Count; i++)
|
|
||||||
{
|
|
||||||
if (character.Submarine == null)
|
|
||||||
{
|
|
||||||
//transform in-sub coordinates to outside coordinates
|
|
||||||
if (character.MemLocalState[i].Position.Y > lowestSubPos)
|
|
||||||
{
|
|
||||||
character.MemLocalState[i].TransformInToOutside();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentHull?.Submarine != null)
|
|
||||||
{
|
|
||||||
//transform outside coordinates to in-sub coordinates
|
|
||||||
if (character.MemLocalState[i].Position.Y < lowestSubPos)
|
|
||||||
{
|
|
||||||
character.MemLocalState[i].TransformOutToInside(currentHull.Submarine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
character.MemLocalState.Clear();
|
character.MemLocalState.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1079,6 +1079,8 @@ namespace Barotrauma.Networking
|
|||||||
bool isTraitor = inc.ReadBoolean();
|
bool isTraitor = inc.ReadBoolean();
|
||||||
string traitorTargetName = isTraitor ? inc.ReadString() : null;
|
string traitorTargetName = isTraitor ? inc.ReadString() : null;
|
||||||
|
|
||||||
|
bool allowRagdollButton = inc.ReadBoolean();
|
||||||
|
|
||||||
serverSettings.ReadMonsterEnabled(inc);
|
serverSettings.ReadMonsterEnabled(inc);
|
||||||
|
|
||||||
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
||||||
@@ -1095,6 +1097,7 @@ namespace Barotrauma.Networking
|
|||||||
GameMain.LightManager.LosMode = (LosMode)losMode;
|
GameMain.LightManager.LosMode = (LosMode)losMode;
|
||||||
|
|
||||||
serverSettings.AllowDisguises = disguisesAllowed;
|
serverSettings.AllowDisguises = disguisesAllowed;
|
||||||
|
serverSettings.AllowRagdollButton = allowRagdollButton;
|
||||||
|
|
||||||
if (campaign == null)
|
if (campaign == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1960,6 +1960,8 @@ namespace Barotrauma.Networking
|
|||||||
msg.Write(false);
|
msg.Write(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.Write(serverSettings.AllowRagdollButton);
|
||||||
|
|
||||||
serverSettings.WriteMonsterEnabled(msg);
|
serverSettings.WriteMonsterEnabled(msg);
|
||||||
|
|
||||||
CompressOutgoingMessage(msg);
|
CompressOutgoingMessage(msg);
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ namespace Barotrauma.Networking
|
|||||||
public bool AllowRagdollButton
|
public bool AllowRagdollButton
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serialize(true, true)]
|
[Serialize(true, true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user