Skip to content

Commit

Permalink
fix TheDarkSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
Fansana committed Dec 31, 2024
1 parent 8e7ff2c commit 8907a38
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
17 changes: 17 additions & 0 deletions Content.Server/FloofStation/HideoutGeneratorComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Robust.Shared.Map;


namespace Content.Server.FloofStation;


[RegisterComponent]
public sealed partial class HideoutGeneratorComponent : Component
{

/// <summary>
/// Maps we've generated.
/// </summary>
[DataField]
public List<MapId> Generated = new();

}
23 changes: 19 additions & 4 deletions Content.Server/FloofStation/TheDarkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ public sealed class TheDarkSystem : EntitySystem
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<RoundStartingEvent>(SetupTheDark);
SubscribeLocalEvent<HideoutGeneratorComponent, MapInitEvent>(SetupTheDark);
SubscribeLocalEvent<HideoutGeneratorComponent, ComponentShutdown>(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);

Expand All @@ -30,7 +31,21 @@ private void SetupTheDark(RoundStartingEvent ev)
{
EnsureComp<PreventPilotComponent>(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);
}


}
}
7 changes: 7 additions & 0 deletions Resources/Prototypes/Entities/Stations/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Stations/nanotrasen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- BaseStationNanotrasen
- BaseRandomStation
- BaseStationMail # Nyano component, required for station mail to function
- BaseStationTheDark # Floof
noSpawn: true
components:
- type: Transform
Expand Down

0 comments on commit 8907a38

Please sign in to comment.