Updated ContainerHelpers to use new extensions (#2530)
Co-authored-by: David Tan <>
This commit is contained in:
@@ -234,7 +234,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private InternalsComponent? GetInternalsComponent(IEntity? owner = null)
|
||||
{
|
||||
if (owner != null) return owner.GetComponentOrNull<InternalsComponent>();
|
||||
return ContainerHelpers.TryGetContainer(Owner, out var container)
|
||||
return Owner.TryGetContainer(out var container)
|
||||
? container.Owner.GetComponentOrNull<InternalsComponent>()
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Content.Server.GameObjects.Components.Conveyor
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ContainerHelpers.IsInContainer(entity))
|
||||
if (entity.IsInContainer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
if (entity.Transform.Parent == Owner.Transform)
|
||||
{
|
||||
ContainerHelpers.AttachParentToContainerOrGrid(entity.Transform);
|
||||
entity.Transform.AttachParentToContainerOrGrid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<EntityStorageComponent>())
|
||||
{
|
||||
FlashableComponent.FlashAreaHelper(Owner, _range, _duration);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<InteractionSystem>().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<InteractionSystem>().UnequippedInteraction(Owner, item.Owner, slot);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Recycling
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ContainerHelpers.IsInContainer(entity))
|
||||
if (entity.IsInContainer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
return;
|
||||
}
|
||||
|
||||
if (ContainerHelpers.IsInContainer(entity)) return;
|
||||
if (entity.IsInContainer()) return;
|
||||
|
||||
entity.Delete();
|
||||
Energy++;
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user