CatStation/Content.Server/Station/Systems/StationBiomeSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

32 lines
1.1 KiB
C#

using Content.Server.Parallax;
using Content.Server.Station.Components;
using Content.Server.Station.Events;
using Robust.Shared.Prototypes;
namespace Content.Server.Station.Systems;
public sealed partial class StationBiomeSystem : EntitySystem
{
[Dependency] private BiomeSystem _biome = default!;
[Dependency] private IPrototypeManager _proto = default!;
[Dependency] private StationSystem _station = default!;
[Dependency] private SharedMapSystem _map = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StationBiomeComponent, StationPostInitEvent>(OnStationPostInit);
}
private void OnStationPostInit(Entity<StationBiomeComponent> map, ref StationPostInitEvent args)
{
var station = _station.GetLargestGrid(map.Owner);
if (station == null)
return;
var mapId = Transform(station.Value).MapID;
var mapUid = _map.GetMapOrInvalid(mapId);
_biome.EnsurePlanet(mapUid, _proto.Index(map.Comp.Biome), map.Comp.Seed, mapLight: map.Comp.MapLightColor);
}
}