Refactor UpdateKinematics() and fix a lot of Content warnings (#1709)

Most warnings were related to EntityQuery and IPhysicsComponent.
Partially fixes #1650 and fixes #1682
This commit is contained in:
Vince
2020-08-16 05:38:35 +02:00
committed by GitHub
parent 8503ab157a
commit b647ad0f42
29 changed files with 65 additions and 151 deletions

View File

@@ -51,7 +51,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
}
[Serializable, NetSerializable]
public enum State
public enum PressureState
{
Ready,
Pressurizing

View File

@@ -142,11 +142,11 @@ namespace Content.Shared.GameObjects.Components.Movement
/// <inheritdoc />
public override void OnAdd()
{
// This component requires that the entity has a PhysicsComponent.
if (!Owner.HasComponent<IPhysicsComponent>())
// This component requires that the entity has a CollidableComponent.
if (!Owner.HasComponent<ICollidableComponent>())
Logger.Error(
$"[ECS] {Owner.Prototype?.Name} - {nameof(SharedPlayerInputMoverComponent)} requires" +
$" {nameof(IPhysicsComponent)}. ");
$" {nameof(ICollidableComponent)}. ");
base.OnAdd();
}

View File

@@ -50,13 +50,12 @@ namespace Content.Shared.GameObjects.Components.Movement
|| _slipped.Contains(entity.Uid)
|| !entity.TryGetComponent(out SharedStunnableComponent stun)
|| !entity.TryGetComponent(out ICollidableComponent otherBody)
|| !entity.TryGetComponent(out IPhysicsComponent otherPhysics)
|| !Owner.TryGetComponent(out ICollidableComponent body))
{
return false;
}
if (otherPhysics.LinearVelocity.Length < RequiredSlipSpeed || stun.KnockedDown)
if (otherBody.LinearVelocity.Length < RequiredSlipSpeed || stun.KnockedDown)
{
return false;
}