diff --git a/Content.Client/GameObjects/Components/Mobs/State/DeadState.cs b/Content.Client/GameObjects/Components/Mobs/State/DeadState.cs index 9ab07be1ac..f9395b87e5 100644 --- a/Content.Client/GameObjects/Components/Mobs/State/DeadState.cs +++ b/Content.Client/GameObjects/Components/Mobs/State/DeadState.cs @@ -20,9 +20,9 @@ namespace Content.Client.GameObjects.Components.Mobs.State EntitySystem.Get().Down(entity); - if (entity.TryGetComponent(out CollidableComponent collidable)) + if (entity.TryGetComponent(out PhysicsComponent physics)) { - collidable.CanCollide = false; + physics.CanCollide = false; } } @@ -30,9 +30,9 @@ namespace Content.Client.GameObjects.Components.Mobs.State { EntitySystem.Get().Standing(entity); - if (entity.TryGetComponent(out CollidableComponent collidable)) + if (entity.TryGetComponent(out PhysicsComponent physics)) { - collidable.CanCollide = true; + physics.CanCollide = true; } } diff --git a/Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs b/Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs index 3ada7a1fff..1db501ba73 100644 --- a/Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs +++ b/Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs @@ -73,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Suspicion return; } - if (!ally.TryGetComponent(out ICollidableComponent collidable)) + if (!ally.TryGetComponent(out IPhysicsComponent physics)) { return; } @@ -85,7 +85,7 @@ namespace Content.Client.GameObjects.Components.Suspicion } // all entities have a TransformComponent - var transform = collidable.Entity.Transform; + var transform = physics.Entity.Transform; // if not on the same map, continue if (transform.MapID != _eyeManager.CurrentMap || !transform.IsMapTransform) @@ -93,7 +93,7 @@ namespace Content.Client.GameObjects.Components.Suspicion continue; } - var worldBox = collidable.WorldAABB; + var worldBox = physics.WorldAABB; // if not on screen, or too small, continue if (!worldBox.Intersects(in viewport) || worldBox.IsEmpty()) @@ -101,7 +101,7 @@ namespace Content.Client.GameObjects.Components.Suspicion continue; } - var screenCoordinates = _eyeManager.WorldToScreen(collidable.WorldAABB.TopLeft + (0, 0.5f)); + var screenCoordinates = _eyeManager.WorldToScreen(physics.WorldAABB.TopLeft + (0, 0.5f)); DrawString(screen, _font, screenCoordinates, _traitorText, Color.OrangeRed); } } diff --git a/Content.Client/GameObjects/EntitySystems/MoverSystem.cs b/Content.Client/GameObjects/EntitySystems/MoverSystem.cs index db3ad9fc33..08fb4725ef 100644 --- a/Content.Client/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MoverSystem.cs @@ -30,10 +30,10 @@ namespace Content.Client.GameObjects.EntitySystems return; } - var collidable = playerEnt.GetComponent(); - collidable.Predict = true; + var physics = playerEnt.GetComponent(); + physics.Predict = true; - UpdateKinematics(playerEnt.Transform, mover, collidable); + UpdateKinematics(playerEnt.Transform, mover, physics); } public override void Update(float frameTime) diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 5785cc2499..28d03845ee 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -101,9 +101,9 @@ namespace Content.IntegrationTests.Tests.Doors airlock = entityManager.SpawnEntity("Airlock", new MapCoordinates((0, 0), mapId)); - Assert.True(human.TryGetComponent(out ICollidableComponent collidable)); + Assert.True(human.TryGetComponent(out IPhysicsComponent physics)); - controller = collidable.EnsureController(); + controller = physics.EnsureController(); Assert.True(airlock.TryGetComponent(out airlockComponent)); Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed)); @@ -117,7 +117,7 @@ namespace Content.IntegrationTests.Tests.Doors for (var i = 0; i < 240; i += 10) { // Keep the airlock awake so they collide - airlock.GetComponent().WakeBody(); + airlock.GetComponent().WakeBody(); // Ensure that it is still closed Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed)); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 63d8164791..fd2b05ecc4 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); - var body = human.GetComponent(); + var body = human.GetComponent(); Assert.That(body.HasController(), "Player has no ClimbController", Is.True); diff --git a/Content.Server/Administration/WarpCommand.cs b/Content.Server/Administration/WarpCommand.cs index d42716163f..45fb041a40 100644 --- a/Content.Server/Administration/WarpCommand.cs +++ b/Content.Server/Administration/WarpCommand.cs @@ -112,9 +112,9 @@ namespace Content.Server.Administration if (found.GetGridId(entityManager) != GridId.Invalid) { player.AttachedEntity.Transform.Coordinates = found; - if (player.AttachedEntity.TryGetComponent(out ICollidableComponent collidable)) + if (player.AttachedEntity.TryGetComponent(out IPhysicsComponent physics)) { - collidable.Stop(); + physics.Stop(); } } else diff --git a/Content.Server/Atmos/HighPressureMovementController.cs b/Content.Server/Atmos/HighPressureMovementController.cs index 8a9eb2af83..4b494495e5 100644 --- a/Content.Server/Atmos/HighPressureMovementController.cs +++ b/Content.Server/Atmos/HighPressureMovementController.cs @@ -17,7 +17,7 @@ namespace Content.Server.Atmos { [Dependency] private IRobustRandom _robustRandom = default!; [Dependency] private IPhysicsManager _physicsManager = default!; - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } private const float MoveForcePushRatio = 1f; private const float MoveForceForcePushRatio = 1f; diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index 2263164075..70d41b37fc 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -202,7 +202,7 @@ namespace Content.Server.Atmos foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices)) { - if (!entity.TryGetComponent(out ICollidableComponent physics) + if (!entity.TryGetComponent(out IPhysicsComponent physics) || !entity.TryGetComponent(out MovedByPressureComponent pressure) || ContainerHelpers.IsInContainer(entity)) continue; diff --git a/Content.Server/Construction/Completions/SetAnchor.cs b/Content.Server/Construction/Completions/SetAnchor.cs index b9bc397837..49b3aadb49 100644 --- a/Content.Server/Construction/Completions/SetAnchor.cs +++ b/Content.Server/Construction/Completions/SetAnchor.cs @@ -20,9 +20,9 @@ namespace Content.Server.Construction.Completions public async Task PerformAction(IEntity entity, IEntity? user) { - if (!entity.TryGetComponent(out CollidableComponent? collidable)) return; + if (!entity.TryGetComponent(out IPhysicsComponent? physics)) return; - collidable.Anchored = Value; + physics.Anchored = Value; } } } diff --git a/Content.Server/Construction/Conditions/EntityAnchored.cs b/Content.Server/Construction/Conditions/EntityAnchored.cs index 67ed5643cd..90306c0f4c 100644 --- a/Content.Server/Construction/Conditions/EntityAnchored.cs +++ b/Content.Server/Construction/Conditions/EntityAnchored.cs @@ -20,19 +20,19 @@ namespace Content.Server.Construction.Conditions public async Task Condition(IEntity entity) { - if (!entity.TryGetComponent(out ICollidableComponent collidable)) return false; + if (!entity.TryGetComponent(out IPhysicsComponent physics)) return false; - return collidable.Anchored == Anchored; + return physics.Anchored == Anchored; } public void DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange) { - if (!entity.TryGetComponent(out ICollidableComponent collidable)) return; + if (!entity.TryGetComponent(out IPhysicsComponent physics)) return; - if(Anchored && !collidable.Anchored) + if(Anchored && !physics.Anchored) message.AddMarkup("First, anchor it.\n"); - if(!Anchored && collidable.Anchored) + if(!Anchored && physics.Anchored) message.AddMarkup("First, unanchor it.\n"); } } diff --git a/Content.Server/GameObjects/Components/AnchorableComponent.cs b/Content.Server/GameObjects/Components/AnchorableComponent.cs index e5efe4e656..c98cc33516 100644 --- a/Content.Server/GameObjects/Components/AnchorableComponent.cs +++ b/Content.Server/GameObjects/Components/AnchorableComponent.cs @@ -38,7 +38,7 @@ namespace Content.Server.GameObjects.Components /// true if it is valid, false otherwise private async Task Valid(IEntity user, IEntity? utilizing, [MaybeNullWhen(false)] bool force = false) { - if (!Owner.HasComponent()) + if (!Owner.HasComponent()) { return false; } @@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.Components return false; } - var physics = Owner.GetComponent(); + var physics = Owner.GetComponent(); physics.Anchored = true; return true; @@ -90,7 +90,7 @@ namespace Content.Server.GameObjects.Components return false; } - var physics = Owner.GetComponent(); + var physics = Owner.GetComponent(); physics.Anchored = false; return true; @@ -105,12 +105,12 @@ namespace Content.Server.GameObjects.Components /// true if toggled, false otherwise private async Task TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false) { - if (!Owner.TryGetComponent(out ICollidableComponent? collidable)) + if (!Owner.TryGetComponent(out IPhysicsComponent? physics)) { return false; } - return collidable.Anchored ? + return physics.Anchored ? await TryUnAnchor(user, utilizing, force) : await TryAnchor(user, utilizing, force); } @@ -118,7 +118,7 @@ namespace Content.Server.GameObjects.Components public override void Initialize() { base.Initialize(); - Owner.EnsureComponent(); + Owner.EnsureComponent(); } async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) diff --git a/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs b/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs index fa560075c2..b6aae7d8db 100644 --- a/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs @@ -39,9 +39,9 @@ namespace Content.Server.GameObjects.Components.Atmos airtightComponent.AirBlocked = false; } - if (Owner.TryGetComponent(out ICollidableComponent collidableComponent)) + if (Owner.TryGetComponent(out IPhysicsComponent physics)) { - collidableComponent.Hard = false; + physics.Hard = false; } AutoClose = false; diff --git a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs index 1d9d486bfb..ae7be6c29b 100644 --- a/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/FlammableComponent.cs @@ -142,10 +142,10 @@ namespace Content.Server.GameObjects.Components.Atmos } var entity = _entityManager.GetEntity(uid); - var collidable = Owner.GetComponent(); - var otherCollidable = entity.GetComponent(); + var physics = Owner.GetComponent(); + var otherPhysics = entity.GetComponent(); - if (!collidable.WorldAABB.Intersects(otherCollidable.WorldAABB)) + if (!physics.WorldAABB.Intersects(otherPhysics.WorldAABB)) { _collided.Remove(uid); } diff --git a/Content.Server/GameObjects/Components/Atmos/GasCanisterComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasCanisterComponent.cs index bc35419ac1..bb874d5b33 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasCanisterComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasCanisterComponent.cs @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Atmos public GasMixture Air { get; set; } [ViewVariables] - public bool Anchored => !Owner.TryGetComponent(out var collidable) || collidable.Anchored; + public bool Anchored => !Owner.TryGetComponent(out var physics) || physics.Anchored; [ViewVariables] public GasCanisterPortComponent ConnectedPort { get; private set; } @@ -39,19 +39,19 @@ namespace Content.Server.GameObjects.Components.Atmos public override void Initialize() { base.Initialize(); - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { AnchorUpdate(); - collidable.AnchoredChanged += AnchorUpdate; + physics.AnchoredChanged += AnchorUpdate; } } public override void OnRemove() { base.OnRemove(); - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { - collidable.AnchoredChanged -= AnchorUpdate; + physics.AnchoredChanged -= AnchorUpdate; } DisconnectFromPort(); } diff --git a/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs b/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs index ad7fd591ae..0b2e945f2e 100644 --- a/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/VaporComponent.cs @@ -58,9 +58,9 @@ namespace Content.Server.GameObjects.Components.Chemistry _velocity = velocity; _aliveTime = aliveTime; // Set Move - if (Owner.TryGetComponent(out ICollidableComponent collidable)) + if (Owner.TryGetComponent(out IPhysicsComponent physics)) { - var controller = collidable.EnsureController(); + var controller = physics.EnsureController(); controller.Move(_direction, _velocity); } } @@ -82,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Chemistry _timer += frameTime; _reactTimer += frameTime; - if (_reactTimer >= ReactTime && Owner.TryGetComponent(out ICollidableComponent collidable)) + if (_reactTimer >= ReactTime && Owner.TryGetComponent(out IPhysicsComponent physics)) { _reactTimer = 0; var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID); @@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Chemistry { _reached = true; - if (Owner.TryGetComponent(out ICollidableComponent coll)) + if (Owner.TryGetComponent(out IPhysicsComponent coll)) { var controller = coll.EnsureController(); controller.Stop(); @@ -150,11 +150,11 @@ namespace Content.Server.GameObjects.Components.Chemistry } // Check for collision with a impassable object (e.g. wall) and stop - if (collidedWith.TryGetComponent(out ICollidableComponent collidable)) + if (collidedWith.TryGetComponent(out IPhysicsComponent physics)) { - if ((collidable.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && collidable.Hard) + if ((physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && physics.Hard) { - if (Owner.TryGetComponent(out ICollidableComponent coll)) + if (Owner.TryGetComponent(out IPhysicsComponent coll)) { var controller = coll.EnsureController(); controller.Stop(); diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index ee8bde1a77..2cefa24394 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -422,10 +422,10 @@ namespace Content.Server.GameObjects.Components.Construction } } - if (Owner.TryGetComponent(out CollidableComponent? collidable) && - entity.TryGetComponent(out CollidableComponent? otherCollidable)) + if (Owner.TryGetComponent(out IPhysicsComponent? physics) && + entity.TryGetComponent(out IPhysicsComponent? otherPhysics)) { - otherCollidable.Anchored = collidable.Anchored; + otherPhysics.Anchored = physics.Anchored; } Owner.Delete(); diff --git a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs index a6c8c9cc66..7a9b3131f7 100644 --- a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs +++ b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs @@ -111,8 +111,8 @@ namespace Content.Server.GameObjects.Components.Conveyor return false; } - if (!entity.TryGetComponent(out ICollidableComponent? collidable) || - collidable.Anchored) + if (!entity.TryGetComponent(out IPhysicsComponent? physics) || + physics.Anchored) { return false; } @@ -152,9 +152,9 @@ namespace Content.Server.GameObjects.Components.Conveyor continue; } - if (entity.TryGetComponent(out ICollidableComponent? collidable)) + if (entity.TryGetComponent(out IPhysicsComponent? physics)) { - var controller = collidable.EnsureController(); + var controller = physics.EnsureController(); controller.Move(direction, _speed * frameTime); } } diff --git a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs index 756e417e0e..cb843a2c57 100644 --- a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs @@ -52,9 +52,9 @@ namespace Content.Server.GameObjects.Components.Damage public void CollideWith(IEntity collidedWith) { - if (!Owner.TryGetComponent(out ICollidableComponent collidable) || !Owner.TryGetComponent(out IDamageableComponent damageable)) return; + if (!Owner.TryGetComponent(out IPhysicsComponent physics) || !Owner.TryGetComponent(out IDamageableComponent damageable)) return; - var speed = collidable.LinearVelocity.Length; + var speed = physics.LinearVelocity.Length; if (speed < MinimumSpeed) return; diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs index e188366d01..621231315f 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalHolderComponent.cs @@ -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); diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs index 4e86275587..b84da4b120 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalRouterComponent.cs @@ -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); diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs index ce14df749d..1dc7c43647 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs @@ -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); diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs index eb3adc6694..03342d9db9 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs @@ -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; /// /// 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(Name, Owner); Owner.EnsureComponent(); - var collidable = Owner.EnsureComponent(); + var physics = Owner.EnsureComponent(); - collidable.AnchoredChanged += AnchoredChanged; + physics.AnchoredChanged += AnchoredChanged; } protected override void Startup() { base.Startup(); - if (!Owner.EnsureComponent().Anchored) + if (!Owner.EnsureComponent().Anchored) { return; } @@ -254,8 +254,8 @@ namespace Content.Server.GameObjects.Components.Disposal { base.OnRemove(); - var collidable = Owner.EnsureComponent(); - collidable.AnchoredChanged -= AnchoredChanged; + var physics = Owner.EnsureComponent(); + physics.AnchoredChanged -= AnchoredChanged; Disconnect(); } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index 2aecb8196c..8c967e39cb 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -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().NextDouble() > 0.75 || + if (!CanInsert(eventArgs.Thrown) || + IoCManager.Resolve().NextDouble() > 0.75 || !_container.Insert(eventArgs.Thrown)) { return; diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs index 6dbadb01f1..b68f1c75dd 100644 --- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs @@ -254,9 +254,9 @@ namespace Content.Server.GameObjects.Components.Doors airtight.AirBlocked = false; } - if (Owner.TryGetComponent(out ICollidableComponent? collidable)) + if (Owner.TryGetComponent(out IPhysicsComponent? physics)) { - collidable.Hard = false; + physics.Hard = false; } await Timer.Delay(OpenTimeTwo, _cancellationTokenSource.Token); @@ -297,7 +297,7 @@ namespace Content.Server.GameObjects.Components.Doors private void CheckCrush() { - if (!Owner.TryGetComponent(out ICollidableComponent? body)) + if (!Owner.TryGetComponent(out IPhysicsComponent? body)) return; // Crush @@ -305,7 +305,7 @@ namespace Content.Server.GameObjects.Components.Doors { if (!e.TryGetComponent(out StunnableComponent? stun) || !e.TryGetComponent(out IDamageableComponent? damage) - || !e.TryGetComponent(out ICollidableComponent? otherBody)) + || !e.TryGetComponent(out IPhysicsComponent? otherBody)) continue; var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB); @@ -377,7 +377,8 @@ namespace Content.Server.GameObjects.Components.Doors { bool shouldCheckCrush = false; - if (_canCrush && Owner.TryGetComponent(out ICollidableComponent? collidable) && collidable.IsColliding(Vector2.Zero, false)) + if (_canCrush && Owner.TryGetComponent(out IPhysicsComponent? physics) && + physics.IsColliding(Vector2.Zero, false)) { if (Safety) return false; @@ -406,7 +407,7 @@ namespace Content.Server.GameObjects.Components.Doors airtight.AirBlocked = true; } - if (Owner.TryGetComponent(out ICollidableComponent? body)) + if (Owner.TryGetComponent(out IPhysicsComponent? body)) { body.Hard = true; } diff --git a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs index a2ed029f44..8f152debec 100644 --- a/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/PuddleComponent.cs @@ -377,8 +377,8 @@ namespace Content.Server.GameObjects.Components.Fluids foreach (var entity in _snapGrid.GetInDir(direction)) { - if (entity.TryGetComponent(out ICollidableComponent collidable) && - (collidable.CollisionLayer & (int) CollisionGroup.Impassable) != 0) + if (entity.TryGetComponent(out IPhysicsComponent physics) && + (physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0) { puddle = default; return false; diff --git a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs index afe8a16664..3c7269287c 100644 --- a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs @@ -533,9 +533,9 @@ namespace Content.Server.GameObjects.Components.GUI StopPull(); } - PulledObject = pullable.Owner.GetComponent(); + PulledObject = pullable.Owner.GetComponent(); var controller = PulledObject.EnsureController(); - controller.StartPull(Owner.GetComponent()); + controller.StartPull(Owner.GetComponent()); } public void MovePulledObject(EntityCoordinates puller, EntityCoordinates to) @@ -686,13 +686,13 @@ namespace Content.Server.GameObjects.Components.GUI Dirty(); - if (!message.Entity.TryGetComponent(out ICollidableComponent? collidable)) + if (!message.Entity.TryGetComponent(out IPhysicsComponent? physics)) { return; } // set velocity to zero - collidable.Stop(); + physics.Stop(); return; } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs index 50dc1de6fa..f849c6469f 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/EntityStorageComponent.cs @@ -201,15 +201,15 @@ namespace Content.Server.GameObjects.Components.Items.Storage private void ModifyComponents() { - if (!_isCollidableWhenOpen && Owner.TryGetComponent(out var collidableComponent)) + if (!_isCollidableWhenOpen && Owner.TryGetComponent(out var physics)) { if (Open) { - collidableComponent.Hard = false; + physics.Hard = false; } else { - collidableComponent.Hard = true; + physics.Hard = true; } } @@ -226,31 +226,30 @@ namespace Content.Server.GameObjects.Components.Items.Storage private bool AddToContents(IEntity entity) { - var collidableComponent = Owner.GetComponent(); - ICollidableComponent entityCollidableComponent; - if (entity.TryGetComponent(out entityCollidableComponent)) + var physics = Owner.GetComponent(); + if (entity.TryGetComponent(out IPhysicsComponent entityPhysicsComponent)) { - if(MaxSize < entityCollidableComponent.WorldAABB.Size.X - || MaxSize < entityCollidableComponent.WorldAABB.Size.Y) + if(MaxSize < entityPhysicsComponent.WorldAABB.Size.X + || MaxSize < entityPhysicsComponent.WorldAABB.Size.Y) { return false; } - if (collidableComponent.WorldAABB.Left > entityCollidableComponent.WorldAABB.Left) + if (physics.WorldAABB.Left > entityPhysicsComponent.WorldAABB.Left) { - entity.Transform.WorldPosition += new Vector2(collidableComponent.WorldAABB.Left - entityCollidableComponent.WorldAABB.Left, 0); + entity.Transform.WorldPosition += new Vector2(physics.WorldAABB.Left - entityPhysicsComponent.WorldAABB.Left, 0); } - else if (collidableComponent.WorldAABB.Right < entityCollidableComponent.WorldAABB.Right) + else if (physics.WorldAABB.Right < entityPhysicsComponent.WorldAABB.Right) { - entity.Transform.WorldPosition += new Vector2(collidableComponent.WorldAABB.Right - entityCollidableComponent.WorldAABB.Right, 0); + entity.Transform.WorldPosition += new Vector2(physics.WorldAABB.Right - entityPhysicsComponent.WorldAABB.Right, 0); } - if (collidableComponent.WorldAABB.Bottom > entityCollidableComponent.WorldAABB.Bottom) + if (physics.WorldAABB.Bottom > entityPhysicsComponent.WorldAABB.Bottom) { - entity.Transform.WorldPosition += new Vector2(0, collidableComponent.WorldAABB.Bottom - entityCollidableComponent.WorldAABB.Bottom); + entity.Transform.WorldPosition += new Vector2(0, physics.WorldAABB.Bottom - entityPhysicsComponent.WorldAABB.Bottom); } - else if (collidableComponent.WorldAABB.Top < entityCollidableComponent.WorldAABB.Top) + else if (physics.WorldAABB.Top < entityPhysicsComponent.WorldAABB.Top) { - entity.Transform.WorldPosition += new Vector2(0, collidableComponent.WorldAABB.Top - entityCollidableComponent.WorldAABB.Top); + entity.Transform.WorldPosition += new Vector2(0, physics.WorldAABB.Top - entityPhysicsComponent.WorldAABB.Top); } } if (Contents.CanInsert(entity)) @@ -268,9 +267,9 @@ namespace Content.Server.GameObjects.Components.Items.Storage } Contents.Insert(entity); entity.Transform.WorldPosition = worldPos; - if (entityCollidableComponent != null) + if (entityPhysicsComponent != null) { - entityCollidableComponent.CanCollide = false; + entityPhysicsComponent.CanCollide = false; } return true; } @@ -283,9 +282,9 @@ namespace Content.Server.GameObjects.Components.Items.Storage { if(Contents.Remove(contained)) { - if (contained.TryGetComponent(out var entityCollidableComponent)) + if (contained.TryGetComponent(out var physics)) { - entityCollidableComponent.CanCollide = true; + physics.CanCollide = true; } } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs index a55ff54cab..75fa3cb208 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs @@ -85,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage return false; } - if (Owner.TryGetComponent(out ICollidableComponent physics) && + if (Owner.TryGetComponent(out IPhysicsComponent physics) && physics.Anchored) { return false; diff --git a/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs b/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs index 174fc68ef4..5c19d0a872 100644 --- a/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs +++ b/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs @@ -36,9 +36,9 @@ namespace Content.Server.GameObjects.Components.Mobs.State EntitySystem.Get().Down(entity); - if (entity.TryGetComponent(out CollidableComponent collidable)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - collidable.CanCollide = false; + physics.CanCollide = false; } } @@ -46,9 +46,9 @@ namespace Content.Server.GameObjects.Components.Mobs.State { EntitySystem.Get().Standing(entity); - if (entity.TryGetComponent(out CollidableComponent collidable)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - collidable.CanCollide = true; + physics.CanCollide = true; } if (entity.TryGetComponent(out ServerOverlayEffectsComponent overlay)) diff --git a/Content.Server/GameObjects/Components/Movement/AiControllerComponent.cs b/Content.Server/GameObjects/Components/Movement/AiControllerComponent.cs index a9603b64ae..9fd66b2f02 100644 --- a/Content.Server/GameObjects/Components/Movement/AiControllerComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/AiControllerComponent.cs @@ -55,8 +55,8 @@ namespace Content.Server.GameObjects.Components.Movement { base.Initialize(); - // This component requires a collidable component. - Owner.EnsureComponent(); + // This component requires a physics component. + Owner.EnsureComponent(); EntitySystem.Get().ProcessorInitialize(this); } diff --git a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs index 7af5c21450..8d719c4f55 100644 --- a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs @@ -46,9 +46,9 @@ namespace Content.Server.GameObjects.Components.Movement { base.Initialize(); - if (!Owner.EnsureComponent(out CollidableComponent _)) + if (!Owner.EnsureComponent(out PhysicsComponent _)) { - Logger.Warning($"Entity {Owner.Name} at {Owner.Transform.MapPosition} didn't have a {nameof(CollidableComponent)}"); + Logger.Warning($"Entity {Owner.Name} at {Owner.Transform.MapPosition} didn't have a {nameof(PhysicsComponent)}"); } _doAfterSystem = EntitySystem.Get(); @@ -178,7 +178,7 @@ namespace Content.Server.GameObjects.Components.Movement var result = await _doAfterSystem.DoAfter(doAfterEventArgs); - if (result != DoAfterStatus.Cancelled && entityToMove.TryGetComponent(out ICollidableComponent body) && body.PhysicsShapes.Count >= 1) + if (result != DoAfterStatus.Cancelled && entityToMove.TryGetComponent(out IPhysicsComponent body) && body.PhysicsShapes.Count >= 1) { var direction = (Owner.Transform.WorldPosition - entityToMove.Transform.WorldPosition).Normalized; var endPoint = Owner.Transform.WorldPosition; @@ -220,7 +220,7 @@ namespace Content.Server.GameObjects.Components.Movement var result = await _doAfterSystem.DoAfter(doAfterEventArgs); - if (result != DoAfterStatus.Cancelled && user.TryGetComponent(out ICollidableComponent body) && body.PhysicsShapes.Count >= 1) + if (result != DoAfterStatus.Cancelled && user.TryGetComponent(out IPhysicsComponent body) && body.PhysicsShapes.Count >= 1) { var direction = (Owner.Transform.WorldPosition - user.Transform.WorldPosition).Normalized; var endPoint = Owner.Transform.WorldPosition; diff --git a/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs b/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs index 3475896dc3..2def6aac43 100644 --- a/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ShuttleControllerComponent.cs @@ -69,15 +69,15 @@ namespace Content.Server.GameObjects.Components.Movement _entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity)) { //TODO: Switch to shuttle component - if (!gridEntity.TryGetComponent(out ICollidableComponent? collidable)) + if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics)) { - collidable = gridEntity.AddComponent(); - collidable.Mass = 1; - collidable.CanCollide = true; - collidable.PhysicsShapes.Add(new PhysShapeGrid(grid)); + physics = gridEntity.AddComponent(); + physics.Mass = 1; + physics.CanCollide = true; + physics.PhysicsShapes.Add(new PhysShapeGrid(grid)); } - var controller = collidable.EnsureController(); + var controller = physics.EnsureController(); controller.Push(CalcNewVelocity(direction, enabled), CurrentWalkSpeed); } } diff --git a/Content.Server/GameObjects/Components/NodeContainer/Nodes/Node.cs b/Content.Server/GameObjects/Components/NodeContainer/Nodes/Node.cs index 74bee85c84..e513570337 100644 --- a/Content.Server/GameObjects/Components/NodeContainer/Nodes/Node.cs +++ b/Content.Server/GameObjects/Components/NodeContainer/Nodes/Node.cs @@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes /// private bool Connectable => !_deleting && Anchored; - private bool Anchored => !Owner.TryGetComponent(out var collidable) || collidable.Anchored; + private bool Anchored => !Owner.TryGetComponent(out var physics) || physics.Anchored; /// /// Prevents a node from being used by other nodes while midway through removal. @@ -63,19 +63,19 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes { TryAssignGroupIfNeeded(); CombineGroupWithReachable(); - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { AnchorUpdate(); - collidable.AnchoredChanged += AnchorUpdate; + physics.AnchoredChanged += AnchorUpdate; } } public void OnContainerRemove() { _deleting = true; - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { - collidable.AnchoredChanged -= AnchorUpdate; + physics.AnchoredChanged -= AnchorUpdate; } NodeGroup.RemoveNode(this); } diff --git a/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs b/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs index 7ab6c3fd4d..a704f7565f 100644 --- a/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Portal/TeleporterComponent.cs @@ -107,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Portal { // Added this component to avoid stacking portals and causing shenanigans // TODO: Doesn't do a great job of stopping stacking portals for directed - if (entity.HasComponent() || entity.HasComponent()) + if (entity.HasComponent() || entity.HasComponent()) { return; } @@ -151,7 +151,7 @@ namespace Content.Server.GameObjects.Components.Portal // TODO: Check the user's spot? Upside is no stacking TPs but downside is they can't unstuck themselves from walls. foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(user.Transform.MapID, target)) { - if (entity.HasComponent() || entity.HasComponent()) + if (entity.HasComponent() || entity.HasComponent()) { return false; } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs index 8d1e20b8a0..c45393e39c 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverComponent.cs @@ -50,7 +50,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents /// public bool Connectable => Anchored; - private bool Anchored => !Owner.TryGetComponent(out var collidable) || collidable.Anchored; + private bool Anchored => !Owner.TryGetComponent(out var physics) || physics.Anchored; [ViewVariables] public bool NeedsProvider { get; private set; } = true; @@ -92,18 +92,18 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents { TryFindAndSetProvider(); } - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { AnchorUpdate(); - collidable.AnchoredChanged += AnchorUpdate; + physics.AnchoredChanged += AnchorUpdate; } } public override void OnRemove() { - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { - collidable.AnchoredChanged -= AnchorUpdate; + physics.AnchoredChanged -= AnchorUpdate; } _provider.RemoveReceiver(this); base.OnRemove(); diff --git a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs index 3bfaf7d652..f4751d35f9 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs @@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Projectiles } // This is so entities that shouldn't get a collision are ignored. - if (entity.TryGetComponent(out ICollidableComponent collidable) && collidable.Hard == false) + if (entity.TryGetComponent(out IPhysicsComponent otherPhysics) && otherPhysics.Hard == false) { _deleteOnCollide = false; return; @@ -103,9 +103,9 @@ namespace Content.Server.GameObjects.Components.Projectiles } if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent) - && Owner.TryGetComponent(out ICollidableComponent collidableComponent)) + && Owner.TryGetComponent(out IPhysicsComponent ownPhysics)) { - var direction = collidableComponent.LinearVelocity.Normalized; + var direction = ownPhysics.LinearVelocity.Normalized; recoilComponent.Kick(direction); } } diff --git a/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs index 68aba32267..1fffccb797 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ThrownItemComponent.cs @@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Projectiles void ICollideBehavior.CollideWith(IEntity entity) { if (!_shouldCollide) return; - if (entity.TryGetComponent(out CollidableComponent collid)) + if (entity.TryGetComponent(out PhysicsComponent collid)) { if (!collid.Hard) // ignore non hard return; @@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Projectiles // after impacting the first object. // For realism this should actually be changed when the velocity of the object is less than a threshold. // This would allow ricochets off walls, and weird gravity effects from slowing the object. - if (Owner.TryGetComponent(out ICollidableComponent body) && body.PhysicsShapes.Count >= 1) + if (Owner.TryGetComponent(out IPhysicsComponent body) && body.PhysicsShapes.Count >= 1) { _shouldCollide = false; } @@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Projectiles return; } - if (Owner.TryGetComponent(out ICollidableComponent body) && body.PhysicsShapes.Count >= 1) + if (Owner.TryGetComponent(out IPhysicsComponent body) && body.PhysicsShapes.Count >= 1) { body.PhysicsShapes[0].CollisionMask &= (int) ~CollisionGroup.ThrownItem; @@ -91,7 +91,7 @@ namespace Content.Server.GameObjects.Components.Projectiles public void StartThrow(Vector2 direction, float speed) { - var comp = Owner.GetComponent(); + var comp = Owner.GetComponent(); comp.Status = BodyStatus.InAir; var controller = comp.EnsureController(); @@ -125,7 +125,7 @@ namespace Content.Server.GameObjects.Components.Projectiles { base.Initialize(); - Owner.EnsureComponent().EnsureController(); + Owner.EnsureComponent().EnsureController(); } } } diff --git a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs index 02e9585e4d..978455b504 100644 --- a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs +++ b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs @@ -126,8 +126,8 @@ namespace Content.Server.GameObjects.Components.Recycling return false; } - if (!entity.TryGetComponent(out ICollidableComponent collidable) || - collidable.Anchored) + if (!entity.TryGetComponent(out IPhysicsComponent physics) || + physics.Anchored) { return false; } @@ -163,16 +163,16 @@ namespace Content.Server.GameObjects.Components.Recycling for (var i = _intersecting.Count - 1; i >= 0; i--) { var entity = _intersecting[i]; - + if (entity.Deleted || !CanMove(entity) || !_entityManager.IsIntersecting(Owner, entity)) { _intersecting.RemoveAt(i); continue; } - if (entity.TryGetComponent(out ICollidableComponent collidable)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - var controller = collidable.EnsureController(); + var controller = physics.EnsureController(); controller.Move(direction, frameTime); } } diff --git a/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs index 73cd6b2fbb..3d890b8883 100644 --- a/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/FlippableComponent.cs @@ -19,8 +19,8 @@ namespace Content.Server.GameObjects.Components.Rotatable private void TryFlip(IEntity user) { - if (Owner.TryGetComponent(out ICollidableComponent? collidable) && - collidable.Anchored) + if (Owner.TryGetComponent(out IPhysicsComponent? physics) && + physics.Anchored) { Owner.PopupMessage(user, Loc.GetString("It's stuck.")); return; diff --git a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs index a3160b6fd8..142cf392e2 100644 --- a/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs +++ b/Content.Server/GameObjects/Components/Rotatable/RotatableComponent.cs @@ -16,9 +16,9 @@ namespace Content.Server.GameObjects.Components.Rotatable private void TryRotate(IEntity user, Angle angle) { - if (Owner.TryGetComponent(out ICollidableComponent collidable)) + if (Owner.TryGetComponent(out IPhysicsComponent physics)) { - if (collidable.Anchored) + if (physics.Anchored) { Owner.PopupMessage(user, Loc.GetString("It's stuck.")); return; diff --git a/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs b/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs index 555023b17c..72c318091b 100644 --- a/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs +++ b/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Temperature [ViewVariables] public float HeatCapacity { get { - if (Owner.TryGetComponent(out var physics)) + if (Owner.TryGetComponent(out var physics)) { return SpecificHeat * physics.Mass; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs index cfdc792278..cd7ab1dd85 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Barrels/ServerRangedBarrelComponent.cs @@ -389,15 +389,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels projectileAngle = angle; } - var collidableComponent = projectile.GetComponent(); - collidableComponent.Status = BodyStatus.InAir; + var physics = projectile.GetComponent(); + physics.Status = BodyStatus.InAir; projectile.Transform.WorldPosition = Owner.Transform.MapPosition.Position; var projectileComponent = projectile.GetComponent(); projectileComponent.IgnoreEntity(shooter); projectile - .GetComponent() + .GetComponent() .EnsureController() .LinearVelocity = projectileAngle.ToVec() * velocity; diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs index f0a58dc39e..558408affa 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -165,9 +165,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible var targetNode = _pathfindingSystem.GetNode(targetTile); var collisionMask = 0; - if (entity.TryGetComponent(out ICollidableComponent collidableComponent)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - collisionMask = collidableComponent.CollisionMask; + collisionMask = physics.CollisionMask; } var access = AccessReader.FindAccessTags(entity); diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/ReachableArgs.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/ReachableArgs.cs index 2f2ab5c3e6..af8efa2b11 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/ReachableArgs.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/ReachableArgs.cs @@ -27,14 +27,14 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible public static ReachableArgs GetArgs(IEntity entity) { var collisionMask = 0; - if (entity.TryGetComponent(out ICollidableComponent collidableComponent)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - collisionMask = collidableComponent.CollisionMask; + collisionMask = physics.CollisionMask; } var access = AccessReader.FindAccessTags(entity); var visionRadius = entity.GetComponent().VisionRadius; - + return new ReachableArgs(visionRadius, access, collisionMask); } } diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs index 69412abcfb..4411a8a890 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingNode.cs @@ -41,10 +41,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding GenerateMask(); } - public static bool IsRelevant(IEntity entity, ICollidableComponent collidableComponent) + public static bool IsRelevant(IEntity entity, IPhysicsComponent physicsComponent) { if (entity.Transform.GridID == GridId.Invalid || - (PathfindingSystem.TrackedCollisionLayers & collidableComponent.CollisionLayer) == 0) + (PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0) { return false; } @@ -257,7 +257,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding /// /// TODO: These 2 methods currently don't account for a bunch of changes (e.g. airlock unpowered, wrenching, etc.) /// TODO: Could probably optimise this slightly more. - public void AddEntity(IEntity entity, ICollidableComponent collidableComponent) + public void AddEntity(IEntity entity, IPhysicsComponent physicsComponent) { // If we're a door if (entity.HasComponent() || entity.HasComponent()) @@ -274,15 +274,15 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding return; } - DebugTools.Assert((PathfindingSystem.TrackedCollisionLayers & collidableComponent.CollisionLayer) != 0); + DebugTools.Assert((PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) != 0); - if (!collidableComponent.Anchored) + if (!physicsComponent.Anchored) { - _physicsLayers.Add(entity, collidableComponent.CollisionLayer); + _physicsLayers.Add(entity, physicsComponent.CollisionLayer); } else { - _blockedCollidables.Add(entity, collidableComponent.CollisionLayer); + _blockedCollidables.Add(entity, physicsComponent.CollisionLayer); GenerateMask(); ParentChunk.Dirty(); } diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs index a19384fe63..122ad0c5af 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs @@ -275,8 +275,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding { if (entity.Deleted || _lastKnownPositions.ContainsKey(entity) || - !entity.TryGetComponent(out ICollidableComponent collidableComponent) || - !PathfindingNode.IsRelevant(entity, collidableComponent)) + !entity.TryGetComponent(out IPhysicsComponent physics) || + !PathfindingNode.IsRelevant(entity, physics)) { return; } @@ -286,7 +286,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding var chunk = GetChunk(tileRef); var node = chunk.GetNode(tileRef); - node.AddEntity(entity, collidableComponent); + node.AddEntity(entity, physics); _lastKnownPositions.Add(entity, node); } @@ -314,8 +314,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding { // If we've moved to space or the likes then remove us. if (moveEvent.Sender.Deleted || - !moveEvent.Sender.TryGetComponent(out ICollidableComponent collidableComponent) || - !PathfindingNode.IsRelevant(moveEvent.Sender, collidableComponent)) + !moveEvent.Sender.TryGetComponent(out IPhysicsComponent physics) || + !PathfindingNode.IsRelevant(moveEvent.Sender, physics)) { HandleEntityRemove(moveEvent.Sender); return; @@ -350,7 +350,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding _lastKnownPositions[moveEvent.Sender] = newNode; oldNode.RemoveEntity(moveEvent.Sender); - newNode.AddEntity(moveEvent.Sender, collidableComponent); + newNode.AddEntity(moveEvent.Sender, physics); } private void QueueCollisionChangeMessage(CollisionChangeMessage collisionMessage) @@ -371,8 +371,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding public bool CanTraverse(IEntity entity, PathfindingNode node) { - if (entity.TryGetComponent(out ICollidableComponent collidableComponent) && - (collidableComponent.CollisionMask & node.BlockedCollisionMask) != 0) + if (entity.TryGetComponent(out IPhysicsComponent physics) && + (physics.CollisionMask & node.BlockedCollisionMask) != 0) { return false; } diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs index 66ba670267..14bc59cd05 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs @@ -417,9 +417,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering var startTile = gridManager.GetTileRef(entity.Transform.Coordinates); var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid); var collisionMask = 0; - if (entity.TryGetComponent(out ICollidableComponent collidableComponent)) + if (entity.TryGetComponent(out IPhysicsComponent physics)) { - collisionMask = collidableComponent.CollisionMask; + collisionMask = physics.CollisionMask; } var access = AccessReader.FindAccessTags(entity); @@ -603,10 +603,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering return Vector2.Zero; } - if (target.TryGetComponent(out ICollidableComponent collidable)) + if (target.TryGetComponent(out IPhysicsComponent physics)) { var targetDistance = (targetPos.Position - entityPos.Position); - targetPos = targetPos.Offset(collidable.LinearVelocity * targetDistance); + targetPos = targetPos.Offset(physics.LinearVelocity * targetDistance); } return (targetPos.Position - entityPos.Position).Normalized; @@ -621,7 +621,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering /// private Vector2 CollisionAvoidance(IEntity entity, Vector2 direction, ICollection ignoredTargets) { - if (direction == Vector2.Zero || !entity.TryGetComponent(out ICollidableComponent collidableComponent)) + if (direction == Vector2.Zero || !entity.TryGetComponent(out IPhysicsComponent physics)) { return Vector2.Zero; } @@ -629,7 +629,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering // We'll check tile-by-tile // Rewriting this frequently so not many comments as they'll go stale // I realise this is bad so please rewrite it ;-; - var entityCollisionMask = collidableComponent.CollisionMask; + var entityCollisionMask = physics.CollisionMask; var avoidanceVector = Vector2.Zero; var checkTiles = new HashSet(); var avoidTiles = new HashSet(); @@ -662,8 +662,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering // if we're moving in the same direction then ignore // So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction // i.e. towards the right - if (physicsEntity.TryGetComponent(out ICollidableComponent collidable) && - Vector2.Dot(collidable.LinearVelocity, direction) > 0) + if (physicsEntity.TryGetComponent(out IPhysicsComponent otherPhysics) && + Vector2.Dot(otherPhysics.LinearVelocity, direction) > 0) { continue; } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index c7b7f5275d..e60b53d151 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -288,13 +288,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click return false; } - if (!pull.Owner.TryGetComponent(out ICollidableComponent collidable) || - collidable.Anchored) + if (!pull.Owner.TryGetComponent(out IPhysicsComponent physics) || + physics.Anchored) { return false; } - var controller = collidable.EnsureController(); + var controller = physics.EnsureController(); if (controller.GettingPulled) { diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index ba0c66a07d..0dcfc3ad64 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -58,13 +58,13 @@ namespace Content.Server.GameObjects.EntitySystems public override void Update(float frameTime) { - foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery()) + foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery()) { var entity = moverComponent.Owner; if (_pauseManager.IsEntityPaused(entity)) continue; - UpdateKinematics(entity.Transform, moverComponent, collidableComponent); + UpdateKinematics(entity.Transform, moverComponent, physics); } } @@ -83,7 +83,7 @@ namespace Content.Server.GameObjects.EntitySystems ev.Entity.RemoveComponent(); } - if (ev.Entity.TryGetComponent(out ICollidableComponent? physics) && + if (ev.Entity.TryGetComponent(out IPhysicsComponent? physics) && physics.TryGetController(out MoverController controller)) { controller.StopMoving(); diff --git a/Content.Server/GlobalVerbs/PullingVerb.cs b/Content.Server/GlobalVerbs/PullingVerb.cs index 4e9743c1a4..63b5526d37 100644 --- a/Content.Server/GlobalVerbs/PullingVerb.cs +++ b/Content.Server/GlobalVerbs/PullingVerb.cs @@ -37,35 +37,35 @@ namespace Content.Server.GlobalVerbs } if (!user.HasComponent() || - !user.TryGetComponent(out ICollidableComponent userCollidable) || - !target.TryGetComponent(out ICollidableComponent targetCollidable) || - targetCollidable.Anchored) + !user.TryGetComponent(out IPhysicsComponent userPhysics) || + !target.TryGetComponent(out IPhysicsComponent targetPhysics) || + targetPhysics.Anchored) { return; } - var controller = targetCollidable.EnsureController(); + var controller = targetPhysics.EnsureController(); data.Visibility = VerbVisibility.Visible; - data.Text = controller.Puller == userCollidable + data.Text = controller.Puller == userPhysics ? Loc.GetString("Stop pulling") : Loc.GetString("Pull"); } public override void Activate(IEntity user, IEntity target) { - if (!user.TryGetComponent(out ICollidableComponent userCollidable) || - !target.TryGetComponent(out ICollidableComponent targetCollidable) || - targetCollidable.Anchored || + if (!user.TryGetComponent(out IPhysicsComponent userPhysics) || + !target.TryGetComponent(out IPhysicsComponent targetPhysics) || + targetPhysics.Anchored || !target.TryGetComponent(out PullableComponent pullable) || !user.TryGetComponent(out HandsComponent hands)) { return; } - var controller = targetCollidable.EnsureController(); + var controller = targetPhysics.EnsureController(); - if (controller.Puller == userCollidable) + if (controller.Puller == userPhysics) { hands.StopPull(); } diff --git a/Content.Server/Throw/ThrowHelper.cs b/Content.Server/Throw/ThrowHelper.cs index 567325c070..8490d7fc3e 100644 --- a/Content.Server/Throw/ThrowHelper.cs +++ b/Content.Server/Throw/ThrowHelper.cs @@ -41,7 +41,7 @@ namespace Content.Server.Throw /// public static void Throw(IEntity thrownEnt, float throwForce, EntityCoordinates targetLoc, EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null) { - if (!thrownEnt.TryGetComponent(out ICollidableComponent colComp)) + if (!thrownEnt.TryGetComponent(out IPhysicsComponent colComp)) return; var entityManager = IoCManager.Resolve(); @@ -84,7 +84,7 @@ namespace Content.Server.Throw projComp.StartThrow(angle.ToVec(), spd); if (throwSourceEnt != null && - throwSourceEnt.TryGetComponent(out var physics) && + throwSourceEnt.TryGetComponent(out var physics) && physics.TryGetController(out MoverController mover)) { var physicsMgr = IoCManager.Resolve(); @@ -139,9 +139,9 @@ namespace Content.Server.Throw var throwDuration = ThrownItemComponent.DefaultThrowTime; var mass = 1f; - if (thrownEnt.TryGetComponent(out ICollidableComponent collidable)) + if (thrownEnt.TryGetComponent(out IPhysicsComponent physics)) { - mass = collidable.Mass; + mass = physics.Mass; } var velocityNecessary = distance / throwDuration; diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs index b45cb157d5..f66cafaf14 100644 --- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs +++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs @@ -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); } } diff --git a/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs b/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs index 9e16860294..4e2eb5f5bb 100644 --- a/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs @@ -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; diff --git a/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs index a9821a4665..287065bdec 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs @@ -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 diff --git a/Content.Shared/GameObjects/Components/Movement/SharedPlayerInputMoverComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedPlayerInputMoverComponent.cs index 17295fa6cb..14554be489 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedPlayerInputMoverComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedPlayerInputMoverComponent.cs @@ -144,11 +144,11 @@ namespace Content.Shared.GameObjects.Components.Movement /// public override void OnAdd() { - // This component requires that the entity has a CollidableComponent. - if (!Owner.HasComponent()) + // This component requires that the entity has a IPhysicsComponent. + if (!Owner.HasComponent()) Logger.Error( $"[ECS] {Owner.Prototype?.Name} - {nameof(SharedPlayerInputMoverComponent)} requires" + - $" {nameof(ICollidableComponent)}. "); + $" {nameof(IPhysicsComponent)}. "); base.OnAdd(); } diff --git a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs index 5814ee2904..e865e23c66 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs @@ -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(); - controller.LinearVelocity = collidable.LinearVelocity * LaunchForwardsMultiplier; + var controller = physics.EnsureController(); + 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(); - var otherCollidable = entity.GetComponent(); + var physics = Owner.GetComponent(); + var otherPhysics = entity.GetComponent(); - 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(); + var physics = Owner.EnsureComponent(); - collidable.Hard = false; + physics.Hard = false; - var shape = collidable.PhysicsShapes.FirstOrDefault(); + var shape = physics.PhysicsShapes.FirstOrDefault(); if (shape != null) { diff --git a/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs b/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs index d2fa86d540..320e682ded 100644 --- a/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs +++ b/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs @@ -13,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.Portal { base.OnAdd(); - if (Owner.TryGetComponent(out var collidable)) + if (Owner.TryGetComponent(out var physics)) { - collidable.Hard = false; + physics.Hard = false; } } } diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs index 42c6ea5117..aab8b95d51 100644 --- a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs +++ b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs @@ -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) diff --git a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs index 4d983ef655..c8b308cc26 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs @@ -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(); + physics.EnsureController(); var weightless = !transform.Owner.HasComponent() && _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(out var otherCollider)) + if (!entity.TryGetComponent(out var otherCollider)) { continue; } diff --git a/Content.Shared/Physics/BulletController.cs b/Content.Shared/Physics/BulletController.cs index 349b44bf11..eccd2b291f 100644 --- a/Content.Shared/Physics/BulletController.cs +++ b/Content.Shared/Physics/BulletController.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Physics { public class BulletController : VirtualController { - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } public void Push(Vector2 velocityDirection, float speed) { diff --git a/Content.Shared/Physics/ConveyedController.cs b/Content.Shared/Physics/ConveyedController.cs index 7e133095f0..92d7c565f9 100644 --- a/Content.Shared/Physics/ConveyedController.cs +++ b/Content.Shared/Physics/ConveyedController.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Physics { public class ConveyedController : VirtualController { - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } public void Move(Vector2 velocityDirection, float speed) { diff --git a/Content.Shared/Physics/MoverController.cs b/Content.Shared/Physics/MoverController.cs index 6c628bc8dc..cf0831a5ab 100644 --- a/Content.Shared/Physics/MoverController.cs +++ b/Content.Shared/Physics/MoverController.cs @@ -12,7 +12,7 @@ namespace Content.Shared.Physics { [Dependency] private readonly IPhysicsManager _physicsManager = default!; - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } public void Move(Vector2 velocityDirection, float speed) { diff --git a/Content.Shared/Physics/Pull/PullController.cs b/Content.Shared/Physics/Pull/PullController.cs index 0dfee54213..a703cfa059 100644 --- a/Content.Shared/Physics/Pull/PullController.cs +++ b/Content.Shared/Physics/Pull/PullController.cs @@ -18,15 +18,15 @@ namespace Content.Shared.Physics.Pull private const float DistBeforeStopPull = SharedInteractionSystem.InteractionRange; - private ICollidableComponent? _puller; + private IPhysicsComponent? _puller; public bool GettingPulled => _puller != null; private EntityCoordinates? _movingTo; - public ICollidableComponent? Puller => _puller; + public IPhysicsComponent? Puller => _puller; - public void StartPull(ICollidableComponent puller) + public void StartPull(IPhysicsComponent puller) { DebugTools.AssertNotNull(puller); diff --git a/Content.Shared/Physics/Pull/PullMessage.cs b/Content.Shared/Physics/Pull/PullMessage.cs index 811eae404e..8a4ae5076e 100644 --- a/Content.Shared/Physics/Pull/PullMessage.cs +++ b/Content.Shared/Physics/Pull/PullMessage.cs @@ -6,10 +6,10 @@ namespace Content.Shared.Physics.Pull public class PullMessage : ComponentMessage { public readonly PullController Controller; - public readonly ICollidableComponent Puller; - public readonly ICollidableComponent Pulled; + public readonly IPhysicsComponent Puller; + public readonly IPhysicsComponent Pulled; - protected PullMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled) + protected PullMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled) { Controller = controller; Puller = puller; diff --git a/Content.Shared/Physics/Pull/PullStartedMessage.cs b/Content.Shared/Physics/Pull/PullStartedMessage.cs index 263c0b8db1..02be743c30 100644 --- a/Content.Shared/Physics/Pull/PullStartedMessage.cs +++ b/Content.Shared/Physics/Pull/PullStartedMessage.cs @@ -4,7 +4,7 @@ namespace Content.Shared.Physics.Pull { public class PullStartedMessage : PullMessage { - public PullStartedMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled) : + public PullStartedMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled) : base(controller, puller, pulled) { } diff --git a/Content.Shared/Physics/Pull/PullStoppedMessage.cs b/Content.Shared/Physics/Pull/PullStoppedMessage.cs index c018558341..aff10c5514 100644 --- a/Content.Shared/Physics/Pull/PullStoppedMessage.cs +++ b/Content.Shared/Physics/Pull/PullStoppedMessage.cs @@ -4,7 +4,7 @@ namespace Content.Shared.Physics.Pull { public class PullStoppedMessage : PullMessage { - public PullStoppedMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled) : + public PullStoppedMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled) : base(controller, puller, pulled) { } diff --git a/Content.Shared/Physics/ShuttleController.cs b/Content.Shared/Physics/ShuttleController.cs index 8a95fbec33..cb995167f3 100644 --- a/Content.Shared/Physics/ShuttleController.cs +++ b/Content.Shared/Physics/ShuttleController.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Physics { public class ShuttleController : VirtualController { - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } public void Push(Vector2 velocityDirection, float speed) { diff --git a/Content.Shared/Physics/ThrownController.cs b/Content.Shared/Physics/ThrownController.cs index 8b2c39a9df..1586fb4954 100644 --- a/Content.Shared/Physics/ThrownController.cs +++ b/Content.Shared/Physics/ThrownController.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Physics { public class ThrownController : VirtualController { - public override ICollidableComponent? ControlledComponent { protected get; set; } + public override IPhysicsComponent? ControlledComponent { protected get; set; } public void Push(Vector2 velocityDirection, float speed) { diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index c1af0f9c44..ff43d839d0 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -26,6 +26,7 @@ sprite: Mobs/Animals/monkey.rsi - type: Clickable - type: Collidable + anchored: false mass: 50 shapes: - !type:PhysShapeAabb @@ -77,6 +78,7 @@ state: crawling sprite: Mobs/Animals/gorilla.rsi - type: Collidable + anchored: false mass: 90 shapes: - !type:PhysShapeAabb @@ -111,6 +113,7 @@ state: chicken-0 sprite: Mobs/Animals/chicken.rsi - type: Collidable + anchored: false mass: 20 shapes: - !type:PhysShapeAabb @@ -148,6 +151,7 @@ state: butterfly sprite: Mobs/Animals/butterfly.rsi - type: Collidable + anchored: false mass: 5 shapes: - !type:PhysShapeAabb @@ -195,6 +199,7 @@ state: bat sprite: Mobs/Animals/bat.rsi - type: Collidable + anchored: false mass: 5 shapes: - !type:PhysShapeAabb @@ -233,6 +238,7 @@ state: 0 sprite: Mobs/Animals/bee.rsi - type: Collidable + anchored: false mass: 5 shapes: - !type:PhysShapeAabb @@ -267,6 +273,7 @@ state: goat sprite: Mobs/Animals/goat.rsi - type: Collidable + anchored: false mass: 20 shapes: - !type:PhysShapeAabb @@ -302,6 +309,7 @@ state: goose sprite: Mobs/Animals/goose.rsi - type: Collidable + anchored: false mass: 20 shapes: - !type:PhysShapeAabb @@ -340,6 +348,7 @@ state: parrot sprite: Mobs/Animals/parrot.rsi - type: Collidable + anchored: false mass: 20 shapes: - !type:PhysShapeAabb @@ -374,6 +383,7 @@ state: snake sprite: Mobs/Animals/snake.rsi - type: Collidable + anchored: false mass: 10 shapes: - !type:PhysShapeAabb @@ -411,6 +421,7 @@ state: tarantula sprite: Mobs/Animals/spider.rsi - type: Collidable + anchored: false mass: 10 shapes: - !type:PhysShapeAabb @@ -445,6 +456,7 @@ state: crab sprite: Mobs/Animals/crab.rsi - type: Collidable + anchored: false mass: 10 shapes: - !type:PhysShapeAabb @@ -479,6 +491,7 @@ state: penguin sprite: Mobs/Animals/penguin.rsi - type: Collidable + anchored: false mass: 10 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml index 7dee6ee26a..4e4647fe42 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml @@ -20,6 +20,7 @@ state: carp sprite: Mobs/Aliens/Carps/carp_space.rsi - type: Collidable + anchored: false mass: 50 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/mimic.yml b/Resources/Prototypes/Entities/Mobs/NPCs/mimic.yml index 8d577a302d..8e59056820 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/mimic.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/mimic.yml @@ -24,6 +24,7 @@ sprite: Constructible/Power/VendingMachines/cola.rsi state: normal - type: Collidable + anchored: false mass: 85 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index cf8633e9ab..d3ca7ac812 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -21,6 +21,7 @@ - type: InteractionOutline - type: Clickable - type: Collidable + anchored: false mass: 50 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml b/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml index 0b74501460..13b71e6116 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/xeno.yml @@ -23,6 +23,7 @@ sprite: Mobs/Aliens/Xenos/xeno_hunter.rsi - type: Clickable - type: Collidable + anchored: false mass: 85 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/Player/observer.yml b/Resources/Prototypes/Entities/Mobs/Player/observer.yml index 943d8edad3..26885f8a01 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/observer.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/observer.yml @@ -7,6 +7,7 @@ components: - type: Mind - type: Collidable + anchored: false mass: 5 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Mobs/Species/human.yml b/Resources/Prototypes/Entities/Mobs/Species/human.yml index c9b334d4f9..2c53e01547 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/human.yml @@ -116,6 +116,7 @@ - map: [ "enum.Slots.MASK" ] - map: [ "enum.Slots.HEAD" ] - type: Collidable + anchored: false mass: 85 shapes: - !type:PhysShapeAabb @@ -279,6 +280,7 @@ - map: ["hand-left"] - map: ["hand-right"] - type: Collidable + anchored: false mass: 85 shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Objects/Power/powercells.yml b/Resources/Prototypes/Entities/Objects/Power/powercells.yml index ff6019da45..5658391558 100644 --- a/Resources/Prototypes/Entities/Objects/Power/powercells.yml +++ b/Resources/Prototypes/Entities/Objects/Power/powercells.yml @@ -4,6 +4,7 @@ parent: BaseItem components: - type: Collidable + anchored: false shapes: - !type:PhysShapeAabb bounds: "-0.15,-0.3,0.2,0.3" diff --git a/Resources/Prototypes/Entities/Objects/Specific/janitor.yml b/Resources/Prototypes/Entities/Objects/Specific/janitor.yml index cd295be16b..853f8708ec 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/janitor.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/janitor.yml @@ -176,6 +176,7 @@ - state: chempuff map: [ "enum.VaporVisualLayers.Base" ] - type: Collidable + anchored: false hard: false shapes: - !type:PhysShapeAabb diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 515832b3b8..1c71739ab5 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -12,6 +12,7 @@ sprite: Objects/Weapons/Guns/Projectiles/bullet.rsi state: bullet - type: Collidable + anchored: false edgeslide: false hard: false shapes: diff --git a/Resources/Prototypes/Entities/item_base.yml b/Resources/Prototypes/Entities/item_base.yml index fbb981b721..63b68c5adc 100644 --- a/Resources/Prototypes/Entities/item_base.yml +++ b/Resources/Prototypes/Entities/item_base.yml @@ -10,6 +10,7 @@ - type: MovedByPressure - type: DamageOnHighSpeedImpact - type: Collidable + anchored: false mass: 5 shapes: - !type:PhysShapeAabb