Converted everything to use collision and physics component interfaces.
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
base.Initialize();
|
||||
|
||||
// This component requires a physics component.
|
||||
if (!Owner.HasComponent<PhysicsComponent>())
|
||||
if (!Owner.HasComponent<IPhysicsComponent>())
|
||||
Owner.AddComponent<PhysicsComponent>();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
{
|
||||
// This will blow up an entity it's attached to
|
||||
base.OnAdd();
|
||||
if (Owner.TryGetComponent<CollidableComponent>(out var collide))
|
||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collide))
|
||||
{
|
||||
//collide.IsHardCollidable = false;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
{
|
||||
// Added this component to avoid stacking portals and causing shenanigans
|
||||
// TODO: Doesn't do a great job of stopping stacking portals for directed
|
||||
if (entity.HasComponent<CollidableComponent>() || entity.HasComponent<ServerTeleporterComponent>())
|
||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<ServerTeleporterComponent>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
// TODO: Check the user's spot? Upside is no stacking TPs but downside is they can't unstuck themselves from walls.
|
||||
foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(user.Transform.MapID, target))
|
||||
{
|
||||
if (entity.HasComponent<CollidableComponent>() || entity.HasComponent<ServerPortalComponent>())
|
||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<ServerPortalComponent>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
if (_mapManager.TryGetGrid(gridId, out var grid) && _entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
{
|
||||
//TODO: Switch to shuttle component
|
||||
if (!gridEntity.TryGetComponent(out PhysicsComponent physComp))
|
||||
if (!gridEntity.TryGetComponent(out IPhysicsComponent physComp))
|
||||
{
|
||||
physComp = gridEntity.AddComponent<PhysicsComponent>();
|
||||
physComp.Mass = 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Timers;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.Throw;
|
||||
@@ -79,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
|| _slipped.Contains(collidedWith.Uid)
|
||||
|| !collidedWith.TryGetComponent(out StunnableComponent stun)
|
||||
|| !collidedWith.TryGetComponent(out ICollidableComponent otherBody)
|
||||
|| !collidedWith.TryGetComponent(out PhysicsComponent otherPhysics)
|
||||
|| !collidedWith.TryGetComponent(out IPhysicsComponent otherPhysics)
|
||||
|| !Owner.TryGetComponent(out ICollidableComponent body))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user