Rebuild excited groups if blocked airflow direction of tile has changed. (#12548)

This commit is contained in:
Vera Aguilera Puerto
2022-11-11 09:44:45 +01:00
committed by GitHub
parent 3a0c3b02b3
commit 3fbe85416e
2 changed files with 8 additions and 5 deletions

View File

@@ -118,11 +118,7 @@ namespace Content.Server.Atmos.EntitySystems
var query = EntityManager.GetEntityQuery<AirtightComponent>(); var query = EntityManager.GetEntityQuery<AirtightComponent>();
_explosionSystem.UpdateAirtightMap(gridId, pos, query); _explosionSystem.UpdateAirtightMap(gridId, pos, query);
// TODO make atmos system use query // TODO make atmos system use query
_atmosphereSystem.UpdateAdjacent(gridUid, pos);
_atmosphereSystem.InvalidateTile(gridUid, pos); _atmosphereSystem.InvalidateTile(gridUid, pos);
if(fixVacuum)
_atmosphereSystem.FixTileVacuum(gridUid, pos);
} }
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle) private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)

View File

@@ -67,9 +67,16 @@ namespace Content.Server.Atmos.EntitySystems
GridIsTileAirBlocked(uid, atmosphere, ref airBlockedEv); GridIsTileAirBlocked(uid, atmosphere, ref airBlockedEv);
var isAirBlocked = airBlockedEv.Result; var isAirBlocked = airBlockedEv.Result;
var oldBlocked = tile.BlockedAirflow;
var updateAdjacentEv = new UpdateAdjacentMethodEvent(uid, indices, mapGridComp); var updateAdjacentEv = new UpdateAdjacentMethodEvent(uid, indices, mapGridComp);
GridUpdateAdjacent(uid, atmosphere, ref updateAdjacentEv); GridUpdateAdjacent(uid, atmosphere, ref updateAdjacentEv);
// Blocked airflow changed, rebuild excited groups!
if (tile.Excited && tile.BlockedAirflow != oldBlocked)
{
RemoveActiveTile(atmosphere, tile);
}
// Call this instead of the grid method as the map has a say on whether the tile is space or not. // Call this instead of the grid method as the map has a say on whether the tile is space or not.
if ((!mapGrid.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked) if ((!mapGrid.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
{ {