2022-07-21 17:30:00 -05:00
|
|
|
|
using Content.Shared.Station;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Station;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// This handles letting the client know stations are a thing. Only really used by an admin menu.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public sealed class StationSystem : EntitySystem
|
|
|
|
|
|
{
|
2024-01-10 19:30:20 +11:00
|
|
|
|
private readonly List<(string Name, NetEntity Entity)> _stations = new();
|
2022-07-21 17:30:00 -05:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// All stations that currently exist.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// I'd have this just invoke an entity query, but we're on the client and the client barely knows about stations.
|
|
|
|
|
|
/// </remarks>
|
2024-01-10 19:30:20 +11:00
|
|
|
|
public IReadOnlyList<(string Name, NetEntity Entity)> Stations => _stations;
|
2022-07-21 17:30:00 -05:00
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
SubscribeNetworkEvent<StationsUpdatedEvent>(StationsUpdated);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void StationsUpdated(StationsUpdatedEvent ev)
|
|
|
|
|
|
{
|
|
|
|
|
|
_stations.Clear();
|
2024-01-10 19:30:20 +11:00
|
|
|
|
// TODO this needs to be done in component states and with the Ensure() methods
|
|
|
|
|
|
_stations.AddRange(ev.Stations);
|
2022-07-21 17:30:00 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|