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

View File

@@ -76,7 +76,12 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIco
if (_prototypeMan.TryIndex<StatusIconPrototype>(jobIconToGet, out var jobIcon))
result.Add(jobIcon);
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))
{

View File

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

View File

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

View File

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