Remove IPhysBody (#13297)

This commit is contained in:
metalgearsloth
2023-01-03 17:45:18 +11:00
committed by GitHub
parent 99eab08b6d
commit ab07944af8
18 changed files with 36 additions and 26 deletions

View File

@@ -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?

View File

@@ -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;
}

View File

@@ -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()))

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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"));

View File

@@ -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;

View File

@@ -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;
}