Fixed exceptions in CharacterNetworking.WriteStatus if a characters stun timer goes over 60.0
This commit is contained in:
@@ -277,6 +277,8 @@ namespace Barotrauma
|
||||
set { oxygenAvailable = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||
}
|
||||
|
||||
public const float MaxStun = 60.0f;
|
||||
|
||||
private float stunTimer;
|
||||
public float Stun
|
||||
{
|
||||
@@ -1771,6 +1773,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.Client != null && !isNetworkMessage) return;
|
||||
|
||||
newStun = MathHelper.Clamp(newStun, 0.0f, MaxStun);
|
||||
|
||||
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
|
||||
|
||||
if (GameMain.Server != null &&
|
||||
|
||||
@@ -620,8 +620,7 @@ namespace Barotrauma
|
||||
msg.Write(Stun > 0.0f);
|
||||
if (Stun > 0.0f)
|
||||
{
|
||||
Stun = MathHelper.Clamp(Stun, 0.0f, 60.0f);
|
||||
msg.WriteRangedSingle(Stun, 0.0f, 60.0f, 8);
|
||||
msg.WriteRangedSingle(MathHelper.Clamp(Stun, 0.0f, MaxStun), 0.0f, MaxStun, 8);
|
||||
}
|
||||
|
||||
msg.Write(HuskInfectionState > 0.0f);
|
||||
|
||||
Reference in New Issue
Block a user