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
|
|
|
|
|
{
|
|
|
|
|
public sealed class InteractionSystem : SharedInteractionSystem
|
|
|
|
|
{
|
2021-11-29 12:25:22 +13:00
|
|
|
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
if (!EntityManager.EntityExists(target))
|
2021-11-29 12:25:22 +13:00
|
|
|
return false;
|
2021-09-16 13:02:10 +10:00
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
if (!target.TryGetContainer(out var container))
|
2021-11-29 12:25:22 +13:00
|
|
|
return false;
|
|
|
|
|
|
2023-09-11 21:20:46 +10:00
|
|
|
if (!TryComp(container.Owner, out StorageComponent? storage))
|
2021-11-29 12:25:22 +13:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// we don't check if the user can access the storage entity itself. This should be handed by the UI system.
|
2022-04-28 06:11:15 -06:00
|
|
|
// Need to return if UI is open or not
|
|
|
|
|
return true;
|
2021-11-29 12:25:22 +13:00
|
|
|
}
|
2021-09-16 13:02:10 +10:00
|
|
|
}
|
|
|
|
|
}
|