Right now ShuttleControllers add the collision component to the Grid Entity.

Adds Grids to the collision group.
This commit is contained in:
Acruid
2020-01-09 18:29:09 -08:00
parent 0db46da30e
commit 51f7f14c08
3 changed files with 13 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player; using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Network; using Robust.Shared.Interfaces.Network;
using Robust.Shared.Interfaces.Timing; using Robust.Shared.Interfaces.Timing;
@@ -53,6 +54,14 @@ namespace Content.Server.GameObjects.Components.Movement
physComp.Mass = 1; physComp.Mass = 1;
} }
if (!gridEntity.HasComponent<ICollidableComponent>())
{
var collideComp = gridEntity.AddComponent<CollidableComponent>();
collideComp.CollisionEnabled = true;
collideComp.IsHardCollidable = true;
collideComp.PhysicsShapes.Add(new PhysShapeGrid(grid));
}
physComp.LinearVelocity = CalcNewVelocity(direction, enabled) * WalkMoveSpeed; physComp.LinearVelocity = CalcNewVelocity(direction, enabled) * WalkMoveSpeed;
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Map;
namespace Content.Shared.Physics namespace Content.Shared.Physics
{ {
@@ -17,6 +18,8 @@ namespace Content.Shared.Physics
SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table
Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items) Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items)
MapGrid = MapGridHelpers.CollisionGroup, // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
// 32 possible groups // 32 possible groups
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable, MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
AllMask = -1, AllMask = -1,