diff --git a/Content.Server/PDA/PDASystem.cs b/Content.Server/PDA/PDASystem.cs index 8e263a0912..8a3ced56a6 100644 --- a/Content.Server/PDA/PDASystem.cs +++ b/Content.Server/PDA/PDASystem.cs @@ -2,6 +2,7 @@ using Content.Server.Light.Components; using Content.Server.Light.EntitySystems; using Content.Server.Light.Events; using Content.Server.Traitor.Uplink; +using Content.Server.Traitor.Uplink.Account; using Content.Server.Traitor.Uplink.Components; using Content.Server.UserInterface; using Content.Shared.Containers.ItemSlots; @@ -17,6 +18,7 @@ namespace Content.Server.PDA public sealed class PDASystem : SharedPDASystem { [Dependency] private readonly UplinkSystem _uplinkSystem = default!; + [Dependency] private readonly UplinkAccountsSystem _uplinkAccounts = default!; [Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!; public override void Initialize() @@ -82,6 +84,7 @@ namespace Content.Server.PDA if (!EntityManager.TryGetComponent(user, out ActorComponent? actor)) return false; + UpdatePDAUserInterface(pda, user); var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key); ui?.Toggle(actor.PlayerSession); @@ -94,7 +97,7 @@ namespace Content.Server.PDA appearance.SetData(PDAVisuals.IDCardInserted, pda.ContainedID != null); } - private void UpdatePDAUserInterface(PDAComponent pda) + private void UpdatePDAUserInterface(PDAComponent pda, EntityUid? user = default) { var ownerInfo = new PDAIdInfoText { @@ -105,6 +108,9 @@ namespace Content.Server.PDA var hasUplink = EntityManager.HasComponent(pda.Owner); + if (user is not null) + hasUplink &= _uplinkAccounts.HasAccount(user.Value); + var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key); ui?.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo, hasUplink)); } @@ -118,7 +124,7 @@ namespace Content.Server.PDA switch (msg.Message) { case PDARequestUpdateInterfaceMessage _: - UpdatePDAUserInterface(pda); + UpdatePDAUserInterface(pda, playerUid); break; case PDAToggleFlashlightMessage _: { diff --git a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs index decaf4a236..a3c4c996bb 100644 --- a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs +++ b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Shared.Stacks; using Content.Shared.Traitor.Uplink; using Robust.Shared.GameObjects; @@ -28,6 +29,8 @@ namespace Content.Server.Traitor.Uplink.Account return _accounts.Add(acc); } + public bool HasAccount(EntityUid holder) => + _accounts.Any(acct => acct.AccountHolder == holder); /// /// Add TC to uplinks account balance