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:
DrSmugleaf
2020-10-11 16:36:58 +02:00
committed by GitHub
parent 413ca9812d
commit b64cb24059
79 changed files with 292 additions and 268 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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