Skip to content

Commit

Permalink
Pirate Radio Heisentest Fix (Simple-Station#1225)
Browse files Browse the repository at this point in the history
# Description

I hate that I have to check if the map even exists at all. How the hell
is there a station even existing in the first place if the default
loaded map is NULLSPACE?! GetSpawnableStations should have returned a
list containing zero stations if that was the case, which would then
exit out.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.
I hate these stupid tests.

# Changelog

No CL because this isn't player facing.
  • Loading branch information
VMSolidus authored Nov 17, 2024
1 parent f95774b commit bf6019f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Shared.CCVar;
using Robust.Shared.Serialization.Manager;
using Content.Shared.Parallax.Biomes;
using Robust.Shared.Map;

namespace Content.Server.StationEvents.Events;

Expand All @@ -24,6 +25,7 @@ public sealed class PirateRadioSpawnRule : StationEventSystem<PirateRadioSpawnRu
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly TransformSystem _xform = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;

protected override void Started(EntityUid uid, PirateRadioSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
Expand All @@ -46,6 +48,9 @@ protected override void Started(EntityUid uid, PirateRadioSpawnRuleComponent com
return;

var targetStation = _random.Pick(stations);
if (!_mapManager.MapExists(Transform(targetStation).MapID))
return; /// SHUT UP HEISENTESTS. DIE.

var randomOffset = _random.NextVector2(component.MinimumDistance, component.MaximumDistance);

var outpostOptions = new MapLoadOptions
Expand All @@ -54,7 +59,7 @@ protected override void Started(EntityUid uid, PirateRadioSpawnRuleComponent com
LoadMap = false,
};

if (!_map.TryLoad(GameTicker.DefaultMap, _random.Pick(component.PirateRadioShuttlePath), out var outpostids, outpostOptions))
if (!_map.TryLoad(Transform(targetStation).MapID, _random.Pick(component.PirateRadioShuttlePath), out var outpostids, outpostOptions))
return;

SpawnDebris(component, outpostids);
Expand Down

0 comments on commit bf6019f

Please sign in to comment.