diff --git a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs index 73f18aec8d..c3fac8cb92 100644 --- a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs +++ b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs @@ -40,9 +40,9 @@ namespace Content.Client.Access.UI SendMessage(new AgentIDCardJobChangedMessage(newJob)); } - public void OnJobIconChanged(string newJobIcon) + public void OnJobIconChanged(string newJobIconId) { - SendMessage(new AgentIDCardJobIconChangedMessage(newJobIcon)); + SendMessage(new AgentIDCardJobIconChangedMessage(newJobIconId)); } /// @@ -57,7 +57,7 @@ namespace Content.Client.Access.UI _window.SetCurrentName(cast.CurrentName); _window.SetCurrentJob(cast.CurrentJob); - _window.SetAllowedIcons(cast.Icons); + _window.SetAllowedIcons(cast.Icons, cast.CurrentJobIconId); } protected override void Dispose(bool disposing) diff --git a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs index beca0c41ba..9a38c0c485 100644 --- a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs +++ b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs @@ -38,7 +38,7 @@ namespace Content.Client.Access.UI JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text); } - public void SetAllowedIcons(HashSet icons) + public void SetAllowedIcons(HashSet icons, string currentJobIconId) { IconGrid.DisposeAllChildren(); @@ -79,6 +79,10 @@ namespace Content.Client.Access.UI jobIconButton.AddChild(jobIconTexture); jobIconButton.OnPressed += _ => _bui.OnJobIconChanged(jobIcon.ID); IconGrid.AddChild(jobIconButton); + + if (jobIconId.Equals(currentJobIconId)) + jobIconButton.Pressed = true; + i++; } } diff --git a/Content.Server/Access/Systems/AgentIDCardSystem.cs b/Content.Server/Access/Systems/AgentIDCardSystem.cs index 2c4425ec10..d5e9dc357d 100644 --- a/Content.Server/Access/Systems/AgentIDCardSystem.cs +++ b/Content.Server/Access/Systems/AgentIDCardSystem.cs @@ -67,7 +67,7 @@ namespace Content.Server.Access.Systems if (!TryComp(uid, out var idCard)) return; - var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", component.Icons); + var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", idCard.JobIcon ?? "", component.Icons); _uiSystem.SetUiState(uid, AgentIDCardUiKey.Key, state); } @@ -94,7 +94,7 @@ namespace Content.Server.Access.Systems return; } - if (!_prototypeManager.TryIndex(args.JobIcon, out var jobIcon)) + if (!_prototypeManager.TryIndex(args.JobIconId, out var jobIcon)) { return; } diff --git a/Content.Shared/Access/SharedAgentIDCardSystem.cs b/Content.Shared/Access/SharedAgentIDCardSystem.cs index ef6690cc35..d027a3937f 100644 --- a/Content.Shared/Access/SharedAgentIDCardSystem.cs +++ b/Content.Shared/Access/SharedAgentIDCardSystem.cs @@ -26,12 +26,14 @@ namespace Content.Shared.Access.Systems public readonly HashSet Icons; public string CurrentName { get; } public string CurrentJob { get; } + public string CurrentJobIconId { get; } - public AgentIDCardBoundUserInterfaceState(string currentName, string currentJob, HashSet icons) + public AgentIDCardBoundUserInterfaceState(string currentName, string currentJob, string currentJobIconId, HashSet icons) { Icons = icons; CurrentName = currentName; CurrentJob = currentJob; + CurrentJobIconId = currentJobIconId; } } @@ -60,11 +62,11 @@ namespace Content.Shared.Access.Systems [Serializable, NetSerializable] public sealed class AgentIDCardJobIconChangedMessage : BoundUserInterfaceMessage { - public string JobIcon { get; } + public string JobIconId { get; } - public AgentIDCardJobIconChangedMessage(string jobIcon) + public AgentIDCardJobIconChangedMessage(string jobIconId) { - JobIcon = jobIcon; + JobIconId = jobIconId; } } }