2021-09-16 13:02:10 +10:00
|
|
|
using Content.Shared.Interaction;
|
2023-09-11 21:20:46 +10:00
|
|
|
using Content.Shared.Storage;
|
2021-11-29 12:25:22 +13:00
|
|
|
using Robust.Shared.Containers;
|
2021-09-16 13:02:10 +10:00
|
|
|
|
|
|
|
|
namespace Content.Client.Interactable
|
|
|
|
|
{
|
2024-10-22 22:47:57 +03:00
|
|
|
public sealed class InteractionSystem : SharedInteractionSystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
|
|
|
|
|
|
|
|
|
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
|
|
|
|
{
|
|
|
|
|
if (!EntityManager.EntityExists(target))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!_container.TryGetContainingContainer(target, out var container))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-16 13:02:10 +10:00
|
|
|
}
|