using Content.Server.Station.Components;
namespace Content.Server.Station.Systems;
///
/// This handles naming stations.
///
public sealed class StationNameSystem : EntitySystem
{
[Dependency] private readonly StationSystem _station = default!;
///
public override void Initialize()
{
SubscribeLocalEvent(OnStationNameSetupInit);
}
private void OnStationNameSetupInit(EntityUid uid, StationNameSetupComponent component, ComponentInit args)
{
if (!HasComp(uid))
return;
_station.RenameStation(uid, GenerateStationName(component), false);
}
///
/// Generates a station name from the given config.
///
private static string GenerateStationName(StationNameSetupComponent config)
{
return config.NameGenerator is not null
? config.NameGenerator.FormatName(config.StationNameTemplate)
: config.StationNameTemplate;
}
}