Enable verbs for items in storage and prevent orphaned nested UIs (#5512)
This commit is contained in:
@@ -6,8 +6,6 @@ using Content.Client.Verbs;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
@@ -121,8 +119,12 @@ namespace Content.Client.ContextMenu.UI
|
||||
}
|
||||
|
||||
// do some other server-side interaction?
|
||||
if (args.Function == EngineKeyFunctions.Use || args.Function == ContentKeyFunctions.AltActivateItemInWorld || args.Function == ContentKeyFunctions.Point ||
|
||||
args.Function == ContentKeyFunctions.TryPullObject || args.Function == ContentKeyFunctions.MovePulledObject)
|
||||
if (args.Function == EngineKeyFunctions.Use ||
|
||||
args.Function == ContentKeyFunctions.ActivateItemInWorld ||
|
||||
args.Function == ContentKeyFunctions.AltActivateItemInWorld ||
|
||||
args.Function == ContentKeyFunctions.Point ||
|
||||
args.Function == ContentKeyFunctions.TryPullObject ||
|
||||
args.Function == ContentKeyFunctions.MovePulledObject)
|
||||
{
|
||||
var inputSys = _systemManager.GetEntitySystem<InputSystem>();
|
||||
|
||||
@@ -142,11 +144,6 @@ namespace Content.Client.ContextMenu.UI
|
||||
args.Handle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_itemSlotManager.OnButtonPressed(args, entity))
|
||||
{
|
||||
_verbSystem.CloseAllMenus();
|
||||
}
|
||||
}
|
||||
|
||||
private bool HandleOpenEntityMenu(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
using Content.Client.Storage;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Interactable
|
||||
{
|
||||
public sealed class InteractionSystem : SharedInteractionSystem
|
||||
{
|
||||
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
||||
{
|
||||
if (!EntityManager.TryGetEntity(target, out var entity))
|
||||
return false;
|
||||
|
||||
if (!entity.TryGetContainer(out var container))
|
||||
return false;
|
||||
|
||||
if (!EntityManager.TryGetComponent(container.Owner.Uid, out ClientStorageComponent storage))
|
||||
return false;
|
||||
|
||||
// we don't check if the user can access the storage entity itself. This should be handed by the UI system.
|
||||
return storage.UIOpen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Content.Client.Storage
|
||||
private int StorageSizeUsed;
|
||||
private int StorageCapacityMax;
|
||||
private StorageWindow? _window;
|
||||
public bool UIOpen => _window?.IsOpen ?? false;
|
||||
|
||||
public override IReadOnlyList<IEntity> StoredEntities => _storedEntities;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user