]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix RoleTimeRequirement localization (#34735)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Wed, 29 Jan 2025 13:23:34 +0000 (16:23 +0300)
committerGitHub <noreply@github.com>
Wed, 29 Jan 2025 13:23:34 +0000 (14:23 +0100)
* fix job restriction localization

* Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs

* Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs
Resources/Locale/en-US/job/role-requirements.ftl

index e75a18f011da6dad4cc955b8efb8f74fdc91fe7c..f096cfcb420f24974ec85d37ad9b4b92e6b1d62d 100644 (file)
@@ -40,13 +40,16 @@ public sealed partial class RoleTimeRequirement : JobRequirement
         var formattedRoleDiff = ContentLocalizationManager.FormatPlaytime(roleDiffSpan);
         var departmentColor = Color.Yellow;
 
-        if (entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
-        {
-            var jobProto = jobSystem.GetJobPrototype(proto);
+        if (!entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
+            return false;
 
-            if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
-                departmentColor = departmentProto.Color;
-        }
+        var jobProto = jobSystem.GetJobPrototype(proto);
+
+        if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
+            departmentColor = departmentProto.Color;
+
+        if (!protoManager.TryIndex<JobPrototype>(jobProto, out var indexedJob))
+            return false;
 
         if (!Inverted)
         {
@@ -56,7 +59,7 @@ public sealed partial class RoleTimeRequirement : JobRequirement
             reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
                 "role-timer-role-insufficient",
                 ("time", formattedRoleDiff),
-                ("job", Loc.GetString(proto)),
+                ("job", indexedJob.LocalizedName),
                 ("departmentColor", departmentColor.ToHex())));
             return false;
         }
@@ -66,7 +69,7 @@ public sealed partial class RoleTimeRequirement : JobRequirement
             reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
                 "role-timer-role-too-high",
                 ("time", formattedRoleDiff),
-                ("job", Loc.GetString(proto)),
+                ("job", indexedJob.LocalizedName),
                 ("departmentColor", departmentColor.ToHex())));
             return false;
         }
index 686fcb93cb12465c3b5fc3b6b92b37610a75cac3..37265b875ce8d12fb2acb419db0a270064292161 100644 (file)
@@ -1,15 +1,15 @@
-role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to play this role.
-role-timer-department-too-high = You require [color=yellow]{$time}[/color] less playtime in the [color={$departmentColor}]{$department}[/color] department to play this role. (Are you trying to play a trainee role?)
-role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to play this role.
-role-timer-overall-too-high = You require [color=yellow]{$time}[/color] less overall playtime to play this role. (Are you trying to play a trainee role?)
-role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to play this role.
-role-timer-role-too-high = You require[color=yellow] {$time}[/color] less playtime with [color={$departmentColor}]{$job}[/color] to play this role. (Are you trying to play a trainee role?)
-role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] to play this role.
-role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] to play this role.
-role-timer-whitelisted-species = Your character must be one of the following species to play this role:
-role-timer-blacklisted-species = Your character must not be one of the following species to play this role:
-role-timer-whitelisted-traits = Your character must have one of the following traits:
-role-timer-blacklisted-traits = Your character must not have any of the following traits:
+role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to unlock this.
+role-timer-department-too-high = You require [color=yellow]{$time}[/color] less playtime in the [color={$departmentColor}]{$department}[/color] department to select this. (Are you trying to play a trainee role?)
+role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to unlock this.
+role-timer-overall-too-high = You require [color=yellow]{$time}[/color] less overall playtime to select this. (Are you trying to play a trainee role?)
+role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to unlock this.
+role-timer-role-too-high = You require[color=yellow] {$time}[/color] less playtime with [color={$departmentColor}]{$job}[/color] to select this. (Are you trying to play a trainee role?)
+role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] for you to choose this.
+role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] for you to choose this.
+role-timer-whitelisted-species = Your character must be one of the following species for you to select this:
+role-timer-blacklisted-species = Your character must not be one of the following species for you to select this:
+role-timer-whitelisted-traits = Your character must have one of the following traits for you to select this:
+role-timer-blacklisted-traits = Your character must not have any of the following traits for you to select this:
 
 role-timer-locked = Locked (hover for details)