Add a test that puts all components on an entity and checks for no exceptions (#1815)
* Add test that puts all components on an entity and checks for no exceptions Also fix all the exceptions that happened because of this * Add comments to the test * Fix nullable errors * Fix more nullable errors * More nullable error fixes * Unignore basic actor component * Fix more nullable errors * NULLABLE ERROR * Add string interpolation * Merge if checks * Remove redundant pragma warning disable 649 * Address reviews * Remove null wrappers around TryGetComponent * Merge conflict fixes * APC battery component error fix * Fix power test * Fix atmos mapgrid usages
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Physics;
|
||||
@@ -7,6 +8,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -116,12 +118,18 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
var collidable = Owner.GetComponent<ICollidableComponent>();
|
||||
|
||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
||||
|
||||
collidable.Hard = false;
|
||||
var shape = collidable.PhysicsShapes[0];
|
||||
shape.CollisionLayer |= (int) CollisionGroup.SmallImpassable;
|
||||
shape.CollisionMask = (int)CollisionGroup.None;
|
||||
|
||||
var shape = collidable.PhysicsShapes.FirstOrDefault();
|
||||
|
||||
if (shape != null)
|
||||
{
|
||||
shape.CollisionLayer |= (int) CollisionGroup.SmallImpassable;
|
||||
shape.CollisionMask = (int) CollisionGroup.None;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
|
||||
Reference in New Issue
Block a user