diff --git a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs index 0f793238d59..76db55937ee 100644 --- a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs +++ b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs @@ -24,10 +24,12 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow private bool _isPopulating; private StationRecordFilterType _currentFilterType; + [Dependency] private readonly IPrototypeManager _prototype = default!; // Frontier public GeneralStationRecordConsoleWindow() { RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); // Frontier _currentFilterType = StationRecordFilterType.Name; @@ -178,10 +180,21 @@ private void PopulateJobsContainer(IReadOnlyDictionary, in JobListing.RemoveAllChildren(); foreach (var (job, amount) in jobList) { + // Skip overflow jobs. + if (amount < 0 || amount is null) + continue; + + // Get proper job names when possible + string jobName; + if (_prototype.TryIndex(job, out var jobProto)) + jobName = jobProto.LocalizedName; + else + jobName = job; + var jobEntry = new JobRow { Job = job, - JobName = { Text = job }, + JobName = { Text = jobName }, JobAmount = { Text = amount.ToString() }, }; jobEntry.DecreaseJobSlot.OnPressed += (args) => { OnJobSubtract?.Invoke(args); }; diff --git a/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs b/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs index 801d41c5670..90521228c72 100644 --- a/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs +++ b/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs @@ -5,6 +5,7 @@ using Robust.Server.GameObjects; using System.Linq; using Content.Shared.Roles; +using Robust.Shared.Prototypes; // Frontier namespace Content.Server.StationRecords.Systems; @@ -82,20 +83,23 @@ private void UpdateUserInterface(Entity en var (uid, console) = ent; var owningStation = _station.GetOwningStation(uid); + IReadOnlyDictionary, int?>? jobList = null; // Frontier + if (owningStation != null) // Frontier + jobList = _stationJobsSystem.GetJobs(owningStation.Value); // Frontier: moved this up - populate whenever possible. + if (!TryComp(owningStation, out var stationRecords)) { - _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState(null, null, null, jobList, console.Filter, ent.Comp.CanDeleteEntries)); // Frontier: add as many args as we can return; } - var jobList = _stationJobsSystem.GetJobs(owningStation.Value); - var listing = _stationRecords.BuildListing((owningStation.Value, stationRecords), console.Filter); switch (listing.Count) { case 0: - _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); + var consoleState = new GeneralStationRecordConsoleState(null, null, null, jobList, console.Filter, ent.Comp.CanDeleteEntries); // Frontier: add as many args as we can + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, consoleState); return; default: if (console.ActiveKey == null) @@ -104,7 +108,10 @@ private void UpdateUserInterface(Entity en } if (console.ActiveKey is not { } id) + { + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState(null, null, listing, jobList, console.Filter, ent.Comp.CanDeleteEntries)); // Frontier: add as many args as we can return; + } var key = new StationRecordKey(id, owningStation.Value); _stationRecords.TryGetRecord(key, out var record, stationRecords);