Remove IPhysBody (#13297)
This commit is contained in:
@@ -9,6 +9,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Client.Suspicion
|
||||
{
|
||||
@@ -52,7 +53,7 @@ namespace Content.Client.Suspicion
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_entityManager.TryGetComponent(ally, out IPhysBody? physics))
|
||||
if (!_entityManager.TryGetComponent(ally, out PhysicsComponent? physics))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Doors
|
||||
{
|
||||
@@ -114,7 +115,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
IPhysBody physBody = null;
|
||||
PhysicsComponent physBody = null;
|
||||
EntityUid physicsDummy = default;
|
||||
EntityUid airlock = default;
|
||||
DoorComponent doorComponent = null;
|
||||
@@ -145,7 +146,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
for (var i = 0; i < 240; i += 10)
|
||||
{
|
||||
// Keep the airlock awake so they collide
|
||||
await server.WaitPost(() => entityManager.GetComponent<IPhysBody>(airlock).WakeBody());
|
||||
await server.WaitPost(() => entityManager.GetComponent<PhysicsComponent>(airlock).WakeBody());
|
||||
|
||||
await server.WaitRunTicks(10);
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
// // Now let's make the player enter a climbing transitioning state.
|
||||
// climbing.IsClimbing = true;
|
||||
// EntitySystem.Get<ClimbSystem>().MoveEntityToward(human, table, climbing:climbing);
|
||||
// var body = entityManager.GetComponent<IPhysBody>(human);
|
||||
// var body = entityManager.GetComponent<PhysicsComponent>(human);
|
||||
// // TODO: Check it's climbing
|
||||
//
|
||||
// // Force the player out of climb state. It should immediately remove the ClimbController.
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Maps;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Abilities.Mime
|
||||
@@ -74,7 +75,7 @@ namespace Content.Server.Abilities.Mime
|
||||
// Check there are no walls or mobs there
|
||||
foreach (var entity in coords.GetEntitiesInTile())
|
||||
{
|
||||
IPhysBody? physics = null; // We use this to check if it's impassable
|
||||
PhysicsComponent? physics = null; // We use this to check if it's impassable
|
||||
if ((HasComp<MobStateComponent>(entity) && entity != uid) || // Is it a mob?
|
||||
((Resolve(entity, ref physics, false) && (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) // Is it impassable?
|
||||
&& !(TryComp<DoorComponent>(entity, out var door) && door.State != DoorState.Closed))) // Is it a door that's open and so not actually impassable?
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
@@ -121,7 +122,7 @@ namespace Content.Server.Administration.Commands
|
||||
var xform = entMan.GetComponent<TransformComponent>(playerEntity);
|
||||
xform.Coordinates = coords;
|
||||
xform.AttachToGridOrMap();
|
||||
if (entMan.TryGetComponent(playerEntity, out IPhysBody? physics))
|
||||
if (entMan.TryGetComponent(playerEntity, out PhysicsComponent? physics))
|
||||
{
|
||||
physics.LinearVelocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
_timer -= UpdateTime;
|
||||
|
||||
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
|
||||
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, IPhysBody, TransformComponent>())
|
||||
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, PhysicsComponent, TransformComponent>())
|
||||
{
|
||||
var uid = flammable.Owner;
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherPhysics = EntityManager.GetComponent<IPhysBody>(uid);
|
||||
var otherPhysics = EntityManager.GetComponent<PhysicsComponent>(uid);
|
||||
|
||||
// TODO: Sloth, please save our souls!
|
||||
if (!physics.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB()))
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Player;
|
||||
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
||||
|
||||
@@ -23,7 +24,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!_entMan.TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Body.Components;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Disposal.Unit.Components
|
||||
{
|
||||
@@ -82,7 +83,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_entMan.TryGetComponent(entity, out IPhysBody? physics))
|
||||
if (_entMan.TryGetComponent(entity, out PhysicsComponent? physics))
|
||||
{
|
||||
physics.CanCollide = false;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Rotatable;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Rotatable
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.Rotatable
|
||||
|
||||
// Check if the object is anchored, and whether we are still allowed to rotate it.
|
||||
if (!component.RotateWhileAnchored &&
|
||||
EntityManager.TryGetComponent(component.Owner, out IPhysBody? physics) &&
|
||||
EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physics) &&
|
||||
physics.BodyType == BodyType.Static)
|
||||
return;
|
||||
|
||||
@@ -82,7 +83,7 @@ namespace Content.Server.Rotatable
|
||||
/// </summary>
|
||||
public void TryFlip(FlippableComponent component, EntityUid user)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(component.Owner, out IPhysBody? physics) &&
|
||||
if (EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physics) &&
|
||||
physics.BodyType == BodyType.Static)
|
||||
{
|
||||
component.Owner.PopupMessage(user, Loc.GetString("flippable-component-try-flip-is-stuck"));
|
||||
|
||||
@@ -18,6 +18,7 @@ using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Storage.EntitySystems;
|
||||
@@ -320,7 +321,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
if (toAdd == container)
|
||||
return false;
|
||||
|
||||
if (TryComp<IPhysBody>(toAdd, out var phys))
|
||||
if (TryComp<PhysicsComponent>(toAdd, out var phys))
|
||||
{
|
||||
if (component.MaxSize < phys.GetWorldAABB().Size.X || component.MaxSize < phys.GetWorldAABB().Size.Y)
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Temperature.Components
|
||||
{
|
||||
@@ -51,7 +52,7 @@ namespace Content.Server.Temperature.Components
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<IPhysBody?>(Owner, out var physics) && physics.FixturesMass != 0)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(Owner, out var physics) && physics.FixturesMass != 0)
|
||||
{
|
||||
return SpecificHeat * physics.FixturesMass;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace Content.Shared.Movement.Systems
|
||||
/// <summary>
|
||||
/// Used for weightlessness to determine if we are near a wall.
|
||||
/// </summary>
|
||||
private bool IsAroundCollider(SharedPhysicsSystem broadPhaseSystem, TransformComponent transform, MobMoverComponent mover, IPhysBody collider)
|
||||
private bool IsAroundCollider(SharedPhysicsSystem broadPhaseSystem, TransformComponent transform, MobMoverComponent mover, PhysicsComponent collider)
|
||||
{
|
||||
var enlargedAABB = collider.GetWorldAABB().Enlarged(mover.GrabRangeVV);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared.Physics.Pull
|
||||
{
|
||||
public sealed class PullAttemptEvent : PullMessage
|
||||
{
|
||||
public PullAttemptEvent(IPhysBody puller, IPhysBody pulled) : base(puller, pulled) { }
|
||||
public PullAttemptEvent(PhysicsComponent puller, PhysicsComponent pulled) : base(puller, pulled) { }
|
||||
|
||||
public bool Cancelled { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared.Physics.Pull
|
||||
{
|
||||
public abstract class PullMessage : EntityEventArgs
|
||||
{
|
||||
public readonly IPhysBody Puller;
|
||||
public readonly IPhysBody Pulled;
|
||||
public readonly PhysicsComponent Puller;
|
||||
public readonly PhysicsComponent Pulled;
|
||||
|
||||
protected PullMessage(IPhysBody puller, IPhysBody pulled)
|
||||
protected PullMessage(PhysicsComponent puller, PhysicsComponent pulled)
|
||||
{
|
||||
Puller = puller;
|
||||
Pulled = pulled;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared.Physics.Pull
|
||||
{
|
||||
public sealed class PullStartedMessage : PullMessage
|
||||
{
|
||||
public PullStartedMessage(IPhysBody puller, IPhysBody pulled) :
|
||||
public PullStartedMessage(PhysicsComponent puller, PhysicsComponent pulled) :
|
||||
base(puller, pulled)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared.Physics.Pull
|
||||
{
|
||||
public sealed class PullStoppedMessage : PullMessage
|
||||
{
|
||||
public PullStoppedMessage(IPhysBody puller, IPhysBody pulled) : base(puller, pulled)
|
||||
public PullStoppedMessage(PhysicsComponent puller, PhysicsComponent pulled) : base(puller, pulled)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Shared.Pulling
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent<IPhysBody>(pulled, out var physics))
|
||||
if (!EntityManager.TryGetComponent<PhysicsComponent>(pulled, out var physics))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Content.Shared.Throwing
|
||||
/// <summary>
|
||||
/// Raises collision events on the thrown and target entities.
|
||||
/// </summary>
|
||||
public void ThrowCollideInteraction(EntityUid? user, IPhysBody thrown, IPhysBody target)
|
||||
public void ThrowCollideInteraction(EntityUid? user, PhysicsComponent thrown, PhysicsComponent target)
|
||||
{
|
||||
if (user is not null)
|
||||
_adminLogger.Add(LogType.ThrowHit, LogImpact.Low,
|
||||
|
||||
Reference in New Issue
Block a user