]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix tile-events returns (#37502)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 16 May 2025 12:22:20 +0000 (22:22 +1000)
committerGitHub <noreply@github.com>
Fri, 16 May 2025 12:22:20 +0000 (14:22 +0200)
* Fix tile-events returns

Should really be continues.

* More

* More optimisations

Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs
Content.Server/Decals/DecalSystem.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs
Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs
Content.Server/Pinpointer/NavMapSystem.cs
Content.Server/Shuttles/Systems/ThrusterSystem.cs
Content.Server/Tiles/RequiresTileSystem.cs
Content.Shared/SubFloor/SharedSubFloorHideSystem.cs

index 76775638ee2b93e775f6a85e379685ace77b08e0..60d7778f5f4de3d7fc7537b9bd21a022abb3c8e2 100644 (file)
@@ -23,6 +23,9 @@ public sealed class AutomaticAtmosSystem : EntitySystem
 
     private void OnTileChanged(ref TileChangedEvent ev)
     {
+        if (_atmosphereSystem.HasAtmosphere(ev.Entity) || !TryComp<PhysicsComponent>(ev.Entity, out var physics))
+            return;
+
         foreach (var change in ev.Changes)
         {
             // Only if a atmos-holding tile has been added or removed.
@@ -34,12 +37,10 @@ public sealed class AutomaticAtmosSystem : EntitySystem
             var newSpace = change.NewTile.IsSpace(_tileDefinitionManager);
 
             if (!(oldSpace && !newSpace ||
-                !oldSpace && newSpace) ||
-                _atmosphereSystem.HasAtmosphere(ev.Entity))
+                  !oldSpace && newSpace))
+            {
                 continue;
-
-            if (!TryComp<PhysicsComponent>(ev.Entity, out var physics))
-                return;
+            }
 
             // We can't actually count how many tiles there are efficiently, so instead estimate with the mass.
             if (physics.Mass / ShuttleSystem.TileMassMultiplier >= 7.0f)
@@ -47,8 +48,10 @@ public sealed class AutomaticAtmosSystem : EntitySystem
                 AddComp<GridAtmosphereComponent>(ev.Entity);
                 Log.Info($"Giving grid {ev.Entity} GridAtmosphereComponent.");
             }
+
             // It's not super important to remove it should the grid become too small again.
             // If explosions ever gain the ability to outright shatter grids, do rethink this.
+            return;
         }
     }
 }
