From: lzk <124214523+lzk228@users.noreply.github.com> Date: Tue, 21 Oct 2025 11:07:23 +0000 (+0200) Subject: fix species name in station records (#36217) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3bbc1e1dde0006f165b0e2362e588bbd70edef56;p=space-station-14.git fix species name in station records (#36217) * fix species name in station records * the hellish commit * Update GeneralStationRecordConsoleWindow.xaml.cs * fix --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- diff --git a/Content.Client/StationRecords/GeneralRecord.xaml.cs b/Content.Client/StationRecords/GeneralRecord.xaml.cs index e84c2dc098..b69c6fb8bb 100644 --- a/Content.Client/StationRecords/GeneralRecord.xaml.cs +++ b/Content.Client/StationRecords/GeneralRecord.xaml.cs @@ -1,8 +1,9 @@ using Content.Shared.StationRecords; +using Content.Shared.Humanoid.Prototypes; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; -using Robust.Shared.Enums; +using Robust.Shared.Prototypes; namespace Content.Client.StationRecords; @@ -10,14 +11,15 @@ namespace Content.Client.StationRecords; public sealed partial class GeneralRecord : Control { public Action? OnDeletePressed; - public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id) + public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id, IPrototypeManager prototypeManager) { RobustXamlLoader.Load(this); RecordName.Text = record.Name; Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString())); Title.Text = Loc.GetString("general-station-record-console-record-title", ("job", Loc.GetString(record.JobTitle))); - Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species)); + var species = Loc.GetString(prototypeManager.Index(record.Species).Name); + Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", species)); Gender.Text = Loc.GetString("general-station-record-console-record-gender", ("gender", record.Gender.ToString())); Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint", @@ -25,7 +27,7 @@ public sealed partial class GeneralRecord : Control Dna.Text = Loc.GetString("general-station-record-console-record-dna", ("dna", record.DNA ?? Loc.GetString("generic-not-available-shorthand"))); - if (canDelete && id != null ) + if (canDelete && id != null) { DeleteButton.Visible = true; DeleteButton.OnPressed += _ => OnDeletePressed?.Invoke(id.Value); diff --git a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs index 272e6c3b25..951928325d 100644 --- a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs +++ b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs @@ -2,12 +2,15 @@ using Content.Shared.StationRecords; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Prototypes; namespace Content.Client.StationRecords; [GenerateTypedNameReferences] public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow { + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + public Action? OnKeySelected; public Action? OnFiltersChanged; @@ -20,6 +23,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow public GeneralStationRecordConsoleWindow() { RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); _currentFilterType = StationRecordFilterType.Name; @@ -44,7 +48,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow StationRecordsFilterType.OnItemSelected += eventArgs => { - var type = (StationRecordFilterType) eventArgs.Id; + var type = (StationRecordFilterType)eventArgs.Id; if (_currentFilterType != type) { @@ -139,7 +143,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id) { RecordContainer.RemoveAllChildren(); - var newRecord = new GeneralRecord(record, enableDelete, id); + var newRecord = new GeneralRecord(record, enableDelete, id, _prototypeManager); newRecord.OnDeletePressed = OnDeleted; RecordContainer.AddChild(newRecord);