Character status syncing fix, less frequent stun update messages
This commit is contained in:
@@ -1843,13 +1843,16 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if ((stunTimer <= AnimController.StunTimer && !allowStunDecrease) || !MathUtils.IsValid(stunTimer)) return;
|
if ((stunTimer <= AnimController.StunTimer && !allowStunDecrease) || !MathUtils.IsValid(stunTimer)) return;
|
||||||
|
|
||||||
|
if (GameMain.Server != null &&
|
||||||
|
(Math.Sign(stunTimer) != Math.Sign(AnimController.StunTimer) || Math.Abs(stunTimer - AnimController.StunTimer) > 0.1f))
|
||||||
|
{
|
||||||
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||||
|
}
|
||||||
|
|
||||||
if (Math.Sign(stunTimer) != Math.Sign(AnimController.StunTimer)) AnimController.ResetPullJoints();
|
if (Math.Sign(stunTimer) != Math.Sign(AnimController.StunTimer)) AnimController.ResetPullJoints();
|
||||||
AnimController.StunTimer = Math.Max(AnimController.StunTimer, stunTimer);
|
AnimController.StunTimer = Math.Max(AnimController.StunTimer, stunTimer);
|
||||||
|
|
||||||
selectedConstruction = null;
|
selectedConstruction = null;
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Implode(bool isNetworkMessage = false)
|
private void Implode(bool isNetworkMessage = false)
|
||||||
@@ -2383,12 +2386,20 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Oxygen = msg.ReadRangedSingle(-100.0f, 100.0f, 8);
|
Oxygen = msg.ReadRangedSingle(-100.0f, 100.0f, 8);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Oxygen = 100.0f;
|
||||||
|
}
|
||||||
|
|
||||||
bool isBleeding = msg.ReadBoolean();
|
bool isBleeding = msg.ReadBoolean();
|
||||||
if (isBleeding)
|
if (isBleeding)
|
||||||
{
|
{
|
||||||
bleeding = msg.ReadRangedSingle(0.0f, 5.0f, 8);
|
bleeding = msg.ReadRangedSingle(0.0f, 5.0f, 8);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bleeding = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
bool stunned = msg.ReadBoolean();
|
bool stunned = msg.ReadBoolean();
|
||||||
if (stunned)
|
if (stunned)
|
||||||
@@ -2396,6 +2407,10 @@ namespace Barotrauma
|
|||||||
float newStunTimer = msg.ReadRangedSingle(0.0f, 60.0f, 8);
|
float newStunTimer = msg.ReadRangedSingle(0.0f, 60.0f, 8);
|
||||||
StartStun(newStunTimer, true);
|
StartStun(newStunTimer, true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartStun(0.0f, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user