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>
This commit is contained in:
lzk
2025-10-21 13:07:23 +02:00
committed by GitHub
parent 0241a4855f
commit 3bbc1e1dde
2 changed files with 12 additions and 6 deletions

View File

@@ -1,8 +1,9 @@
using Content.Shared.StationRecords; using Content.Shared.StationRecords;
using Content.Shared.Humanoid.Prototypes;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Enums; using Robust.Shared.Prototypes;
namespace Content.Client.StationRecords; namespace Content.Client.StationRecords;
@@ -10,14 +11,15 @@ namespace Content.Client.StationRecords;
public sealed partial class GeneralRecord : Control public sealed partial class GeneralRecord : Control
{ {
public Action<uint>? OnDeletePressed; public Action<uint>? OnDeletePressed;
public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id) public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id, IPrototypeManager prototypeManager)
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
RecordName.Text = record.Name; RecordName.Text = record.Name;
Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString())); Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString()));
Title.Text = Loc.GetString("general-station-record-console-record-title", Title.Text = Loc.GetString("general-station-record-console-record-title",
("job", Loc.GetString(record.JobTitle))); ("job", Loc.GetString(record.JobTitle)));
Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species)); var species = Loc.GetString(prototypeManager.Index<SpeciesPrototype>(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.Text = Loc.GetString("general-station-record-console-record-gender",
("gender", record.Gender.ToString())); ("gender", record.Gender.ToString()));
Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint", Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint",

View File

@@ -2,12 +2,15 @@ using Content.Shared.StationRecords;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client.StationRecords; namespace Content.Client.StationRecords;
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public Action<uint?>? OnKeySelected; public Action<uint?>? OnKeySelected;
public Action<StationRecordFilterType, string>? OnFiltersChanged; public Action<StationRecordFilterType, string>? OnFiltersChanged;
@@ -20,6 +23,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
public GeneralStationRecordConsoleWindow() public GeneralStationRecordConsoleWindow()
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_currentFilterType = StationRecordFilterType.Name; _currentFilterType = StationRecordFilterType.Name;
@@ -139,7 +143,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id) private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id)
{ {
RecordContainer.RemoveAllChildren(); RecordContainer.RemoveAllChildren();
var newRecord = new GeneralRecord(record, enableDelete, id); var newRecord = new GeneralRecord(record, enableDelete, id, _prototypeManager);
newRecord.OnDeletePressed = OnDeleted; newRecord.OnDeletePressed = OnDeleted;
RecordContainer.AddChild(newRecord); RecordContainer.AddChild(newRecord);