Minor networking fixes

- Don't spam the shit out of status updates (TODO: send update
immediately on drastic changes)
- Fixed some potential message misreading
- Readded homoglyph name comparison
This commit is contained in:
juanjp600
2017-12-21 16:00:04 -03:00
parent 40a46f96e2
commit c593fdb7c6
8 changed files with 56 additions and 37 deletions
@@ -344,18 +344,18 @@ namespace Barotrauma
if (GameMain.Client != null) return;
float newHealth = MathHelper.Clamp(value, minHealth, maxHealth);
if (newHealth == health) return;
//if (newHealth == health) return;
health = newHealth;
if (GameMain.Server != null)
/*if (GameMain.Server != null)
{
if (Math.Abs(health - lastSentHealth) > (maxHealth - minHealth) / 255.0f || Math.Sign(health) != Math.Sign(lastSentHealth))
{
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
lastSentHealth = health;
}
}
}*/
}
}
@@ -373,12 +373,12 @@ namespace Barotrauma
if (GameMain.Client != null) return;
float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f);
if (newBleeding == bleeding) return;
//if (newBleeding == bleeding) return;
bleeding = newBleeding;
if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
/*if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
}
}
@@ -1534,11 +1534,11 @@ namespace Barotrauma
if (stunTimer > 0.0f)
{
stunTimer -= deltaTime;
if (stunTimer < 0.0f && GameMain.Server != null)
/*if (stunTimer < 0.0f && GameMain.Server != null)
{
//stun ended -> notify clients
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
} */
}
//Skip health effects as critical health handles it differently
@@ -1568,8 +1568,8 @@ namespace Barotrauma
if (IsRagdolled)
{
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
if(GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
/*if(GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
AnimController.ResetPullJoints();
selectedConstruction = null;
return;
@@ -1815,11 +1815,11 @@ namespace Barotrauma
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
if (GameMain.Server != null &&
/*if (GameMain.Server != null &&
(Math.Sign(newStun) != Math.Sign(stunTimer) || Math.Abs(newStun - stunTimer) > 0.1f))
{
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
}*/
if (Math.Sign(newStun) != Math.Sign(stunTimer)) AnimController.ResetPullJoints();
@@ -1878,11 +1878,11 @@ namespace Barotrauma
return;
}
if (GameMain.NetworkMember != null)
/*if (GameMain.NetworkMember != null)
{
if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
}
}*/
AnimController.Frozen = false;