diff --git a/Content.Server/FloofStation/HideoutGeneratorComponent.cs b/Content.Server/FloofStation/HideoutGeneratorComponent.cs new file mode 100644 index 00000000000..5ae7643a382 --- /dev/null +++ b/Content.Server/FloofStation/HideoutGeneratorComponent.cs @@ -0,0 +1,17 @@ +using Robust.Shared.Map; + + +namespace Content.Server.FloofStation; + + +[RegisterComponent] +public sealed partial class HideoutGeneratorComponent : Component +{ + + /// + /// Maps we've generated. + /// + [DataField] + public List Generated = new(); + +} diff --git a/Content.Server/FloofStation/TheDarkSystem.cs b/Content.Server/FloofStation/TheDarkSystem.cs index 8ba2e69d05f..d742000b59f 100644 --- a/Content.Server/FloofStation/TheDarkSystem.cs +++ b/Content.Server/FloofStation/TheDarkSystem.cs @@ -14,12 +14,13 @@ public sealed class TheDarkSystem : EntitySystem public override void Initialize() { base.Initialize(); - - SubscribeLocalEvent(SetupTheDark); + SubscribeLocalEvent(SetupTheDark); + SubscribeLocalEvent(DestroyTheDark); } - private void SetupTheDark(RoundStartingEvent ev) + private void SetupTheDark(EntityUid uid, HideoutGeneratorComponent component, MapInitEvent args) { + Logger.Debug(uid.ToString()); var mapId = _mapManager.CreateMap(); _mapManager.AddUninitializedMap(mapId); @@ -30,7 +31,21 @@ private void SetupTheDark(RoundStartingEvent ev) { EnsureComp(id); } - + component.Generated.Add(mapId); _mapManager.DoMapInitialize(mapId); } + + private void DestroyTheDark(EntityUid uid, HideoutGeneratorComponent component, ComponentShutdown args) + { + + foreach (var mapId in component.Generated) + { + if (!_mapManager.MapExists(mapId)) + continue; + + _mapManager.DeleteMap(mapId); + } + + + } } diff --git a/Resources/Prototypes/Entities/Stations/base.yml b/Resources/Prototypes/Entities/Stations/base.yml index 66ea8dadea6..8f89b1feb3f 100644 --- a/Resources/Prototypes/Entities/Stations/base.yml +++ b/Resources/Prototypes/Entities/Stations/base.yml @@ -180,3 +180,10 @@ abstract: true components: - type: StationEventEligible # For when someone makes this more granular in the future. + +# Floof +- type: entity + id: BaseStationTheDark + abstract: true + components: + - type: HideoutGenerator diff --git a/Resources/Prototypes/Entities/Stations/nanotrasen.yml b/Resources/Prototypes/Entities/Stations/nanotrasen.yml index 329542a267a..1357b32bfe2 100644 --- a/Resources/Prototypes/Entities/Stations/nanotrasen.yml +++ b/Resources/Prototypes/Entities/Stations/nanotrasen.yml @@ -27,6 +27,7 @@ - BaseStationNanotrasen - BaseRandomStation - BaseStationMail # Nyano component, required for station mail to function + - BaseStationTheDark # Floof noSpawn: true components: - type: Transform