Files
tbd-station-14/Content.Server/DeltaV/Station/Systems/StationPlanetSpawnerSystem.cs
2025-11-26 22:38:52 -05:00

31 lines
906 B
C#

using Content.Server.DeltaV.Planet;
using Content.Server.DeltaV.Station.Components;
namespace Content.Server.DeltaV.Station.Systems;
public sealed class StationPlanetSpawnerSystem : EntitySystem
{
[Dependency] private readonly PlanetSystem _planet = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StationPlanetSpawnerComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<StationPlanetSpawnerComponent, ComponentShutdown>(OnShutdown);
}
private void OnMapInit(Entity<StationPlanetSpawnerComponent> ent, ref MapInitEvent args)
{
if (ent.Comp.GridPath is not {} path)
return;
ent.Comp.Map = _planet.LoadPlanet(ent.Comp.Planet, path);
}
private void OnShutdown(Entity<StationPlanetSpawnerComponent> ent, ref ComponentShutdown args)
{
QueueDel(ent.Comp.Map);
}
}