diff --git a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs index 010a30f810..379b56a8df 100644 --- a/Content.Server/GameObjects/Components/PDA/PDAComponent.cs +++ b/Content.Server/GameObjects/Components/PDA/PDAComponent.cs @@ -8,11 +8,13 @@ using Content.Server.GameObjects.Components.Access; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.Interfaces; +using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Interfaces.PDA; using Content.Server.Utility; using Content.Shared.GameObjects.Components.PDA; using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.Verbs; +using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; @@ -150,17 +152,37 @@ namespace Content.Server.GameObjects.Components.PDA public async Task InteractUsing(InteractUsingEventArgs eventArgs) { var item = eventArgs.Using; - if (!IdSlotEmpty) - { - return false; - } if (!item.TryGetComponent(out var idCardComponent) || _idSlot.Contains(item)) { return false; } + if (!eventArgs.User.TryGetComponent(out IHandsComponent? hands)) + { + Owner.PopupMessage(eventArgs.User, Loc.GetString("You have no hands!")); + return true; + } + + IEntity? swap = null; + if (!IdSlotEmpty) + { + // Swap + swap = _idSlot.ContainedEntities[0]; + } + + if (!hands.Drop(item)) + { + return true; + } + InsertIdCard(idCardComponent); + + if (swap != null) + { + eventArgs.User.GetComponent().PutInHand(swap.GetComponent()); + } + UpdatePDAUserInterface(); return true; }