]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix cryostorage identifying unknown characters as captain (#26927)
authorTayrtahn <tayrtahn@gmail.com>
Sun, 14 Apr 2024 02:19:42 +0000 (22:19 -0400)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2024 02:19:42 +0000 (12:19 +1000)
Fixed cryostorage getting captain's record for unknown jobs.
Also localized Unknown job string.

Content.Server/Bed/Cryostorage/CryostorageSystem.cs
Resources/Locale/en-US/bed/cryostorage/cryogenic-storage.ftl

index bb2ab4099da0e77b0ea46d4e630fe07f0e788fb7..2e7f8c4235ad41ae542bbf9cc6f0008e74deed56 100644 (file)
@@ -225,13 +225,16 @@ public sealed class CryostorageSystem : SharedCryostorageSystem
         if (!TryComp<StationRecordsComponent>(station, out var stationRecords))
             return;
 
-        var key = new StationRecordKey(_stationRecords.GetRecordByName(station.Value, name) ?? default(uint), station.Value);
-        var jobName = "Unknown";
-
-        if (_stationRecords.TryGetRecord<GeneralStationRecord>(key, out var entry, stationRecords))
-            jobName = entry.JobTitle;
+        var jobName = Loc.GetString("earlyleave-cryo-job-unknown");
+        var recordId = _stationRecords.GetRecordByName(station.Value, name);
+        if (recordId != null)
+        {
+            var key = new StationRecordKey(recordId.Value, station.Value);
+            if (_stationRecords.TryGetRecord<GeneralStationRecord>(key, out var entry, stationRecords))
+                jobName = entry.JobTitle;
 
-        _stationRecords.RemoveRecord(key, stationRecords);
+            _stationRecords.RemoveRecord(key, stationRecords);
+        }
 
         _chatSystem.DispatchStationAnnouncement(station.Value,
             Loc.GetString(
index 8de5f9019b121bffb7beea39f087fbf76452df29..500a5305621297e02da84d948efe284797c117d3 100644 (file)
@@ -1,5 +1,6 @@
 
 ### Announcement
 
+earlyleave-cryo-job-unknown = Unknown
 earlyleave-cryo-announcement = {$character} ({$job}) has entered cryogenic storage!
 earlyleave-cryo-sender = Station