diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs index 7123d72eea..7570055038 100644 --- a/Content.Client/Commands/HideMechanismsCommand.cs +++ b/Content.Client/Commands/HideMechanismsCommand.cs @@ -29,7 +29,7 @@ namespace Content.Client.Commands sprite.ContainerOccluded = false; var tempParent = mechanism.Owner; - while (ContainerHelpers.TryGetContainer(tempParent, out var container)) + while (tempParent.TryGetContainer(out var container)) { if (!container.ShowContents) { diff --git a/Content.Client/GameObjects/Components/Items/ItemComponent.cs b/Content.Client/GameObjects/Components/Items/ItemComponent.cs index 4b1b2b46be..42acb64a2e 100644 --- a/Content.Client/GameObjects/Components/Items/ItemComponent.cs +++ b/Content.Client/GameObjects/Components/Items/ItemComponent.cs @@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components.Items set { _equippedPrefix = value; - if (!ContainerHelpers.TryGetContainer(Owner, out IContainer container)) return; + if (!Owner.TryGetContainer(out IContainer container)) return; if(container.Owner.TryGetComponent(out HandsComponent hands)) hands.RefreshInHands(); } diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index cf462e6287..9b48bca5f3 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -126,7 +126,7 @@ namespace Content.Client.GameObjects.EntitySystems } if (!_playerCanSeeThroughContainers && - ContainerHelpers.TryGetContainer(entity, out var container) && + entity.TryGetContainer(out var container) && !container.ShowContents) { return false; diff --git a/Content.Client/Instruments/InstrumentMenu.cs b/Content.Client/Instruments/InstrumentMenu.cs index c980ffbba7..1612aec48f 100644 --- a/Content.Client/Instruments/InstrumentMenu.cs +++ b/Content.Client/Instruments/InstrumentMenu.cs @@ -218,7 +218,7 @@ namespace Content.Client.Instruments var instrumentEnt = _owner.Instrument.Owner; var instrument = _owner.Instrument; - ContainerHelpers.TryGetContainerMan(_owner.Instrument.Owner, out var conMan); + _owner.Instrument.Owner.TryGetContainerMan(out var conMan); var localPlayer = IoCManager.Resolve().LocalPlayer; diff --git a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs index 67821796b4..fd93d83335 100644 --- a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (!ContainerHelpers.TryGetContainer(_target, out var container)) + if (!_target.TryGetContainer(out var container)) { return Outcome.Success; } diff --git a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs index 4f035aa1cd..060b1a533b 100644 --- a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.Operators.Inventory { if (_target.Deleted || !_target.HasComponent() || - ContainerHelpers.IsInContainer(_target) || + _target.IsInContainer() || !_owner.InRangeUnobstructed(_target, popup: true)) { return Outcome.Failed; diff --git a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs index d8e9557966..2f93ace5ae 100644 --- a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs +++ b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs @@ -22,7 +22,7 @@ namespace Content.Server.AI.Utility.Considerations.Containers return 0.0f; } - if (ContainerHelpers.TryGetContainer(target, out var container)) + if (target.TryGetContainer(out var container)) { if (container.Owner.TryGetComponent(out EntityStorageComponent storageComponent)) { diff --git a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs index a98e6e90f2..0447f6c5a6 100644 --- a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs +++ b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs @@ -26,7 +26,7 @@ namespace Content.Server.AI.WorldState.States.Clothing foreach (var entity in Visibility .GetNearestEntities(Owner.Transform.Coordinates, typeof(ClothingComponent), controller.VisionRadius)) { - if (ContainerHelpers.TryGetContainer(entity, out var container)) + if (entity.TryGetContainer(out var container)) { if (!container.Owner.HasComponent()) { diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs index bd104a29fd..e01662b2bc 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs @@ -26,7 +26,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition foreach (var entity in Visibility .GetNearestEntities(Owner.Transform.Coordinates, typeof(DrinkComponent), controller.VisionRadius)) { - if (ContainerHelpers.TryGetContainer(entity, out var container)) + if (entity.TryGetContainer(out var container)) { if (!container.Owner.HasComponent()) { diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs index 59eb53f0e0..60f02346b5 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs @@ -26,7 +26,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition foreach (var entity in Visibility .GetNearestEntities(Owner.Transform.Coordinates, typeof(FoodComponent), controller.VisionRadius)) { - if (ContainerHelpers.TryGetContainer(entity, out var container)) + if (entity.TryGetContainer(out var container)) { if (!container.Owner.HasComponent()) { diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index 6e5d91e5ec..69cba419e3 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -198,7 +198,7 @@ namespace Content.Server.Atmos { if (!entity.TryGetComponent(out IPhysicsComponent physics) || !entity.TryGetComponent(out MovedByPressureComponent pressure) - || ContainerHelpers.IsInContainer(entity)) + || entity.IsInContainer()) continue; physics.WakeBody(); diff --git a/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs index d03ebafe81..14f9b1a9a2 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasTankComponent.cs @@ -234,7 +234,7 @@ namespace Content.Server.GameObjects.Components.Atmos private InternalsComponent? GetInternalsComponent(IEntity? owner = null) { if (owner != null) return owner.GetComponentOrNull(); - return ContainerHelpers.TryGetContainer(Owner, out var container) + return Owner.TryGetContainer(out var container) ? container.Owner.GetComponentOrNull() : null; } diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index 1c4c0f55f8..430fe45c39 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -199,10 +199,10 @@ namespace Content.Server.GameObjects.Components.Buckle } // If in a container - if (ContainerHelpers.TryGetContainer(Owner, out var ownerContainer)) + if (Owner.TryGetContainer(out var ownerContainer)) { // And not in the same container as the strap - if (!ContainerHelpers.TryGetContainer(strap.Owner, out var strapContainer) || + if (!strap.Owner.TryGetContainer(out var strapContainer) || ownerContainer != strapContainer) { return false; @@ -336,7 +336,7 @@ namespace Content.Server.GameObjects.Components.Buckle if (Owner.Transform.Parent == oldBuckledTo.Owner.Transform) { - ContainerHelpers.AttachParentToContainerOrGrid(Owner.Transform); + Owner.Transform.AttachParentToContainerOrGrid(); Owner.Transform.WorldRotation = oldBuckledTo.Owner.Transform.WorldRotation; } diff --git a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs index 6593075814..2b3d3c74e8 100644 --- a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs +++ b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs @@ -127,7 +127,7 @@ namespace Content.Server.GameObjects.Components.Conveyor return false; } - if (ContainerHelpers.IsInContainer(entity)) + if (entity.IsInContainer()) { return false; } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs index 621231315f..c29c9088f9 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs @@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Disposal if (entity.Transform.Parent == Owner.Transform) { - ContainerHelpers.AttachParentToContainerOrGrid(entity.Transform); + entity.Transform.AttachParentToContainerOrGrid(); } } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs index e757fb5ace..ecf61a7655 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs @@ -720,7 +720,7 @@ namespace Content.Server.GameObjects.Components.Disposal return false; } - if (ContainerHelpers.IsInContainer(eventArgs.User)) + if (eventArgs.User.IsInContainer()) { Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't reach there!")); return false; diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index e0e1b7d7bb..681cbe046f 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -623,7 +623,7 @@ namespace Content.Server.GameObjects.Components.Disposal return false; } - if (ContainerHelpers.IsInContainer(eventArgs.User)) + if (eventArgs.User.IsInContainer()) { Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't reach there!")); return false; diff --git a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs index 06a3b1f816..a6fa3dbcc1 100644 --- a/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs +++ b/Content.Server/GameObjects/Components/Explosion/FlashExplosiveComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Explosion public bool Explode() { // If we're in a locker or whatever then can't flash anything - ContainerHelpers.TryGetContainer(Owner, out var container); + Owner.TryGetContainer(out var container); if (container == null || !container.Owner.HasComponent()) { FlashableComponent.FlashAreaHelper(Owner, _range, _duration); diff --git a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs index acaf65c06e..f80898d3b7 100644 --- a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs @@ -277,7 +277,7 @@ namespace Content.Server.GameObjects.Components.GUI spriteComponent.RenderOrder = item.Owner.EntityManager.CurrentTick.Value; } - if (ContainerHelpers.TryGetContainer(Owner, out var container)) + if (Owner.TryGetContainer(out var container)) { container.Insert(item.Owner); } diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index be65d7a5aa..83c8c78609 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -296,7 +296,7 @@ namespace Content.Server.GameObjects.Components.GUI } // TODO: The item should be dropped to the container our owner is in, if any. - ContainerHelpers.AttachParentToContainerOrGrid(entity.Transform); + entity.Transform.AttachParentToContainerOrGrid(); _entitySystemManager.GetEntitySystem().UnequippedInteraction(Owner, entity, slot); @@ -321,7 +321,7 @@ namespace Content.Server.GameObjects.Components.GUI var itemTransform = entity.Transform; - ContainerHelpers.AttachParentToContainerOrGrid(itemTransform); + itemTransform.AttachParentToContainerOrGrid(); _entitySystemManager.GetEntitySystem().UnequippedInteraction(Owner, item.Owner, slot); diff --git a/Content.Server/GameObjects/Components/Headset/HeadsetComponent.cs b/Content.Server/GameObjects/Components/Headset/HeadsetComponent.cs index c569e6beeb..5be87b0047 100644 --- a/Content.Server/GameObjects/Components/Headset/HeadsetComponent.cs +++ b/Content.Server/GameObjects/Components/Headset/HeadsetComponent.cs @@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Headset public void Receive(string message, int channel, IEntity source) { - if (ContainerHelpers.TryGetContainer(Owner, out var container)) + if (Owner.TryGetContainer(out var container)) { if (!container.Owner.TryGetComponent(out IActorComponent actor)) return; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs index 9c88a9769a..b55870af4b 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs @@ -111,7 +111,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage protected override void GetData(IEntity user, ItemComponent component, VerbData data) { if (!ActionBlockerSystem.CanInteract(user) || - ContainerHelpers.IsInContainer(component.Owner) || + component.Owner.IsInContainer() || !component.CanPickup(user)) { data.Visibility = VerbVisibility.Invisible; diff --git a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs index 978455b504..a671569135 100644 --- a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs +++ b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs @@ -142,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Recycling return false; } - if (ContainerHelpers.IsInContainer(entity)) + if (entity.IsInContainer()) { return false; } diff --git a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs index 2febf0c44b..361da0921e 100644 --- a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs @@ -210,7 +210,7 @@ namespace Content.Server.GameObjects.Components.Singularity return; } - if (ContainerHelpers.IsInContainer(entity)) return; + if (entity.IsInContainer()) return; entity.Delete(); Energy++; diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs index 5fe579ba3b..94565b01be 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/BoltActionBarrelComponent.cs @@ -223,7 +223,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels if (_chamberContainer.ContainedEntity == null && manual) { BoltOpen = true; - if (ContainerHelpers.TryGetContainer(Owner, out var container)) + if (Owner.TryGetContainer(out var container)) { Owner.PopupMessage(container.Owner, Loc.GetString("Bolt opened")); } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs index ea776c6deb..8ef315d292 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerMagazineBarrelComponent.cs @@ -242,7 +242,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels soundSystem.PlayAtCoords(_soundBoltOpen, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); } - if (ContainerHelpers.TryGetContainer(Owner, out var container)) + if (Owner.TryGetContainer(out var container)) { Owner.PopupMessage(container.Owner, Loc.GetString("Bolt open")); } diff --git a/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs b/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs index c6bcb65591..1993021296 100644 --- a/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs @@ -86,8 +86,8 @@ namespace Content.Server.GameObjects.EntitySystems return; } - var contained = ContainerHelpers.TryGetContainer(buckle.Owner, out var ownContainer); - var strapContained = ContainerHelpers.TryGetContainer(strap.Owner, out var strapContainer); + var contained = buckle.Owner.TryGetContainer(out var ownContainer); + var strapContained = strap.Owner.TryGetContainer(out var strapContainer); if (contained != strapContained || ownContainer != strapContainer) { diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index c53ffb3fe0..5ac39cf648 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -329,19 +329,19 @@ namespace Content.Server.GameObjects.EntitySystems.Click } // If in a container - if (ContainerHelpers.IsInContainer(player)) + if (player.IsInContainer()) { return; } // In a container where the attacked entity is not the container's owner - if (ContainerHelpers.TryGetContainer(player, out var playerContainer) && + if (player.TryGetContainer(out var playerContainer) && attacked != playerContainer.Owner) { // Either the attacked entity is null, not contained or in a different container if (attacked == null || - !ContainerHelpers.TryGetContainer(attacked, out var attackedContainer) || + !attacked.TryGetContainer(out var attackedContainer) || attackedContainer != playerContainer) { return; diff --git a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs index e865e23c66..72b2246514 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs @@ -59,7 +59,7 @@ namespace Content.Shared.GameObjects.Components.Movement private bool TrySlip(IEntity entity) { if (!Slippery - || ContainerHelpers.IsInContainer(Owner) + || Owner.IsInContainer() || _slipped.Contains(entity.Uid) || !entity.TryGetComponent(out SharedStunnableComponent stun) || !entity.TryGetComponent(out IPhysicsComponent otherBody) diff --git a/Content.Shared/GameObjects/Components/SharedStackComponent.cs b/Content.Shared/GameObjects/Components/SharedStackComponent.cs index 2acedacade..f1867d291e 100644 --- a/Content.Shared/GameObjects/Components/SharedStackComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedStackComponent.cs @@ -27,7 +27,7 @@ namespace Content.Shared.GameObjects.Components _count = value; if (_count <= 0) { - if (ContainerHelpers.TryGetContainerMan(Owner, out var containerManager)) + if (Owner.TryGetContainerMan(out var containerManager)) { containerManager.Remove(Owner); } diff --git a/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs b/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs index 79489aa59d..b052dc4ea9 100644 --- a/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs +++ b/Content.Shared/GameObjects/EntitySystems/ExamineSystemShared.cs @@ -58,7 +58,7 @@ namespace Content.Shared.GameObjects.EntitySystems Ignored predicate = entity => entity == examiner || entity == examined; - if (ContainerHelpers.TryGetContainer(examiner, out var container)) + if (examiner.TryGetContainer(out var container)) { predicate += entity => entity == container.Owner; } diff --git a/Content.Shared/GameObjects/Verbs/VerbUtility.cs b/Content.Shared/GameObjects/Verbs/VerbUtility.cs index 4a2bb756e0..78aaa227d0 100644 --- a/Content.Shared/GameObjects/Verbs/VerbUtility.cs +++ b/Content.Shared/GameObjects/Verbs/VerbUtility.cs @@ -86,7 +86,7 @@ namespace Content.Shared.GameObjects.Verbs { if (!user.IsInSameOrNoContainer(target)) { - if (!ContainerHelpers.TryGetContainer(target, out var container) || + if (!target.TryGetContainer(out var container) || container.Owner != user) { return false;