Updated ContainerHelpers to use new extensions (#2530)

Co-authored-by: David Tan <>
This commit is contained in:
DTanxxx
2020-11-13 20:25:04 +13:00
committed by GitHub
parent 9f9bd3ade6
commit 69d709a28f
32 changed files with 38 additions and 38 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -127,7 +127,7 @@ namespace Content.Server.GameObjects.Components.Conveyor
return false;
}
if (ContainerHelpers.IsInContainer(entity))
if (entity.IsInContainer())
{
return false;
}

View File

@@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Disposal
if (entity.Transform.Parent == Owner.Transform)
{
ContainerHelpers.AttachParentToContainerOrGrid(entity.Transform);
entity.Transform.AttachParentToContainerOrGrid();
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -142,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Recycling
return false;
}
if (ContainerHelpers.IsInContainer(entity))
if (entity.IsInContainer())
{
return false;
}

View File

@@ -210,7 +210,7 @@ namespace Content.Server.GameObjects.Components.Singularity
return;
}
if (ContainerHelpers.IsInContainer(entity)) return;
if (entity.IsInContainer()) return;
entity.Delete();
Energy++;

View File

@@ -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"));
}

View File

@@ -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"));
}