Virtual items cleanup (#23912)

* Virtual items cleanup

* Detail

* Review

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
(cherry picked from commit 108f001731b9394f98d9ef712b9b777e5b3f8abc)
This commit is contained in:
AJCM-git
2024-01-14 06:18:47 -04:00
committed by Debug
parent deea24e255
commit 9a6fa17e72
27 changed files with 310 additions and 195 deletions

View File

@@ -5,6 +5,7 @@ using Content.Client.UserInterface.Systems.Hands.Controls;
using Content.Client.UserInterface.Systems.Hotbar.Widgets;
using Content.Shared.Hands.Components;
using Content.Shared.Input;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Timing;
using Robust.Client.Player;
using Robust.Client.UserInterface;
@@ -117,7 +118,7 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
{
var handButton = AddHand(name, hand.Location);
if (_entities.TryGetComponent(hand.HeldEntity, out HandVirtualItemComponent? virt))
if (_entities.TryGetComponent(hand.HeldEntity, out VirtualItemComponent? virt))
{
handButton.SpriteView.SetEntity(virt.BlockingEntity);
handButton.Blocked = true;
@@ -168,7 +169,7 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
if (hand == null)
return;
if (_entities.TryGetComponent(entity, out HandVirtualItemComponent? virt))
if (_entities.TryGetComponent(entity, out VirtualItemComponent? virt))
{
hand.SpriteView.SetEntity(virt.BlockingEntity);
hand.Blocked = true;

View File

@@ -2,6 +2,7 @@ using Content.Client.Items;
using Content.Client.Resources;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory.VirtualItem;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
@@ -104,7 +105,7 @@ public sealed partial class ItemStatusPanel : BoxContainer
return;
}
if (_entityManager.TryGetComponent(_entity, out HandVirtualItemComponent? virtualItem)
if (_entityManager.TryGetComponent(_entity, out VirtualItemComponent? virtualItem)
&& _entityManager.EntityExists(virtualItem.BlockingEntity))
{
// Uses identity because we can be blocked by pulling someone

View File

@@ -12,6 +12,7 @@ using Content.Client.UserInterface.Systems.Inventory.Windows;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Hands.Components;
using Content.Shared.Input;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Storage;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
@@ -423,8 +424,17 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
if (_slotGroups.GetValueOrDefault(group)?.GetButton(name) is not { } button)
return;
button.SpriteView.SetEntity(entity);
button.StorageButton.Visible = showStorage;
if (_entities.TryGetComponent(entity, out VirtualItemComponent? virtb))
{
button.SpriteView.SetEntity(virtb.BlockingEntity);
button.Blocked = true;
}
else
{
button.SpriteView.SetEntity(entity);
button.Blocked = false;
button.StorageButton.Visible = showStorage;
}
}
public bool RegisterSlotGroupContainer(ItemSlotButtonContainer slotContainer)