Files
OldThink/Content.Client/Interactable/InteractionSystem.cs

28 lines
891 B
C#
Raw Normal View History

using Content.Shared.Interaction;
2023-09-11 21:20:46 +10:00
using Content.Shared.Storage;
using Robust.Shared.Containers;
namespace Content.Client.Interactable
{
public sealed class InteractionSystem : SharedInteractionSystem
{
2023-10-11 02:18:49 -07:00
[Dependency] private readonly SharedContainerSystem _container = default!;
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
{
2021-12-05 18:09:01 +01:00
if (!EntityManager.EntityExists(target))
return false;
2023-10-11 02:18:49 -07:00
if (!_container.TryGetContainingContainer(target, out var container))
return false;
2023-10-11 02:18:49 -07:00
if (!HasComp<StorageComponent>(container.Owner))
return false;
// we don't check if the user can access the storage entity itself. This should be handed by the UI system.
// Need to return if UI is open or not
return true;
}
}
}