- fix: Job icon fixes (#38)

This commit is contained in:
Aviu00
2024-02-09 16:51:54 +09:00
committed by GitHub
parent 1f2e9cb5a7
commit a6b7a800e0
5 changed files with 27 additions and 15 deletions

View File

@@ -127,7 +127,7 @@ namespace Content.Client.Access.UI
_jobIconButtons.Add(jobIcon, newButton); _jobIconButtons.Add(jobIcon, newButton);
newButton.OnPressed += _ => newButton.OnPressed += _ =>
{ {
_lastJobIcon = jobIcon; _lastJobIcon = "JobIcon" + jobIcon;
SubmitData(); SubmitData();
}; };
@@ -279,7 +279,7 @@ namespace Content.Client.Access.UI
foreach (var (jobIcon, button) in _jobIconButtons) foreach (var (jobIcon, button) in _jobIconButtons)
{ {
button.Disabled = !interfaceEnabled; button.Disabled = !interfaceEnabled;
button.Pressed = state.TargetIdJobIcon == jobIcon; button.Pressed = state.TargetIdJobIcon?.Contains(jobIcon) ?? false;
} }
//WD-EDIT //WD-EDIT

View File

@@ -76,7 +76,12 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
if (_prototypeMan.TryIndex<StatusIconPrototype>(jobIconToGet, out var jobIcon)) if (_prototypeMan.TryIndex<StatusIconPrototype>(jobIconToGet, out var jobIcon))
result.Add(jobIcon); result.Add(jobIcon);
else else
Log.Error($"Invalid job icon prototype: {jobIcon}"); // WD EDIT START
{
Log.Error($"Invalid job icon prototype: {jobIconToGet}");
result.Add(_prototypeMan.Index<StatusIconPrototype>(JobIconForNoId));
}
// WD EDIT END
if (TryComp<MindShieldComponent>(uid, out var comp)) if (TryComp<MindShieldComponent>(uid, out var comp))
{ {

View File

@@ -85,14 +85,13 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
var targetAccessComponent = EntityManager.GetComponent<AccessComponent>(targetId); var targetAccessComponent = EntityManager.GetComponent<AccessComponent>(targetId);
var jobProto = string.Empty; var jobProto = string.Empty;
var jobIcon = string.Empty; //WD-EDIT var jobIcon = targetIdComponent.JobIcon; //WD-EDIT
if (TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage) if (TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage)
&& keyStorage.Key is {} key && keyStorage.Key is {} key
&& _record.TryGetRecord<GeneralStationRecord>(key, out var record)) && _record.TryGetRecord<GeneralStationRecord>(key, out var record))
{ {
jobProto = record.JobPrototype; jobProto = record.JobPrototype;
jobIcon = record.JobIcon;
Dirty(targetId, targetIdComponent); Dirty(targetId, targetIdComponent);
} }
@@ -135,18 +134,14 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
if (component.TargetIdSlot.Item is not { Valid: true } targetId || !PrivilegedIdIsAuthorized(uid, component)) if (component.TargetIdSlot.Item is not { Valid: true } targetId || !PrivilegedIdIsAuthorized(uid, component))
return; return;
//WD-EDIT
if (TryComp<IdCardComponent>(targetId, out var idCardComponent) && newJobIcon != null)
{
idCardComponent.JobIcon = newJobIcon;
}
//WD-EDIT
_idCard.TryChangeFullName(targetId, newFullName, player: player); _idCard.TryChangeFullName(targetId, newFullName, player: player);
_idCard.TryChangeJobTitle(targetId, newJobTitle, player: player); _idCard.TryChangeJobTitle(targetId, newJobTitle, player: player);
if (_prototype.TryIndex<JobPrototype>(newJobProto, out var job) // WD EDIT START
&& _prototype.TryIndex<StatusIconPrototype>(job.Icon, out var jobIcon)) if (_prototype.TryIndex<JobPrototype>(newJobProto, out var job))
newJobIcon ??= job.Icon;
if (newJobIcon != null && _prototype.TryIndex<StatusIconPrototype>(newJobIcon, out var jobIcon)) // WD EDIT END
{ {
_idCard.TryChangeJobIcon(targetId, jobIcon, player: player); _idCard.TryChangeJobIcon(targetId, jobIcon, player: player);
} }

View File

@@ -42,7 +42,7 @@ public sealed partial class IdCardConsoleComponent : Component
JobTitle = jobTitle; JobTitle = jobTitle;
AccessList = accessList; AccessList = accessList;
JobPrototype = jobPrototype; JobPrototype = jobPrototype;
SelectedIcon = "JobIcon" + selectedIcon; SelectedIcon = selectedIcon;
} }
} }
@@ -89,6 +89,7 @@ public sealed partial class IdCardConsoleComponent : Component
{ {
"AtmosphericTechnician", "AtmosphericTechnician",
"Bartender", "Bartender",
"Borg",
"Botanist", "Botanist",
"Boxer", "Boxer",
"Brigmedic", "Brigmedic",
@@ -100,10 +101,12 @@ public sealed partial class IdCardConsoleComponent : Component
"ChiefEngineer", "ChiefEngineer",
"ChiefMedicalOfficer", "ChiefMedicalOfficer",
"Clown", "Clown",
"CustomId",
"Detective", "Detective",
"Geneticist", "Geneticist",
"HeadOfPersonnel", "HeadOfPersonnel",
"HeadOfSecurity", "HeadOfSecurity",
"Inspector",
"Janitor", "Janitor",
"Lawyer", "Lawyer",
"Librarian", "Librarian",
@@ -124,12 +127,14 @@ public sealed partial class IdCardConsoleComponent : Component
"SecurityOfficer", "SecurityOfficer",
"SeniorEngineer", "SeniorEngineer",
"SeniorOfficer", "SeniorOfficer",
"SeniorPhysician",
"SeniorResearcher", "SeniorResearcher",
"ServiceWorker", "ServiceWorker",
"ShaftMiner", "ShaftMiner",
"StationEngineer", "StationEngineer",
"TechnicalAssistant", "TechnicalAssistant",
"Virologist", "Virologist",
"Visitor",
"Warden", "Warden",
"Zookeeper" "Zookeeper"
}; };

View File

@@ -661,6 +661,13 @@
- JobIconZookeeper - JobIconZookeeper
- JobIconInspector - JobIconInspector
- JobIconVisitor - JobIconVisitor
- JobIconNoId
- JobIconCustomId
- JobIconBorg
- JobIconSeniorPhysician
- JobIconSeniorOfficer
- JobIconSeniorEngineer
- JobIconSeniorResearcher
- type: ActivatableUI - type: ActivatableUI
key: enum.AgentIDCardUiKey.Key key: enum.AgentIDCardUiKey.Key
inHandsOnly: true inHandsOnly: true