From 6abe83cb43884cb8db08200eaa9ccf74c97d9e44 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:13:44 -0400 Subject: [PATCH] Fix misc. flesh anomaly exceptions (#15750) --- Content.Server/Anomaly/Effects/FleshAnomalySystem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Server/Anomaly/Effects/FleshAnomalySystem.cs b/Content.Server/Anomaly/Effects/FleshAnomalySystem.cs index 227721fd7a..faa2cde7c3 100644 --- a/Content.Server/Anomaly/Effects/FleshAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/FleshAnomalySystem.cs @@ -63,12 +63,19 @@ public sealed class FleshAnomalySystem : EntitySystem private void SpawnMonstersOnOpenTiles(FleshAnomalyComponent component, TransformComponent xform, int amount, float radius) { + if (!component.Spawns.Any()) + return; + if (!_map.TryGetGrid(xform.GridUid, out var grid)) return; var localpos = xform.Coordinates.Position; var tilerefs = grid.GetLocalTilesIntersecting( new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray(); + + if (tilerefs.Length == 0) + return; + _random.Shuffle(tilerefs); var physQuery = GetEntityQuery(); var amountCounter = 0; -- 2.51.2