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

@@ -56,8 +56,8 @@ namespace Content.Server.GameObjects.Components.Disposal
return false;
}
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
!collidable.CanCollide)
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
!physics.CanCollide)
{
return false;
}
@@ -73,9 +73,9 @@ namespace Content.Server.GameObjects.Components.Disposal
return false;
}
if (entity.TryGetComponent(out ICollidableComponent? collidable))
if (entity.TryGetComponent(out IPhysicsComponent? physics))
{
collidable.CanCollide = false;
physics.CanCollide = false;
}
return true;
@@ -105,9 +105,9 @@ namespace Content.Server.GameObjects.Components.Disposal
foreach (var entity in _contents.ContainedEntities.ToArray())
{
if (entity.TryGetComponent(out ICollidableComponent? collidable))
if (entity.TryGetComponent(out IPhysicsComponent? physics))
{
collidable.CanCollide = true;
physics.CanCollide = true;
}
_contents.ForceRemove(entity);

View File

@@ -34,8 +34,8 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables]
public bool Anchored =>
!Owner.TryGetComponent(out ICollidableComponent? collidable) ||
collidable.Anchored;
!Owner.TryGetComponent(out IPhysicsComponent? physics) ||
physics.Anchored;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);

View File

@@ -31,8 +31,8 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables]
public bool Anchored =>
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
collidable.Anchored;
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
physics.Anchored;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);

View File

@@ -43,8 +43,8 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables]
private bool Anchored =>
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
collidable.Anchored;
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
physics.Anchored;
/// <summary>
/// The directions that this tube can connect to others from
@@ -192,12 +192,12 @@ namespace Content.Server.GameObjects.Components.Disposal
private void AnchoredChanged()
{
if (!Owner.TryGetComponent(out CollidableComponent? collidable))
if (!Owner.TryGetComponent(out PhysicsComponent? physics))
{
return;
}
if (collidable.Anchored)
if (physics.Anchored)
{
OnAnchor();
}
@@ -232,16 +232,16 @@ namespace Content.Server.GameObjects.Components.Disposal
Contents = ContainerManagerComponent.Ensure<Container>(Name, Owner);
Owner.EnsureComponent<AnchorableComponent>();
var collidable = Owner.EnsureComponent<CollidableComponent>();
var physics = Owner.EnsureComponent<PhysicsComponent>();
collidable.AnchoredChanged += AnchoredChanged;
physics.AnchoredChanged += AnchoredChanged;
}
protected override void Startup()
{
base.Startup();
if (!Owner.EnsureComponent<CollidableComponent>().Anchored)
if (!Owner.EnsureComponent<PhysicsComponent>().Anchored)
{
return;
}
@@ -254,8 +254,8 @@ namespace Content.Server.GameObjects.Components.Disposal
{
base.OnRemove();
var collidable = Owner.EnsureComponent<CollidableComponent>();
collidable.AnchoredChanged -= AnchoredChanged;
var physics = Owner.EnsureComponent<PhysicsComponent>();
physics.AnchoredChanged -= AnchoredChanged;
Disconnect();
}

View File

@@ -136,8 +136,8 @@ namespace Content.Server.GameObjects.Components.Disposal
return false;
}
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
!collidable.CanCollide)
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
!physics.CanCollide)
{
return false;
}
@@ -409,7 +409,7 @@ namespace Content.Server.GameObjects.Components.Disposal
{
return;
}
if (!Anchored)
{
appearance.SetData(Visuals.VisualState, VisualState.UnAnchored);
@@ -549,9 +549,9 @@ namespace Content.Server.GameObjects.Components.Disposal
Logger.WarningS("VitalComponentMissing", $"Disposal unit {Owner.Uid} is missing an anchorable component");
}
if (Owner.TryGetComponent(out CollidableComponent? collidable))
if (Owner.TryGetComponent(out IPhysicsComponent? physics))
{
collidable.AnchoredChanged += UpdateVisualState;
physics.AnchoredChanged += UpdateVisualState;
}
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
@@ -564,9 +564,9 @@ namespace Content.Server.GameObjects.Components.Disposal
public override void OnRemove()
{
if (Owner.TryGetComponent(out ICollidableComponent? collidable))
if (Owner.TryGetComponent(out IPhysicsComponent? physics))
{
collidable.AnchoredChanged -= UpdateVisualState;
physics.AnchoredChanged -= UpdateVisualState;
}
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
@@ -608,7 +608,7 @@ namespace Content.Server.GameObjects.Components.Disposal
break;
}
}
bool IsValidInteraction(ITargetedInteractEventArgs eventArgs)
{
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
@@ -640,8 +640,8 @@ namespace Content.Server.GameObjects.Components.Disposal
{
return false;
}
// Duplicated code here, not sure how else to get actor inside to make UserInterface happy.
// Duplicated code here, not sure how else to get actor inside to make UserInterface happy.
if (IsValidInteraction(eventArgs))
{
UserInterface?.Open(actor.playerSession);
@@ -682,11 +682,11 @@ namespace Content.Server.GameObjects.Components.Disposal
_ = TryInsert(eventArgs.Dropped, eventArgs.User);
return true;
}
void IThrowCollide.HitBy(ThrowCollideEventArgs eventArgs)
{
if (!CanInsert(eventArgs.Thrown) ||
IoCManager.Resolve<IRobustRandom>().NextDouble() > 0.75 ||
if (!CanInsert(eventArgs.Thrown) ||
IoCManager.Resolve<IRobustRandom>().NextDouble() > 0.75 ||
!_container.Insert(eventArgs.Thrown))
{
return;