Enable verbs for items in storage and prevent orphaned nested UIs (#5512)

This commit is contained in:
Leon Friedrich
2021-11-29 12:25:22 +13:00
committed by GitHub
parent 3601416f72
commit 22ee9f5e83
9 changed files with 190 additions and 86 deletions

View File

@@ -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;
}
}
}