mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user