(ea3b77d8a) Fixed servers not sending a hull update when the last fire source in the hull is put out. Caused the fire not to disappear client-side until the water/oxygen in the hull changes enough for a network event to be created.

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:37:07 +03:00
parent 85d19d7f3c
commit effcbd93c6
2 changed files with 3 additions and 16 deletions
@@ -9,7 +9,7 @@ namespace Barotrauma
{ {
partial class Hull : MapEntity, ISerializableEntity, IServerSerializable, IClientSerializable partial class Hull : MapEntity, ISerializableEntity, IServerSerializable, IClientSerializable
{ {
private float lastSentVolume, lastSentOxygen; private float lastSentVolume, lastSentOxygen, lastSentFireCount;
private float sendUpdateTimer; private float sendUpdateTimer;
public override bool IsMouseOn(Vector2 position) public override bool IsMouseOn(Vector2 position)
@@ -34,6 +34,7 @@ namespace Barotrauma
//or if oxygen percentage has changed by 5% //or if oxygen percentage has changed by 5%
if (Math.Abs(lastSentVolume - waterVolume) > Volume * 0.1f || if (Math.Abs(lastSentVolume - waterVolume) > Volume * 0.1f ||
Math.Abs(lastSentOxygen - OxygenPercentage) > 5f || Math.Abs(lastSentOxygen - OxygenPercentage) > 5f ||
lastSentFireCount != FireSources.Count ||
FireSources.Count > 0) FireSources.Count > 0)
{ {
sendUpdateTimer -= deltaTime; sendUpdateTimer -= deltaTime;
@@ -42,6 +43,7 @@ namespace Barotrauma
GameMain.NetworkMember.CreateEntityEvent(this); GameMain.NetworkMember.CreateEntityEvent(this);
lastSentVolume = waterVolume; lastSentVolume = waterVolume;
lastSentOxygen = OxygenPercentage; lastSentOxygen = OxygenPercentage;
lastSentFireCount = FireSources.Count;
sendUpdateTimer = NetConfig.HullUpdateInterval; sendUpdateTimer = NetConfig.HullUpdateInterval;
} }
} }
@@ -184,21 +184,6 @@ namespace Barotrauma
} }
#endif #endif
public KeyOrMouse State
{
get { return binding; }
}
public void SetState()
{
hit = binding.IsHit();
if (hit) hitQueue = true;
held = binding.IsDown();
if (held) heldQueue = true;
}
#endif
public bool Hit public bool Hit
{ {
get get