Rename usages of collidable to physics (#2230)
* Rename usages of collidable to physics * high tier PANIQUE * aaaaaaaaAAAAAa * cursed commit dont research * Fix urist and items being anchored * Fix the rest
This commit is contained in:
@@ -20,8 +20,8 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
||||
collidable.Anchored;
|
||||
!Owner.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||
physics.Anchored;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum Visuals
|
||||
@@ -104,7 +104,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
for (var i = _intersecting.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var entity = _intersecting[i];
|
||||
|
||||
|
||||
if (!Owner.EntityManager.IsIntersecting(entity, Owner))
|
||||
_intersecting.RemoveAt(i);
|
||||
}
|
||||
@@ -133,10 +133,10 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return UnitName == other.UnitName &&
|
||||
UnitState == other.UnitState &&
|
||||
Powered == other.Powered &&
|
||||
Engaged == other.Engaged &&
|
||||
return UnitName == other.UnitName &&
|
||||
UnitState == other.UnitState &&
|
||||
Powered == other.Powered &&
|
||||
Engaged == other.Engaged &&
|
||||
Pressure.Equals(other.Pressure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Items
|
||||
public sealed override uint? NetID => ContentNetIDs.HANDS;
|
||||
|
||||
[ViewVariables]
|
||||
public ICollidableComponent? PulledObject { get; protected set; }
|
||||
public IPhysicsComponent? PulledObject { get; protected set; }
|
||||
|
||||
[ViewVariables]
|
||||
protected bool IsPulling => PulledObject != null;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
public sealed override string Name => "Climbing";
|
||||
public sealed override uint? NetID => ContentNetIDs.CLIMBING;
|
||||
|
||||
protected ICollidableComponent Body;
|
||||
protected IPhysicsComponent Body;
|
||||
protected bool IsOnClimbableThisFrame = false;
|
||||
|
||||
protected bool OwnerIsTransitioning
|
||||
|
||||
@@ -144,11 +144,11 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
/// <inheritdoc />
|
||||
public override void OnAdd()
|
||||
{
|
||||
// This component requires that the entity has a CollidableComponent.
|
||||
if (!Owner.HasComponent<ICollidableComponent>())
|
||||
// This component requires that the entity has a IPhysicsComponent.
|
||||
if (!Owner.HasComponent<IPhysicsComponent>())
|
||||
Logger.Error(
|
||||
$"[ECS] {Owner.Prototype?.Name} - {nameof(SharedPlayerInputMoverComponent)} requires" +
|
||||
$" {nameof(ICollidableComponent)}. ");
|
||||
$" {nameof(IPhysicsComponent)}. ");
|
||||
|
||||
base.OnAdd();
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
|| ContainerHelpers.IsInContainer(Owner)
|
||||
|| _slipped.Contains(entity.Uid)
|
||||
|| !entity.TryGetComponent(out SharedStunnableComponent stun)
|
||||
|| !entity.TryGetComponent(out ICollidableComponent otherBody)
|
||||
|| !Owner.TryGetComponent(out ICollidableComponent body))
|
||||
|| !entity.TryGetComponent(out IPhysicsComponent otherBody)
|
||||
|| !Owner.TryGetComponent(out IPhysicsComponent body))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -85,10 +85,10 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity.TryGetComponent(out ICollidableComponent collidable))
|
||||
if (entity.TryGetComponent(out IPhysicsComponent physics))
|
||||
{
|
||||
var controller = collidable.EnsureController<SlipController>();
|
||||
controller.LinearVelocity = collidable.LinearVelocity * LaunchForwardsMultiplier;
|
||||
var controller = physics.EnsureController<SlipController>();
|
||||
controller.LinearVelocity = physics.LinearVelocity * LaunchForwardsMultiplier;
|
||||
}
|
||||
|
||||
stun.Paralyze(5);
|
||||
@@ -117,10 +117,10 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
}
|
||||
|
||||
var entity = _entityManager.GetEntity(uid);
|
||||
var collidable = Owner.GetComponent<ICollidableComponent>();
|
||||
var otherCollidable = entity.GetComponent<ICollidableComponent>();
|
||||
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||
|
||||
if (!collidable.WorldAABB.Intersects(otherCollidable.WorldAABB))
|
||||
if (!physics.WorldAABB.Intersects(otherPhysics.WorldAABB))
|
||||
{
|
||||
_slipped.Remove(uid);
|
||||
}
|
||||
@@ -131,11 +131,11 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
||||
var physics = Owner.EnsureComponent<PhysicsComponent>();
|
||||
|
||||
collidable.Hard = false;
|
||||
physics.Hard = false;
|
||||
|
||||
var shape = collidable.PhysicsShapes.FirstOrDefault();
|
||||
var shape = physics.PhysicsShapes.FirstOrDefault();
|
||||
|
||||
if (shape != null)
|
||||
{
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.Portal
|
||||
{
|
||||
base.OnAdd();
|
||||
|
||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
||||
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||
{
|
||||
collidable.Hard = false;
|
||||
physics.Hard = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
|
||||
|
||||
public GameTick LastUpdate { get; private set; }
|
||||
|
||||
public GasOverlayChunk(GridId gridIndices, Vector2i Vector2i)
|
||||
public GasOverlayChunk(GridId gridIndices, Vector2i vector2i)
|
||||
{
|
||||
GridIndices = gridIndices;
|
||||
Vector2i = Vector2i;
|
||||
Vector2i = vector2i;
|
||||
}
|
||||
|
||||
public void Dirty(GameTick currentTick)
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
base.Shutdown();
|
||||
}
|
||||
|
||||
protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, ICollidableComponent collidable)
|
||||
protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, IPhysicsComponent physics)
|
||||
{
|
||||
collidable.EnsureController<MoverController>();
|
||||
physics.EnsureController<MoverController>();
|
||||
|
||||
var weightless = !transform.Owner.HasComponent<MovementIgnoreGravityComponent>() &&
|
||||
_physicsManager.IsWeightless(transform.Coordinates);
|
||||
@@ -62,7 +62,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
if (weightless)
|
||||
{
|
||||
// No gravity: is our entity touching anything?
|
||||
var touching = IsAroundCollider(transform, mover, collidable);
|
||||
var touching = IsAroundCollider(transform, mover, physics);
|
||||
|
||||
if (!touching)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
var combined = walkDir + sprintDir;
|
||||
if (combined.LengthSquared < 0.001 || !ActionBlockerSystem.CanMove(mover.Owner) && !weightless)
|
||||
{
|
||||
if (collidable.TryGetController(out MoverController controller))
|
||||
if (physics.TryGetController(out MoverController controller))
|
||||
{
|
||||
controller.StopMoving();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
{
|
||||
if (weightless)
|
||||
{
|
||||
if (collidable.TryGetController(out MoverController controller))
|
||||
if (physics.TryGetController(out MoverController controller))
|
||||
{
|
||||
controller.Push(combined, mover.CurrentPushSpeed);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
var total = walkDir * mover.CurrentWalkSpeed + sprintDir * mover.CurrentSprintSpeed;
|
||||
|
||||
{
|
||||
if (collidable.TryGetController(out MoverController controller))
|
||||
if (physics.TryGetController(out MoverController controller))
|
||||
{
|
||||
controller.Move(total, 1);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
}
|
||||
|
||||
private bool IsAroundCollider(ITransformComponent transform, IMoverComponent mover,
|
||||
ICollidableComponent collider)
|
||||
IPhysicsComponent collider)
|
||||
{
|
||||
foreach (var entity in _entityManager.GetEntitiesInRange(transform.Owner, mover.GrabRange, true))
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
continue; // Don't try to push off of yourself!
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent<ICollidableComponent>(out var otherCollider))
|
||||
if (!entity.TryGetComponent<IPhysicsComponent>(out var otherCollider))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user