You can now swap IDs in PDAs.
This commit is contained in:
@@ -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<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
var item = eventArgs.Using;
|
||||
if (!IdSlotEmpty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.TryGetComponent<IdCardComponent>(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<HandsComponent>().PutInHand(swap.GetComponent<ItemComponent>());
|
||||
}
|
||||
|
||||
UpdatePDAUserInterface();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user