diff --git a/Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs b/Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs index 518d6409bf5..7e5a0ac24e1 100644 --- a/Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs +++ b/Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs @@ -1,18 +1,18 @@ using Robust.Server.GameObjects; using Robust.Server.Maps; using Robust.Shared.Configuration; +using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Content.Server.GameTicking; using Content.Server.StationEvents.Components; -using Content.Shared.Salvage; +using Content.Server.Station.Components; +using Content.Server.Station.Systems; +using Content.Shared.CCVar; +using Content.Shared.GameTicking.Components; using Content.Shared.Random.Helpers; +using Content.Shared.Salvage; using System.Linq; -using Content.Shared.GameTicking.Components; -using Content.Shared.CCVar; -using Robust.Shared.Serialization.Manager; -using Content.Shared.Parallax.Biomes; -using Robust.Shared.Map; namespace Content.Server.StationEvents.Events; @@ -24,30 +24,28 @@ public sealed class PirateRadioSpawnRule : StationEventSystem(Transform(station).MapUid)) - stations.Remove(station); + var stationGrids = new HashSet(); + foreach (var stations in station) + { + if (TryComp(stations, out var data) && _station.GetLargestGrid(data) is { } grid) + stationGrids.Add(grid); + } // _random forces Test Fails if given an empty list. which is guaranteed to happen during Tests. - if (stations.Count <= 0) + if (stationGrids.Count <= 0) return; - var targetStation = _random.Pick(stations); + var targetStation = _random.Pick(stationGrids); var targetMapId = Transform(targetStation).MapID; if (!_mapSystem.MapExists(targetMapId))