]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix species name in station records (#36217)
authorlzk <124214523+lzk228@users.noreply.github.com>
Tue, 21 Oct 2025 11:07:23 +0000 (13:07 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Oct 2025 11:07:23 +0000 (11:07 +0000)
* fix species name in station records

* the hellish commit

* Update GeneralStationRecordConsoleWindow.xaml.cs

* fix

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Client/StationRecords/GeneralRecord.xaml.cs
Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs

index e84c2dc09828f73f8a165b37d0b4097dda3d8ce7..b69c6fb8bb695f55afa1ff34133cc36c9dc25c48 100644 (file)
@@ -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<uint>? 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<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", 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);
index 272e6c3b251b35e9500c76ca19ca33dcce150d32..951928325d517bb369028eff3c31e0c2480f101c 100644 (file)
@@ -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<uint?>? OnKeySelected;
 
     public Action<StationRecordFilterType, string>? 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);