Fix strippable showing virtual items.

This commit is contained in:
Vera Aguilera Puerto
2021-10-01 13:35:21 +02:00
parent d1bd306dfe
commit bbe79d91a7
2 changed files with 19 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ using Content.Server.Items;
using Content.Server.UserInterface;
using Content.Shared.ActionBlocker;
using Content.Shared.DragDrop;
using Content.Shared.Hands.Components;
using Content.Shared.Popups;
using Content.Shared.Strip.Components;
using Content.Shared.Verbs;
@@ -26,6 +27,8 @@ namespace Content.Server.Strip
{
public const float StripDelay = 2f;
// TODO: This component needs localization.
[ViewVariables]
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key);
@@ -128,7 +131,15 @@ namespace Content.Server.Strip
foreach (var hand in hands.HandNames)
{
dictionary[hand] = hands.GetItem(hand)?.Owner.Name ?? "None";
var owner = hands.GetItem(hand)?.Owner;
if (owner?.HasComponent<HandVirtualItemComponent>() ?? true)
{
dictionary[hand] = "None";
continue;
}
dictionary[hand] = owner.Name;
}
return dictionary;
@@ -348,6 +359,9 @@ namespace Content.Server.Strip
return false;
}
if (heldItem.Owner.HasComponent<HandVirtualItemComponent>())
return false;
if (!hands.CanDrop(hand, false))
{
user.PopupMessageCursor(Loc.GetString("strippable-component-cannot-drop-message",("owner", Owner)));