Skip to content

Commit da75258

Browse files
Fix RoleTimeRequirement localization (space-wizards#34735)
* fix job restriction localization * Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs * Update Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs --------- Co-authored-by: slarticodefast <[email protected]>
1 parent 467b686 commit da75258

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

Content.Shared/Roles/JobRequirement/RoleTimeRequirement.cs

+11-8
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ public override bool Check(IEntityManager entManager,
4040
var formattedRoleDiff = ContentLocalizationManager.FormatPlaytime(roleDiffSpan);
4141
var departmentColor = Color.Yellow;
4242

43-
if (entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
44-
{
45-
var jobProto = jobSystem.GetJobPrototype(proto);
43+
if (!entManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
44+
return false;
4645

47-
if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
48-
departmentColor = departmentProto.Color;
49-
}
46+
var jobProto = jobSystem.GetJobPrototype(proto);
47+
48+
if (jobSystem.TryGetDepartment(jobProto, out var departmentProto))
49+
departmentColor = departmentProto.Color;
50+
51+
if (!protoManager.TryIndex<JobPrototype>(jobProto, out var indexedJob))
52+
return false;
5053

5154
if (!Inverted)
5255
{
@@ -56,7 +59,7 @@ public override bool Check(IEntityManager entManager,
5659
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
5760
"role-timer-role-insufficient",
5861
("time", formattedRoleDiff),
59-
("job", Loc.GetString(proto)),
62+
("job", indexedJob.LocalizedName),
6063
("departmentColor", departmentColor.ToHex())));
6164
return false;
6265
}
@@ -66,7 +69,7 @@ public override bool Check(IEntityManager entManager,
6669
reason = FormattedMessage.FromMarkupPermissive(Loc.GetString(
6770
"role-timer-role-too-high",
6871
("time", formattedRoleDiff),
69-
("job", Loc.GetString(proto)),
72+
("job", indexedJob.LocalizedName),
7073
("departmentColor", departmentColor.ToHex())));
7174
return false;
7275
}

Resources/Locale/en-US/job/role-requirements.ftl

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to play this role.
2-
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?)
3-
role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to play this role.
4-
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?)
5-
role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to play this role.
6-
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?)
7-
role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] to play this role.
8-
role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] to play this role.
9-
role-timer-whitelisted-species = Your character must be one of the following species to play this role:
10-
role-timer-blacklisted-species = Your character must not be one of the following species to play this role:
11-
role-timer-whitelisted-traits = Your character must have one of the following traits:
12-
role-timer-blacklisted-traits = Your character must not have any of the following traits:
1+
role-timer-department-insufficient = You require [color=yellow]{$time}[/color] more playtime in the [color={$departmentColor}]{$department}[/color] department to unlock this.
2+
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?)
3+
role-timer-overall-insufficient = You require [color=yellow]{$time}[/color] more overall playtime to unlock this.
4+
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?)
5+
role-timer-role-insufficient = You require [color=yellow]{$time}[/color] more playtime with [color={$departmentColor}]{$job}[/color] to unlock this.
6+
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?)
7+
role-timer-age-too-old = Your character must be under the age of [color=yellow]{$age}[/color] for you to choose this.
8+
role-timer-age-too-young = Your character must be over the age of [color=yellow]{$age}[/color] for you to choose this.
9+
role-timer-whitelisted-species = Your character must be one of the following species for you to select this:
10+
role-timer-blacklisted-species = Your character must not be one of the following species for you to select this:
11+
role-timer-whitelisted-traits = Your character must have one of the following traits for you to select this:
12+
role-timer-blacklisted-traits = Your character must not have any of the following traits for you to select this:
1313
1414
role-timer-locked = Locked (hover for details)
1515

0 commit comments

Comments
 (0)