From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Tue, 23 Dec 2025 21:52:42 +0000 (-0500) Subject: Fix spreaders not re-spreading on deletion (#42016) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=503052bca7b5b78aed783d001149eb6553196656;p=space-station-14.git Fix spreaders not re-spreading on deletion (#42016) * Fix spreaders not re-spreading on deletion * Rename another variable for clarity --- diff --git a/Content.Server/Spreader/SpreaderSystem.cs b/Content.Server/Spreader/SpreaderSystem.cs index 2bc067542d..7ea41431da 100644 --- a/Content.Server/Spreader/SpreaderSystem.cs +++ b/Content.Server/Spreader/SpreaderSystem.cs @@ -295,35 +295,38 @@ public sealed class SpreaderSystem : EntitySystem /// This function activates all spreaders that are adjacent to a given entity. This also activates other spreaders /// on the same tile as the current entity (for thin airtight entities like windoors). /// - public void ActivateSpreadableNeighbors(EntityUid uid, (EntityUid Grid, Vector2i Tile)? position = null) + public void ActivateSpreadableNeighbors(EntityUid origin, (EntityUid Grid, Vector2i Tile)? position = null) { Vector2i tile; - EntityUid ent; - MapGridComponent? grid; + EntityUid gridUid; + MapGridComponent? gridComp; if (position == null) { - var transform = Transform(uid); - if (!TryComp(transform.GridUid, out grid) || TerminatingOrDeleted(transform.GridUid.Value)) + var transform = Transform(origin); + if (!TryComp(transform.GridUid, out gridComp) || TerminatingOrDeleted(transform.GridUid.Value)) return; - tile = _map.TileIndicesFor(transform.GridUid.Value, grid, transform.Coordinates); - ent = transform.GridUid.Value; + tile = _map.TileIndicesFor(transform.GridUid.Value, gridComp, transform.Coordinates); + gridUid = transform.GridUid.Value; } else { - if (!TryComp(position.Value.Grid, out grid)) + if (!TryComp(position.Value.Grid, out gridComp)) return; - (ent, tile) = position.Value; + (gridUid, tile) = position.Value; } - var anchored = _map.GetAnchoredEntitiesEnumerator(ent, grid, tile); + var anchored = _map.GetAnchoredEntitiesEnumerator(gridUid, gridComp, tile); while (anchored.MoveNext(out var entity)) { - if (entity == ent) + // Don't re-activate the terminating entity + if (entity == origin) continue; DebugTools.Assert(Transform(entity.Value).Anchored); - if (_query.HasComponent(ent) && !TerminatingOrDeleted(entity.Value)) + + // Activate any edge spreaders that are non-terminating + if (_query.HasComponent(entity) && !TerminatingOrDeleted(entity)) EnsureComp(entity.Value); } @@ -331,12 +334,14 @@ public sealed class SpreaderSystem : EntitySystem { var direction = (AtmosDirection) (1 << i); var adjacentTile = SharedMapSystem.GetDirection(tile, direction.ToDirection()); - anchored = _map.GetAnchoredEntitiesEnumerator(ent, grid, adjacentTile); + anchored = _map.GetAnchoredEntitiesEnumerator(gridUid, gridComp, adjacentTile); while (anchored.MoveNext(out var entity)) { DebugTools.Assert(Transform(entity.Value).Anchored); - if (_query.HasComponent(ent) && !TerminatingOrDeleted(entity.Value)) + + // Activate any edge spreaders that are non-terminating + if (_query.HasComponent(entity) && !TerminatingOrDeleted(entity)) EnsureComp(entity.Value); } }