index 2af95c7c23c4fe8311d296c53574a0a217da3507..690d24c2e4e8435c56d65ef1c3b7cddac0252a85 100644 (file)
@@ -160,18 +160,22 @@ namespace Content.Server.Decals
 
         private void OnTileChanged(ref TileChangedEvent args)
         {
+            if (!TryComp(args.Entity, out DecalGridComponent? grid))
+                return;
+
+            var toDelete = new HashSet<uint>();
+
             foreach (var change in args.Changes)
             {
                 if (!change.NewTile.IsSpace(_tileDefMan))
-                    return;
-
-                if (!TryComp(args.Entity, out DecalGridComponent? grid))
-                    return;
+                    continue;
 
                 var indices = GetChunkIndices(change.GridIndices);
-                var toDelete = new HashSet<uint>();
+
                 if (!grid.ChunkCollection.ChunkCollection.TryGetValue(indices, out var chunk))
-                    return;
+                    continue;
+
+                toDelete.Clear();
 
                 foreach (var (uid, decal) in chunk.Decals)
                 {
@@ -183,7 +187,7 @@ namespace Content.Server.Decals
                 }
 
                 if (toDelete.Count == 0)
-                    return;
+                    continue;
 
                 foreach (var decalId in toDelete)
                 {
index 77def3abbab06b4bfa66c0e896f2bf509cfd2b14..1b68338eca1d4c630ce0ef74d955a6b103f1b330 100644 (file)
@@ -233,14 +233,14 @@ public sealed partial class ExplosionSystem
     /// </summary>
     private void OnTileChanged(ref TileChangedEvent ev)
     {
+        if (!TryComp(ev.Entity, out MapGridComponent? grid))
+            return;
+
         foreach (var change in ev.Changes)
         {
             // only need to update the grid-edge map if a tile was added or removed from the grid.
             if (!change.NewTile.IsEmpty && !change.OldTile.IsEmpty)
-                return;
-
-            if (!TryComp(ev.Entity, out MapGridComponent? grid))
-                return;
+                continue;
 
             if (!_gridEdges.TryGetValue(ev.Entity, out var edges))
             {
@@ -265,7 +265,7 @@ public sealed partial class ExplosionSystem
                     }
                 }
 
-                return;
+                continue;
             }
 
             // the tile is not empty space, but was previously. So update directly adjacent neighbours, which may no longer
index 3def3feedc563c0fc443145f71f820f4f18073d5..e36d3edda13c5070569ba2c2d5f27246094b4c43 100644 (file)
@@ -53,7 +53,7 @@ public sealed partial class PathfindingSystem
         foreach (var change in ev.Changes)
         {
             if (change.OldTile.IsEmpty == change.NewTile.IsEmpty)
-                return;
+                continue;
 
             DirtyChunk(ev.Entity, _maps.GridTileToLocal(ev.Entity, ev.Entity.Comp, change.GridIndices));
         }
index ffa048acd605234d19b5584eb74b7b54f5d11175..7511e60cdec860a32e48383d981a47a3f2b0c459 100644 (file)
@@ -101,10 +101,13 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
 
     private void OnTileChanged(ref TileChangedEvent ev)
     {
+        if (!_navQuery.TryComp(ev.Entity, out var navMap))
+            return;
+
         foreach (var change in ev.Changes)
         {
-            if (!change.EmptyChanged || !_navQuery.TryComp(ev.Entity, out var navMap))
-                return;
+            if (!change.EmptyChanged)
+                continue;
 
             var tile = change.GridIndices;
             var chunkOrigin = SharedMapSystem.GetChunkIndices(tile, ChunkSize);
@@ -119,7 +122,7 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
             {
                 tileData = 0;
                 if (PruneEmpty((ev.Entity, navMap), chunk))
-                    return;
+                    continue;
             }
             else
             {
index 294200af9a65806a376af155f3d61e86ed3582fd..42c249c9abaf3f5907a889e5fdbc073a0913ed96 100644 (file)
@@ -98,7 +98,7 @@ public sealed class ThrusterSystem : EntitySystem
         {
             // If the old tile was space but the new one isn't then disable all adjacent thrusters
             if (change.NewTile.IsSpace(_tileDefManager) || !change.OldTile.IsSpace(_tileDefManager))
-                return;
+                continue;
 
             var tilePos = change.GridIndices;
             var grid = Comp<MapGridComponent>(uid);
index aae07fa660ab2798e986e77613ef9bc44ec5b20d..41e797e820c1a87260d802bfd40196139a495ae6 100644 (file)
@@ -29,8 +29,6 @@ public sealed class RequiresTileSystem : EntitySystem
         foreach (var change in ev.Changes)
         {
             var anchored = _maps.GetAnchoredEntitiesEnumerator(ev.Entity, grid, change.GridIndices);
-            if (anchored.Equals(AnchoredEntitiesEnumerator.Empty))
-                return;
 
             while (anchored.MoveNext(out var ent))
             {
index 65d5e0adb21a2bec90b7c153d117808d20d23ca9..812003aae8f4e6e8b11a3ec9400315f3d10cc179 100644 (file)
@@ -125,10 +125,10 @@ namespace Content.Shared.SubFloor
             foreach (var change in args.Changes)
             {
                 if (change.OldTile.IsEmpty)
-                    return; // Nothing is anchored here anyways.
+                    continue; // Nothing is anchored here anyways.
 
                 if (change.NewTile.IsEmpty)
-                    return; // Anything that was here will be unanchored anyways.
+                    continue; // Anything that was here will be unanchored anyways.
 
                 UpdateTile(args.Entity, args.Entity.Comp, change.GridIndices);
             }