Kill ContainerHelpers (#20908)

This commit is contained in:
Kara
2023-10-11 02:18:49 -07:00
committed by GitHub
parent 14dac914ce
commit dbb7c7065a
14 changed files with 54 additions and 46 deletions

View File

@@ -15,6 +15,7 @@ namespace Content.Client.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
var containerSys = entityManager.System<SharedContainerSystem>();
var organs = entityManager.EntityQuery<OrganComponent>(true);
foreach (var part in organs)
@@ -27,7 +28,7 @@ namespace Content.Client.Commands
sprite.ContainerOccluded = false;
var tempParent = part.Owner;
while (tempParent.TryGetContainer(out var container))
while (containerSys.TryGetContainingContainer(tempParent, out var container))
{
if (!container.ShowContents)
{

View File

@@ -174,8 +174,9 @@ namespace Content.Client.Instruments.UI
if (localPlayer.ControlledEntity == instrumentEnt)
return true;
var container = _owner.Entities.System<SharedContainerSystem>();
// If we're a handheld instrument, we might be in a container. Get it just in case.
instrumentEnt.TryGetContainerMan(out var conMan);
container.TryGetContainingContainer(instrumentEnt, out var conMan);
// If the instrument is handheld and we're not holding it, we return.
if ((instrument.Handheld && (conMan == null || conMan.Owner != localPlayer.ControlledEntity)))

View File

@@ -6,15 +6,17 @@ namespace Content.Client.Interactable
{
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 (!target.TryGetContainer(out var container))
if (!_container.TryGetContainingContainer(target, out var container))
return false;
if (!TryComp(container.Owner, out StorageComponent? storage))
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.