From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Tue, 25 Apr 2023 01:13:44 +0000 (-0400) Subject: Fix misc. flesh anomaly exceptions (#15750) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=6abe83cb43884cb8db08200eaa9ccf74c97d9e44;p=space-station-14.git Fix misc. flesh anomaly exceptions (#15750) --- 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;