Updated ContainerHelpers to use new extensions (#1396)

Co-authored-by: David Tan <>
This commit is contained in:
DTanxxx
2020-11-09 09:22:31 +01:00
committed by GitHub
co-authored by David Tan <>
parent d5982b3ea2
commit 791fcfd65e
4 changed files with 7 additions and 7 deletions
@@ -61,7 +61,7 @@ namespace Robust.Client.GameObjects.EntitySystems
// We have to recursively scan for containers upwards in case of nested containers.
var tempParent = entity;
while (ContainerHelpers.TryGetContainer(tempParent, out var container))
while (tempParent.TryGetContainer(out var container))
{
if (!container.ShowContents)
{
@@ -79,7 +79,7 @@ namespace Robust.Client.GameObjects.EntitySystems
// We have to recursively scan for containers upwards in case of nested containers.
var tempParent = entity;
while (ContainerHelpers.TryGetContainer(tempParent, out var container))
while (tempParent.TryGetContainer(out var container))
{
if (container.OccludesLight)
{
@@ -122,7 +122,7 @@ namespace Robust.Server.GameObjects.Components.Container
if (transform.Parent == null) // Only true if Parent is the map entity
return false;
if(ContainerHelpers.TryGetContainerMan(transform.Parent.Owner, out var containerManager) && !containerManager.Remove(toinsert))
if(transform.Parent.Owner.TryGetContainerMan(out var containerManager) && !containerManager.Remove(toinsert))
{
// Can't remove from existing container, can't insert.
return false;
@@ -182,7 +182,7 @@ namespace Robust.Server.GameObjects.Components.Container
if (!toremove.IsValid())
return true;
ContainerHelpers.AttachParentToContainerOrGrid(toremove.Transform);
toremove.Transform.AttachParentToContainerOrGrid();
return true;
}
@@ -198,7 +198,7 @@ namespace Robust.Shared.GameObjects.Components.Transform
}
}
public bool IsMapTransform => !ContainerHelpers.IsInContainer(Owner);
public bool IsMapTransform => !Owner.IsInContainer();
/// <inheritdoc />
[ViewVariables(VVAccess.ReadWrite)]
@@ -372,7 +372,7 @@ namespace Robust.Shared.GameObjects.Systems
if (physics.LinearVelocity != Vector2.Zero)
{
if (ContainerHelpers.IsInContainer(ent))
if (ent.IsInContainer())
{
var relayEntityMoveMessage = new RelayMovementEntityMessage(ent);
ent.Transform.Parent!.Owner.SendMessage(ent.Transform, relayEntityMoveMessage);
@@ -393,7 +393,7 @@ namespace Robust.Shared.GameObjects.Systems
var transform = owner.Transform;
// Change parent if necessary
if (!ContainerHelpers.IsInContainer(owner))
if (!owner.IsInContainer())
{
// This shoouullddnnn'''tt de-parent anything in a container because none of that should have physics applied to it.
if (_mapManager.TryFindGridAt(owner.Transform.MapID, newPosition, out var grid) &&