Fix gas overlay (#12692)

This commit is contained in:
Leon Friedrich
2022-11-21 15:50:01 +13:00
committed by GitHub
parent a55b886bdc
commit 8ab849aec9

View File

@@ -130,9 +130,17 @@ namespace Content.Server.Atmos.EntitySystems
return;
}
var changed = oldData.Equals(default) || oldData.FireState != tile.Hotspot.State;
var changed = false;
if (oldData.Equals(default))
{
changed = true;
oldData = new GasOverlayData(tile.Hotspot.State, new byte[VisibleGasId.Length]);
}
else if (oldData.FireState != tile.Hotspot.State)
{
changed = true;
oldData = new GasOverlayData(tile.Hotspot.State, oldData.Opacity);
}
if (tile.Air != null)
{
@@ -166,6 +174,14 @@ namespace Content.Server.Atmos.EntitySystems
changed = true;
}
}
else
{
for (var i = 0; i < VisibleGasId.Length; i++)
{
changed |= oldData.Opacity[i] != 0;
oldData.Opacity[i] = 0;
}
}
if (!changed)
return;