Rename usages of collidable to physics (#2230)
* Rename usages of collidable to physics * high tier PANIQUE * aaaaaaaaAAAAAa * cursed commit dont research * Fix urist and items being anchored * Fix the rest
This commit is contained in:
@@ -20,9 +20,9 @@ namespace Content.Client.GameObjects.Components.Mobs.State
|
|||||||
|
|
||||||
EntitySystem.Get<StandingStateSystem>().Down(entity);
|
EntitySystem.Get<StandingStateSystem>().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<StandingStateSystem>().Standing(entity);
|
EntitySystem.Get<StandingStateSystem>().Standing(entity);
|
||||||
|
|
||||||
if (entity.TryGetComponent(out CollidableComponent collidable))
|
if (entity.TryGetComponent(out PhysicsComponent physics))
|
||||||
{
|
{
|
||||||
collidable.CanCollide = true;
|
physics.CanCollide = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ally.TryGetComponent(out ICollidableComponent collidable))
|
if (!ally.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
}
|
}
|
||||||
|
|
||||||
// all entities have a TransformComponent
|
// all entities have a TransformComponent
|
||||||
var transform = collidable.Entity.Transform;
|
var transform = physics.Entity.Transform;
|
||||||
|
|
||||||
// if not on the same map, continue
|
// if not on the same map, continue
|
||||||
if (transform.MapID != _eyeManager.CurrentMap || !transform.IsMapTransform)
|
if (transform.MapID != _eyeManager.CurrentMap || !transform.IsMapTransform)
|
||||||
@@ -93,7 +93,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var worldBox = collidable.WorldAABB;
|
var worldBox = physics.WorldAABB;
|
||||||
|
|
||||||
// if not on screen, or too small, continue
|
// if not on screen, or too small, continue
|
||||||
if (!worldBox.Intersects(in viewport) || worldBox.IsEmpty())
|
if (!worldBox.Intersects(in viewport) || worldBox.IsEmpty())
|
||||||
@@ -101,7 +101,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
continue;
|
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);
|
DrawString(screen, _font, screenCoordinates, _traitorText, Color.OrangeRed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collidable = playerEnt.GetComponent<ICollidableComponent>();
|
var physics = playerEnt.GetComponent<IPhysicsComponent>();
|
||||||
collidable.Predict = true;
|
physics.Predict = true;
|
||||||
|
|
||||||
UpdateKinematics(playerEnt.Transform, mover, collidable);
|
UpdateKinematics(playerEnt.Transform, mover, physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
|
|
||||||
airlock = entityManager.SpawnEntity("Airlock", new MapCoordinates((0, 0), mapId));
|
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<TestController>();
|
controller = physics.EnsureController<TestController>();
|
||||||
|
|
||||||
Assert.True(airlock.TryGetComponent(out airlockComponent));
|
Assert.True(airlock.TryGetComponent(out airlockComponent));
|
||||||
Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed));
|
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)
|
for (var i = 0; i < 240; i += 10)
|
||||||
{
|
{
|
||||||
// Keep the airlock awake so they collide
|
// Keep the airlock awake so they collide
|
||||||
airlock.GetComponent<ICollidableComponent>().WakeBody();
|
airlock.GetComponent<IPhysicsComponent>().WakeBody();
|
||||||
|
|
||||||
// Ensure that it is still closed
|
// Ensure that it is still closed
|
||||||
Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed));
|
Assert.That(airlockComponent.State, Is.EqualTo(DoorState.Closed));
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
// Now let's make the player enter a climbing transitioning state.
|
// Now let's make the player enter a climbing transitioning state.
|
||||||
climbing.IsClimbing = true;
|
climbing.IsClimbing = true;
|
||||||
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
||||||
var body = human.GetComponent<ICollidableComponent>();
|
var body = human.GetComponent<IPhysicsComponent>();
|
||||||
|
|
||||||
Assert.That(body.HasController<ClimbController>(), "Player has no ClimbController", Is.True);
|
Assert.That(body.HasController<ClimbController>(), "Player has no ClimbController", Is.True);
|
||||||
|
|
||||||
|
|||||||
@@ -112,9 +112,9 @@ namespace Content.Server.Administration
|
|||||||
if (found.GetGridId(entityManager) != GridId.Invalid)
|
if (found.GetGridId(entityManager) != GridId.Invalid)
|
||||||
{
|
{
|
||||||
player.AttachedEntity.Transform.Coordinates = found;
|
player.AttachedEntity.Transform.Coordinates = found;
|
||||||
if (player.AttachedEntity.TryGetComponent(out ICollidableComponent collidable))
|
if (player.AttachedEntity.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
collidable.Stop();
|
physics.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private IPhysicsManager _physicsManager = 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 MoveForcePushRatio = 1f;
|
||||||
private const float MoveForceForcePushRatio = 1f;
|
private const float MoveForceForcePushRatio = 1f;
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices))
|
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)
|
|| !entity.TryGetComponent(out MovedByPressureComponent pressure)
|
||||||
|| ContainerHelpers.IsInContainer(entity))
|
|| ContainerHelpers.IsInContainer(entity))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ namespace Content.Server.Construction.Completions
|
|||||||
|
|
||||||
public async Task PerformAction(IEntity entity, IEntity? user)
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,19 +20,19 @@ namespace Content.Server.Construction.Conditions
|
|||||||
|
|
||||||
public async Task<bool> Condition(IEntity entity)
|
public async Task<bool> 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)
|
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");
|
message.AddMarkup("First, anchor it.\n");
|
||||||
|
|
||||||
if(!Anchored && collidable.Anchored)
|
if(!Anchored && physics.Anchored)
|
||||||
message.AddMarkup("First, unanchor it.\n");
|
message.AddMarkup("First, unanchor it.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <returns>true if it is valid, false otherwise</returns>
|
/// <returns>true if it is valid, false otherwise</returns>
|
||||||
private async Task<bool> Valid(IEntity user, IEntity? utilizing, [MaybeNullWhen(false)] bool force = false)
|
private async Task<bool> Valid(IEntity user, IEntity? utilizing, [MaybeNullWhen(false)] bool force = false)
|
||||||
{
|
{
|
||||||
if (!Owner.HasComponent<ICollidableComponent>())
|
if (!Owner.HasComponent<IPhysicsComponent>())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var physics = Owner.GetComponent<ICollidableComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
physics.Anchored = true;
|
physics.Anchored = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -90,7 +90,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var physics = Owner.GetComponent<ICollidableComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
physics.Anchored = false;
|
physics.Anchored = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -105,12 +105,12 @@ namespace Content.Server.GameObjects.Components
|
|||||||
/// <returns>true if toggled, false otherwise</returns>
|
/// <returns>true if toggled, false otherwise</returns>
|
||||||
private async Task<bool> TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
|
private async Task<bool> TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out ICollidableComponent? collidable))
|
if (!Owner.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return collidable.Anchored ?
|
return physics.Anchored ?
|
||||||
await TryUnAnchor(user, utilizing, force) :
|
await TryUnAnchor(user, utilizing, force) :
|
||||||
await TryAnchor(user, utilizing, force);
|
await TryAnchor(user, utilizing, force);
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Owner.EnsureComponent<CollidableComponent>();
|
Owner.EnsureComponent<PhysicsComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
airtightComponent.AirBlocked = false;
|
airtightComponent.AirBlocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent collidableComponent))
|
if (Owner.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
collidableComponent.Hard = false;
|
physics.Hard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoClose = false;
|
AutoClose = false;
|
||||||
|
|||||||
@@ -142,10 +142,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(uid);
|
var entity = _entityManager.GetEntity(uid);
|
||||||
var collidable = Owner.GetComponent<ICollidableComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
var otherCollidable = entity.GetComponent<ICollidableComponent>();
|
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||||
|
|
||||||
if (!collidable.WorldAABB.Intersects(otherCollidable.WorldAABB))
|
if (!physics.WorldAABB.Intersects(otherPhysics.WorldAABB))
|
||||||
{
|
{
|
||||||
_collided.Remove(uid);
|
_collided.Remove(uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
public GasMixture Air { get; set; }
|
public GasMixture Air { get; set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored => !Owner.TryGetComponent<ICollidableComponent>(out var collidable) || collidable.Anchored;
|
public bool Anchored => !Owner.TryGetComponent<IPhysicsComponent>(out var physics) || physics.Anchored;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public GasCanisterPortComponent ConnectedPort { get; private set; }
|
public GasCanisterPortComponent ConnectedPort { get; private set; }
|
||||||
@@ -39,19 +39,19 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
AnchorUpdate();
|
AnchorUpdate();
|
||||||
collidable.AnchoredChanged += AnchorUpdate;
|
physics.AnchoredChanged += AnchorUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
{
|
{
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
collidable.AnchoredChanged -= AnchorUpdate;
|
physics.AnchoredChanged -= AnchorUpdate;
|
||||||
}
|
}
|
||||||
DisconnectFromPort();
|
DisconnectFromPort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
_velocity = velocity;
|
_velocity = velocity;
|
||||||
_aliveTime = aliveTime;
|
_aliveTime = aliveTime;
|
||||||
// Set Move
|
// Set Move
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent collidable))
|
if (Owner.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
var controller = collidable.EnsureController<VaporController>();
|
var controller = physics.EnsureController<VaporController>();
|
||||||
controller.Move(_direction, _velocity);
|
controller.Move(_direction, _velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
_timer += frameTime;
|
_timer += frameTime;
|
||||||
_reactTimer += frameTime;
|
_reactTimer += frameTime;
|
||||||
|
|
||||||
if (_reactTimer >= ReactTime && Owner.TryGetComponent(out ICollidableComponent collidable))
|
if (_reactTimer >= ReactTime && Owner.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
_reactTimer = 0;
|
_reactTimer = 0;
|
||||||
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
|
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
|
||||||
@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
{
|
{
|
||||||
_reached = true;
|
_reached = true;
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent coll))
|
if (Owner.TryGetComponent(out IPhysicsComponent coll))
|
||||||
{
|
{
|
||||||
var controller = coll.EnsureController<VaporController>();
|
var controller = coll.EnsureController<VaporController>();
|
||||||
controller.Stop();
|
controller.Stop();
|
||||||
@@ -150,11 +150,11 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for collision with a impassable object (e.g. wall) and stop
|
// 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<VaporController>();
|
var controller = coll.EnsureController<VaporController>();
|
||||||
controller.Stop();
|
controller.Stop();
|
||||||
|
|||||||
@@ -422,10 +422,10 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out CollidableComponent? collidable) &&
|
if (Owner.TryGetComponent(out IPhysicsComponent? physics) &&
|
||||||
entity.TryGetComponent(out CollidableComponent? otherCollidable))
|
entity.TryGetComponent(out IPhysicsComponent? otherPhysics))
|
||||||
{
|
{
|
||||||
otherCollidable.Anchored = collidable.Anchored;
|
otherPhysics.Anchored = physics.Anchored;
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ namespace Content.Server.GameObjects.Components.Conveyor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
|
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
collidable.Anchored)
|
physics.Anchored)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -152,9 +152,9 @@ namespace Content.Server.GameObjects.Components.Conveyor
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out ICollidableComponent? collidable))
|
if (entity.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
var controller = collidable.EnsureController<ConveyedController>();
|
var controller = physics.EnsureController<ConveyedController>();
|
||||||
controller.Move(direction, _speed * frameTime);
|
controller.Move(direction, _speed * frameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ namespace Content.Server.GameObjects.Components.Damage
|
|||||||
|
|
||||||
public void CollideWith(IEntity collidedWith)
|
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;
|
if (speed < MinimumSpeed) return;
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
|
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
!collidable.CanCollide)
|
!physics.CanCollide)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -73,9 +73,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out ICollidableComponent? collidable))
|
if (entity.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
collidable.CanCollide = false;
|
physics.CanCollide = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -105,9 +105,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
foreach (var entity in _contents.ContainedEntities.ToArray())
|
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);
|
_contents.ForceRemove(entity);
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!Owner.TryGetComponent(out ICollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
collidable.Anchored;
|
physics.Anchored;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
||||||
collidable.Anchored;
|
physics.Anchored;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Anchored =>
|
private bool Anchored =>
|
||||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out PhysicsComponent? physics) ||
|
||||||
collidable.Anchored;
|
physics.Anchored;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The directions that this tube can connect to others from
|
/// The directions that this tube can connect to others from
|
||||||
@@ -192,12 +192,12 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
private void AnchoredChanged()
|
private void AnchoredChanged()
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out CollidableComponent? collidable))
|
if (!Owner.TryGetComponent(out PhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collidable.Anchored)
|
if (physics.Anchored)
|
||||||
{
|
{
|
||||||
OnAnchor();
|
OnAnchor();
|
||||||
}
|
}
|
||||||
@@ -232,16 +232,16 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
Contents = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
Contents = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
||||||
Owner.EnsureComponent<AnchorableComponent>();
|
Owner.EnsureComponent<AnchorableComponent>();
|
||||||
|
|
||||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
var physics = Owner.EnsureComponent<PhysicsComponent>();
|
||||||
|
|
||||||
collidable.AnchoredChanged += AnchoredChanged;
|
physics.AnchoredChanged += AnchoredChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
if (!Owner.EnsureComponent<CollidableComponent>().Anchored)
|
if (!Owner.EnsureComponent<PhysicsComponent>().Anchored)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,8 +254,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
|
|
||||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
var physics = Owner.EnsureComponent<PhysicsComponent>();
|
||||||
collidable.AnchoredChanged -= AnchoredChanged;
|
physics.AnchoredChanged -= AnchoredChanged;
|
||||||
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
|
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
!collidable.CanCollide)
|
!physics.CanCollide)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -549,9 +549,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
Logger.WarningS("VitalComponentMissing", $"Disposal unit {Owner.Uid} is missing an anchorable component");
|
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))
|
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
|
||||||
@@ -564,9 +564,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
public override void OnRemove()
|
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))
|
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
|
||||||
|
|||||||
@@ -254,9 +254,9 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
airtight.AirBlocked = false;
|
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);
|
await Timer.Delay(OpenTimeTwo, _cancellationTokenSource.Token);
|
||||||
@@ -297,7 +297,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
|
|
||||||
private void CheckCrush()
|
private void CheckCrush()
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out ICollidableComponent? body))
|
if (!Owner.TryGetComponent(out IPhysicsComponent? body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Crush
|
// Crush
|
||||||
@@ -305,7 +305,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
{
|
{
|
||||||
if (!e.TryGetComponent(out StunnableComponent? stun)
|
if (!e.TryGetComponent(out StunnableComponent? stun)
|
||||||
|| !e.TryGetComponent(out IDamageableComponent? damage)
|
|| !e.TryGetComponent(out IDamageableComponent? damage)
|
||||||
|| !e.TryGetComponent(out ICollidableComponent? otherBody))
|
|| !e.TryGetComponent(out IPhysicsComponent? otherBody))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB);
|
var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB);
|
||||||
@@ -377,7 +377,8 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
{
|
{
|
||||||
bool shouldCheckCrush = false;
|
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)
|
if (Safety)
|
||||||
return false;
|
return false;
|
||||||
@@ -406,7 +407,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
airtight.AirBlocked = true;
|
airtight.AirBlocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent? body))
|
if (Owner.TryGetComponent(out IPhysicsComponent? body))
|
||||||
{
|
{
|
||||||
body.Hard = true;
|
body.Hard = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,8 +377,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
|
|
||||||
foreach (var entity in _snapGrid.GetInDir(direction))
|
foreach (var entity in _snapGrid.GetInDir(direction))
|
||||||
{
|
{
|
||||||
if (entity.TryGetComponent(out ICollidableComponent collidable) &&
|
if (entity.TryGetComponent(out IPhysicsComponent physics) &&
|
||||||
(collidable.CollisionLayer & (int) CollisionGroup.Impassable) != 0)
|
(physics.CollisionLayer & (int) CollisionGroup.Impassable) != 0)
|
||||||
{
|
{
|
||||||
puddle = default;
|
puddle = default;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -533,9 +533,9 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
StopPull();
|
StopPull();
|
||||||
}
|
}
|
||||||
|
|
||||||
PulledObject = pullable.Owner.GetComponent<ICollidableComponent>();
|
PulledObject = pullable.Owner.GetComponent<IPhysicsComponent>();
|
||||||
var controller = PulledObject.EnsureController<PullController>();
|
var controller = PulledObject.EnsureController<PullController>();
|
||||||
controller.StartPull(Owner.GetComponent<ICollidableComponent>());
|
controller.StartPull(Owner.GetComponent<IPhysicsComponent>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePulledObject(EntityCoordinates puller, EntityCoordinates to)
|
public void MovePulledObject(EntityCoordinates puller, EntityCoordinates to)
|
||||||
@@ -686,13 +686,13 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|
||||||
if (!message.Entity.TryGetComponent(out ICollidableComponent? collidable))
|
if (!message.Entity.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set velocity to zero
|
// set velocity to zero
|
||||||
collidable.Stop();
|
physics.Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,15 +201,15 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
|
|
||||||
private void ModifyComponents()
|
private void ModifyComponents()
|
||||||
{
|
{
|
||||||
if (!_isCollidableWhenOpen && Owner.TryGetComponent<ICollidableComponent>(out var collidableComponent))
|
if (!_isCollidableWhenOpen && Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
if (Open)
|
if (Open)
|
||||||
{
|
{
|
||||||
collidableComponent.Hard = false;
|
physics.Hard = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
collidableComponent.Hard = true;
|
physics.Hard = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,31 +226,30 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
|
|
||||||
private bool AddToContents(IEntity entity)
|
private bool AddToContents(IEntity entity)
|
||||||
{
|
{
|
||||||
var collidableComponent = Owner.GetComponent<ICollidableComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
ICollidableComponent entityCollidableComponent;
|
if (entity.TryGetComponent(out IPhysicsComponent entityPhysicsComponent))
|
||||||
if (entity.TryGetComponent(out entityCollidableComponent))
|
|
||||||
{
|
{
|
||||||
if(MaxSize < entityCollidableComponent.WorldAABB.Size.X
|
if(MaxSize < entityPhysicsComponent.WorldAABB.Size.X
|
||||||
|| MaxSize < entityCollidableComponent.WorldAABB.Size.Y)
|
|| MaxSize < entityPhysicsComponent.WorldAABB.Size.Y)
|
||||||
{
|
{
|
||||||
return false;
|
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))
|
if (Contents.CanInsert(entity))
|
||||||
@@ -268,9 +267,9 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
}
|
}
|
||||||
Contents.Insert(entity);
|
Contents.Insert(entity);
|
||||||
entity.Transform.WorldPosition = worldPos;
|
entity.Transform.WorldPosition = worldPos;
|
||||||
if (entityCollidableComponent != null)
|
if (entityPhysicsComponent != null)
|
||||||
{
|
{
|
||||||
entityCollidableComponent.CanCollide = false;
|
entityPhysicsComponent.CanCollide = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -283,9 +282,9 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
{
|
{
|
||||||
if(Contents.Remove(contained))
|
if(Contents.Remove(contained))
|
||||||
{
|
{
|
||||||
if (contained.TryGetComponent<ICollidableComponent>(out var entityCollidableComponent))
|
if (contained.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
entityCollidableComponent.CanCollide = true;
|
physics.CanCollide = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent physics) &&
|
if (Owner.TryGetComponent(out IPhysicsComponent physics) &&
|
||||||
physics.Anchored)
|
physics.Anchored)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ namespace Content.Server.GameObjects.Components.Mobs.State
|
|||||||
|
|
||||||
EntitySystem.Get<StandingStateSystem>().Down(entity);
|
EntitySystem.Get<StandingStateSystem>().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<StandingStateSystem>().Standing(entity);
|
EntitySystem.Get<StandingStateSystem>().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))
|
if (entity.TryGetComponent(out ServerOverlayEffectsComponent overlay))
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// This component requires a collidable component.
|
// This component requires a physics component.
|
||||||
Owner.EnsureComponent<CollidableComponent>();
|
Owner.EnsureComponent<PhysicsComponent>();
|
||||||
|
|
||||||
EntitySystem.Get<AiSystem>().ProcessorInitialize(this);
|
EntitySystem.Get<AiSystem>().ProcessorInitialize(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
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<DoAfterSystem>();
|
_doAfterSystem = EntitySystem.Get<DoAfterSystem>();
|
||||||
@@ -178,7 +178,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
|
|
||||||
var result = await _doAfterSystem.DoAfter(doAfterEventArgs);
|
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 direction = (Owner.Transform.WorldPosition - entityToMove.Transform.WorldPosition).Normalized;
|
||||||
var endPoint = Owner.Transform.WorldPosition;
|
var endPoint = Owner.Transform.WorldPosition;
|
||||||
@@ -220,7 +220,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
|
|
||||||
var result = await _doAfterSystem.DoAfter(doAfterEventArgs);
|
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 direction = (Owner.Transform.WorldPosition - user.Transform.WorldPosition).Normalized;
|
||||||
var endPoint = Owner.Transform.WorldPosition;
|
var endPoint = Owner.Transform.WorldPosition;
|
||||||
|
|||||||
@@ -69,15 +69,15 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
_entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
_entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||||
{
|
{
|
||||||
//TODO: Switch to shuttle component
|
//TODO: Switch to shuttle component
|
||||||
if (!gridEntity.TryGetComponent(out ICollidableComponent? collidable))
|
if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
collidable = gridEntity.AddComponent<CollidableComponent>();
|
physics = gridEntity.AddComponent<PhysicsComponent>();
|
||||||
collidable.Mass = 1;
|
physics.Mass = 1;
|
||||||
collidable.CanCollide = true;
|
physics.CanCollide = true;
|
||||||
collidable.PhysicsShapes.Add(new PhysShapeGrid(grid));
|
physics.PhysicsShapes.Add(new PhysShapeGrid(grid));
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = collidable.EnsureController<ShuttleController>();
|
var controller = physics.EnsureController<ShuttleController>();
|
||||||
controller.Push(CalcNewVelocity(direction, enabled), CurrentWalkSpeed);
|
controller.Push(CalcNewVelocity(direction, enabled), CurrentWalkSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool Connectable => !_deleting && Anchored;
|
private bool Connectable => !_deleting && Anchored;
|
||||||
|
|
||||||
private bool Anchored => !Owner.TryGetComponent<ICollidableComponent>(out var collidable) || collidable.Anchored;
|
private bool Anchored => !Owner.TryGetComponent<IPhysicsComponent>(out var physics) || physics.Anchored;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents a node from being used by other nodes while midway through removal.
|
/// 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();
|
TryAssignGroupIfNeeded();
|
||||||
CombineGroupWithReachable();
|
CombineGroupWithReachable();
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
AnchorUpdate();
|
AnchorUpdate();
|
||||||
collidable.AnchoredChanged += AnchorUpdate;
|
physics.AnchoredChanged += AnchorUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnContainerRemove()
|
public void OnContainerRemove()
|
||||||
{
|
{
|
||||||
_deleting = true;
|
_deleting = true;
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
collidable.AnchoredChanged -= AnchorUpdate;
|
physics.AnchoredChanged -= AnchorUpdate;
|
||||||
}
|
}
|
||||||
NodeGroup.RemoveNode(this);
|
NodeGroup.RemoveNode(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
{
|
{
|
||||||
// Added this component to avoid stacking portals and causing shenanigans
|
// Added this component to avoid stacking portals and causing shenanigans
|
||||||
// TODO: Doesn't do a great job of stopping stacking portals for directed
|
// TODO: Doesn't do a great job of stopping stacking portals for directed
|
||||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<TeleporterComponent>())
|
if (entity.HasComponent<IPhysicsComponent>() || entity.HasComponent<TeleporterComponent>())
|
||||||
{
|
{
|
||||||
return;
|
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.
|
// 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))
|
foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(user.Transform.MapID, target))
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<PortalComponent>())
|
if (entity.HasComponent<IPhysicsComponent>() || entity.HasComponent<PortalComponent>())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Connectable => Anchored;
|
public bool Connectable => Anchored;
|
||||||
|
|
||||||
private bool Anchored => !Owner.TryGetComponent<ICollidableComponent>(out var collidable) || collidable.Anchored;
|
private bool Anchored => !Owner.TryGetComponent<IPhysicsComponent>(out var physics) || physics.Anchored;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool NeedsProvider { get; private set; } = true;
|
public bool NeedsProvider { get; private set; } = true;
|
||||||
@@ -92,18 +92,18 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
|||||||
{
|
{
|
||||||
TryFindAndSetProvider();
|
TryFindAndSetProvider();
|
||||||
}
|
}
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
AnchorUpdate();
|
AnchorUpdate();
|
||||||
collidable.AnchoredChanged += AnchorUpdate;
|
physics.AnchoredChanged += AnchorUpdate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
collidable.AnchoredChanged -= AnchorUpdate;
|
physics.AnchoredChanged -= AnchorUpdate;
|
||||||
}
|
}
|
||||||
_provider.RemoveReceiver(this);
|
_provider.RemoveReceiver(this);
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is so entities that shouldn't get a collision are ignored.
|
// 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;
|
_deleteOnCollide = false;
|
||||||
return;
|
return;
|
||||||
@@ -103,9 +103,9 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent)
|
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);
|
recoilComponent.Kick(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
void ICollideBehavior.CollideWith(IEntity entity)
|
void ICollideBehavior.CollideWith(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!_shouldCollide) return;
|
if (!_shouldCollide) return;
|
||||||
if (entity.TryGetComponent(out CollidableComponent collid))
|
if (entity.TryGetComponent(out PhysicsComponent collid))
|
||||||
{
|
{
|
||||||
if (!collid.Hard) // ignore non hard
|
if (!collid.Hard) // ignore non hard
|
||||||
return;
|
return;
|
||||||
@@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
// after impacting the first object.
|
// after impacting the first object.
|
||||||
// For realism this should actually be changed when the velocity of the object is less than a threshold.
|
// 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.
|
// 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;
|
_shouldCollide = false;
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
return;
|
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;
|
body.PhysicsShapes[0].CollisionMask &= (int) ~CollisionGroup.ThrownItem;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
|
|
||||||
public void StartThrow(Vector2 direction, float speed)
|
public void StartThrow(Vector2 direction, float speed)
|
||||||
{
|
{
|
||||||
var comp = Owner.GetComponent<ICollidableComponent>();
|
var comp = Owner.GetComponent<IPhysicsComponent>();
|
||||||
comp.Status = BodyStatus.InAir;
|
comp.Status = BodyStatus.InAir;
|
||||||
|
|
||||||
var controller = comp.EnsureController<ThrownController>();
|
var controller = comp.EnsureController<ThrownController>();
|
||||||
@@ -125,7 +125,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
Owner.EnsureComponent<CollidableComponent>().EnsureController<ThrownController>();
|
Owner.EnsureComponent<PhysicsComponent>().EnsureController<ThrownController>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ namespace Content.Server.GameObjects.Components.Recycling
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ICollidableComponent collidable) ||
|
if (!entity.TryGetComponent(out IPhysicsComponent physics) ||
|
||||||
collidable.Anchored)
|
physics.Anchored)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -170,9 +170,9 @@ namespace Content.Server.GameObjects.Components.Recycling
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out ICollidableComponent collidable))
|
if (entity.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
var controller = collidable.EnsureController<ConveyedController>();
|
var controller = physics.EnsureController<ConveyedController>();
|
||||||
controller.Move(direction, frameTime);
|
controller.Move(direction, frameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace Content.Server.GameObjects.Components.Rotatable
|
|||||||
|
|
||||||
private void TryFlip(IEntity user)
|
private void TryFlip(IEntity user)
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent(out ICollidableComponent? collidable) &&
|
if (Owner.TryGetComponent(out IPhysicsComponent? physics) &&
|
||||||
collidable.Anchored)
|
physics.Anchored)
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, Loc.GetString("It's stuck."));
|
Owner.PopupMessage(user, Loc.GetString("It's stuck."));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ namespace Content.Server.GameObjects.Components.Rotatable
|
|||||||
|
|
||||||
private void TryRotate(IEntity user, Angle angle)
|
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."));
|
Owner.PopupMessage(user, Loc.GetString("It's stuck."));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Temperature
|
|||||||
[ViewVariables] public float HeatCapacity {
|
[ViewVariables] public float HeatCapacity {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var physics))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
return SpecificHeat * physics.Mass;
|
return SpecificHeat * physics.Mass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,15 +389,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
projectileAngle = angle;
|
projectileAngle = angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collidableComponent = projectile.GetComponent<ICollidableComponent>();
|
var physics = projectile.GetComponent<IPhysicsComponent>();
|
||||||
collidableComponent.Status = BodyStatus.InAir;
|
physics.Status = BodyStatus.InAir;
|
||||||
projectile.Transform.WorldPosition = Owner.Transform.MapPosition.Position;
|
projectile.Transform.WorldPosition = Owner.Transform.MapPosition.Position;
|
||||||
|
|
||||||
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
|
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
|
||||||
projectileComponent.IgnoreEntity(shooter);
|
projectileComponent.IgnoreEntity(shooter);
|
||||||
|
|
||||||
projectile
|
projectile
|
||||||
.GetComponent<ICollidableComponent>()
|
.GetComponent<IPhysicsComponent>()
|
||||||
.EnsureController<BulletController>()
|
.EnsureController<BulletController>()
|
||||||
.LinearVelocity = projectileAngle.ToVec() * velocity;
|
.LinearVelocity = projectileAngle.ToVec() * velocity;
|
||||||
|
|
||||||
|
|||||||
@@ -165,9 +165,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
|||||||
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
||||||
|
|
||||||
var collisionMask = 0;
|
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 access = AccessReader.FindAccessTags(entity);
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
|||||||
public static ReachableArgs GetArgs(IEntity entity)
|
public static ReachableArgs GetArgs(IEntity entity)
|
||||||
{
|
{
|
||||||
var collisionMask = 0;
|
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 access = AccessReader.FindAccessTags(entity);
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
GenerateMask();
|
GenerateMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsRelevant(IEntity entity, ICollidableComponent collidableComponent)
|
public static bool IsRelevant(IEntity entity, IPhysicsComponent physicsComponent)
|
||||||
{
|
{
|
||||||
if (entity.Transform.GridID == GridId.Invalid ||
|
if (entity.Transform.GridID == GridId.Invalid ||
|
||||||
(PathfindingSystem.TrackedCollisionLayers & collidableComponent.CollisionLayer) == 0)
|
(PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
/// TODO: These 2 methods currently don't account for a bunch of changes (e.g. airlock unpowered, wrenching, etc.)
|
/// 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.
|
/// 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 we're a door
|
||||||
if (entity.HasComponent<AirlockComponent>() || entity.HasComponent<ServerDoorComponent>())
|
if (entity.HasComponent<AirlockComponent>() || entity.HasComponent<ServerDoorComponent>())
|
||||||
@@ -274,15 +274,15 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
return;
|
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
|
else
|
||||||
{
|
{
|
||||||
_blockedCollidables.Add(entity, collidableComponent.CollisionLayer);
|
_blockedCollidables.Add(entity, physicsComponent.CollisionLayer);
|
||||||
GenerateMask();
|
GenerateMask();
|
||||||
ParentChunk.Dirty();
|
ParentChunk.Dirty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
{
|
{
|
||||||
if (entity.Deleted ||
|
if (entity.Deleted ||
|
||||||
_lastKnownPositions.ContainsKey(entity) ||
|
_lastKnownPositions.ContainsKey(entity) ||
|
||||||
!entity.TryGetComponent(out ICollidableComponent collidableComponent) ||
|
!entity.TryGetComponent(out IPhysicsComponent physics) ||
|
||||||
!PathfindingNode.IsRelevant(entity, collidableComponent))
|
!PathfindingNode.IsRelevant(entity, physics))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
|
|
||||||
var chunk = GetChunk(tileRef);
|
var chunk = GetChunk(tileRef);
|
||||||
var node = chunk.GetNode(tileRef);
|
var node = chunk.GetNode(tileRef);
|
||||||
node.AddEntity(entity, collidableComponent);
|
node.AddEntity(entity, physics);
|
||||||
_lastKnownPositions.Add(entity, node);
|
_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 we've moved to space or the likes then remove us.
|
||||||
if (moveEvent.Sender.Deleted ||
|
if (moveEvent.Sender.Deleted ||
|
||||||
!moveEvent.Sender.TryGetComponent(out ICollidableComponent collidableComponent) ||
|
!moveEvent.Sender.TryGetComponent(out IPhysicsComponent physics) ||
|
||||||
!PathfindingNode.IsRelevant(moveEvent.Sender, collidableComponent))
|
!PathfindingNode.IsRelevant(moveEvent.Sender, physics))
|
||||||
{
|
{
|
||||||
HandleEntityRemove(moveEvent.Sender);
|
HandleEntityRemove(moveEvent.Sender);
|
||||||
return;
|
return;
|
||||||
@@ -350,7 +350,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
_lastKnownPositions[moveEvent.Sender] = newNode;
|
_lastKnownPositions[moveEvent.Sender] = newNode;
|
||||||
|
|
||||||
oldNode.RemoveEntity(moveEvent.Sender);
|
oldNode.RemoveEntity(moveEvent.Sender);
|
||||||
newNode.AddEntity(moveEvent.Sender, collidableComponent);
|
newNode.AddEntity(moveEvent.Sender, physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QueueCollisionChangeMessage(CollisionChangeMessage collisionMessage)
|
private void QueueCollisionChangeMessage(CollisionChangeMessage collisionMessage)
|
||||||
@@ -371,8 +371,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
|
|
||||||
public bool CanTraverse(IEntity entity, PathfindingNode node)
|
public bool CanTraverse(IEntity entity, PathfindingNode node)
|
||||||
{
|
{
|
||||||
if (entity.TryGetComponent(out ICollidableComponent collidableComponent) &&
|
if (entity.TryGetComponent(out IPhysicsComponent physics) &&
|
||||||
(collidableComponent.CollisionMask & node.BlockedCollisionMask) != 0)
|
(physics.CollisionMask & node.BlockedCollisionMask) != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,9 +417,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
var startTile = gridManager.GetTileRef(entity.Transform.Coordinates);
|
var startTile = gridManager.GetTileRef(entity.Transform.Coordinates);
|
||||||
var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid);
|
var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid);
|
||||||
var collisionMask = 0;
|
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 access = AccessReader.FindAccessTags(entity);
|
||||||
@@ -603,10 +603,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
return Vector2.Zero;
|
return Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.TryGetComponent(out ICollidableComponent collidable))
|
if (target.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
var targetDistance = (targetPos.Position - entityPos.Position);
|
var targetDistance = (targetPos.Position - entityPos.Position);
|
||||||
targetPos = targetPos.Offset(collidable.LinearVelocity * targetDistance);
|
targetPos = targetPos.Offset(physics.LinearVelocity * targetDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (targetPos.Position - entityPos.Position).Normalized;
|
return (targetPos.Position - entityPos.Position).Normalized;
|
||||||
@@ -621,7 +621,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Vector2 CollisionAvoidance(IEntity entity, Vector2 direction, ICollection<IEntity> ignoredTargets)
|
private Vector2 CollisionAvoidance(IEntity entity, Vector2 direction, ICollection<IEntity> ignoredTargets)
|
||||||
{
|
{
|
||||||
if (direction == Vector2.Zero || !entity.TryGetComponent(out ICollidableComponent collidableComponent))
|
if (direction == Vector2.Zero || !entity.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
return Vector2.Zero;
|
return Vector2.Zero;
|
||||||
}
|
}
|
||||||
@@ -629,7 +629,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
// We'll check tile-by-tile
|
// We'll check tile-by-tile
|
||||||
// Rewriting this frequently so not many comments as they'll go stale
|
// Rewriting this frequently so not many comments as they'll go stale
|
||||||
// I realise this is bad so please rewrite it ;-;
|
// I realise this is bad so please rewrite it ;-;
|
||||||
var entityCollisionMask = collidableComponent.CollisionMask;
|
var entityCollisionMask = physics.CollisionMask;
|
||||||
var avoidanceVector = Vector2.Zero;
|
var avoidanceVector = Vector2.Zero;
|
||||||
var checkTiles = new HashSet<TileRef>();
|
var checkTiles = new HashSet<TileRef>();
|
||||||
var avoidTiles = new HashSet<TileRef>();
|
var avoidTiles = new HashSet<TileRef>();
|
||||||
@@ -662,8 +662,8 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
// if we're moving in the same direction then ignore
|
// 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
|
// 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
|
// i.e. towards the right
|
||||||
if (physicsEntity.TryGetComponent(out ICollidableComponent collidable) &&
|
if (physicsEntity.TryGetComponent(out IPhysicsComponent otherPhysics) &&
|
||||||
Vector2.Dot(collidable.LinearVelocity, direction) > 0)
|
Vector2.Dot(otherPhysics.LinearVelocity, direction) > 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,13 +288,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pull.Owner.TryGetComponent(out ICollidableComponent collidable) ||
|
if (!pull.Owner.TryGetComponent(out IPhysicsComponent physics) ||
|
||||||
collidable.Anchored)
|
physics.Anchored)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = collidable.EnsureController<PullController>();
|
var controller = physics.EnsureController<PullController>();
|
||||||
|
|
||||||
if (controller.GettingPulled)
|
if (controller.GettingPulled)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, ICollidableComponent>())
|
foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>())
|
||||||
{
|
{
|
||||||
var entity = moverComponent.Owner;
|
var entity = moverComponent.Owner;
|
||||||
if (_pauseManager.IsEntityPaused(entity))
|
if (_pauseManager.IsEntityPaused(entity))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UpdateKinematics(entity.Transform, moverComponent, collidableComponent);
|
UpdateKinematics(entity.Transform, moverComponent, physics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
ev.Entity.RemoveComponent<PlayerInputMoverComponent>();
|
ev.Entity.RemoveComponent<PlayerInputMoverComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev.Entity.TryGetComponent(out ICollidableComponent? physics) &&
|
if (ev.Entity.TryGetComponent(out IPhysicsComponent? physics) &&
|
||||||
physics.TryGetController(out MoverController controller))
|
physics.TryGetController(out MoverController controller))
|
||||||
{
|
{
|
||||||
controller.StopMoving();
|
controller.StopMoving();
|
||||||
|
|||||||
@@ -37,35 +37,35 @@ namespace Content.Server.GlobalVerbs
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!user.HasComponent<ISharedHandsComponent>() ||
|
if (!user.HasComponent<ISharedHandsComponent>() ||
|
||||||
!user.TryGetComponent(out ICollidableComponent userCollidable) ||
|
!user.TryGetComponent(out IPhysicsComponent userPhysics) ||
|
||||||
!target.TryGetComponent(out ICollidableComponent targetCollidable) ||
|
!target.TryGetComponent(out IPhysicsComponent targetPhysics) ||
|
||||||
targetCollidable.Anchored)
|
targetPhysics.Anchored)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = targetCollidable.EnsureController<PullController>();
|
var controller = targetPhysics.EnsureController<PullController>();
|
||||||
|
|
||||||
data.Visibility = VerbVisibility.Visible;
|
data.Visibility = VerbVisibility.Visible;
|
||||||
data.Text = controller.Puller == userCollidable
|
data.Text = controller.Puller == userPhysics
|
||||||
? Loc.GetString("Stop pulling")
|
? Loc.GetString("Stop pulling")
|
||||||
: Loc.GetString("Pull");
|
: Loc.GetString("Pull");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(IEntity user, IEntity target)
|
public override void Activate(IEntity user, IEntity target)
|
||||||
{
|
{
|
||||||
if (!user.TryGetComponent(out ICollidableComponent userCollidable) ||
|
if (!user.TryGetComponent(out IPhysicsComponent userPhysics) ||
|
||||||
!target.TryGetComponent(out ICollidableComponent targetCollidable) ||
|
!target.TryGetComponent(out IPhysicsComponent targetPhysics) ||
|
||||||
targetCollidable.Anchored ||
|
targetPhysics.Anchored ||
|
||||||
!target.TryGetComponent(out PullableComponent pullable) ||
|
!target.TryGetComponent(out PullableComponent pullable) ||
|
||||||
!user.TryGetComponent(out HandsComponent hands))
|
!user.TryGetComponent(out HandsComponent hands))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = targetCollidable.EnsureController<PullController>();
|
var controller = targetPhysics.EnsureController<PullController>();
|
||||||
|
|
||||||
if (controller.Puller == userCollidable)
|
if (controller.Puller == userPhysics)
|
||||||
{
|
{
|
||||||
hands.StopPull();
|
hands.StopPull();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.Server.Throw
|
|||||||
/// </param>
|
/// </param>
|
||||||
public static void Throw(IEntity thrownEnt, float throwForce, EntityCoordinates targetLoc, EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null)
|
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;
|
return;
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
@@ -84,7 +84,7 @@ namespace Content.Server.Throw
|
|||||||
projComp.StartThrow(angle.ToVec(), spd);
|
projComp.StartThrow(angle.ToVec(), spd);
|
||||||
|
|
||||||
if (throwSourceEnt != null &&
|
if (throwSourceEnt != null &&
|
||||||
throwSourceEnt.TryGetComponent<ICollidableComponent>(out var physics) &&
|
throwSourceEnt.TryGetComponent<IPhysicsComponent>(out var physics) &&
|
||||||
physics.TryGetController(out MoverController mover))
|
physics.TryGetController(out MoverController mover))
|
||||||
{
|
{
|
||||||
var physicsMgr = IoCManager.Resolve<IPhysicsManager>();
|
var physicsMgr = IoCManager.Resolve<IPhysicsManager>();
|
||||||
@@ -139,9 +139,9 @@ namespace Content.Server.Throw
|
|||||||
|
|
||||||
var throwDuration = ThrownItemComponent.DefaultThrowTime;
|
var throwDuration = ThrownItemComponent.DefaultThrowTime;
|
||||||
var mass = 1f;
|
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;
|
var velocityNecessary = distance / throwDuration;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
collidable.Anchored;
|
physics.Anchored;
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum Visuals
|
public enum Visuals
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Items
|
|||||||
public sealed override uint? NetID => ContentNetIDs.HANDS;
|
public sealed override uint? NetID => ContentNetIDs.HANDS;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public ICollidableComponent? PulledObject { get; protected set; }
|
public IPhysicsComponent? PulledObject { get; protected set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
protected bool IsPulling => PulledObject != null;
|
protected bool IsPulling => PulledObject != null;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
public sealed override string Name => "Climbing";
|
public sealed override string Name => "Climbing";
|
||||||
public sealed override uint? NetID => ContentNetIDs.CLIMBING;
|
public sealed override uint? NetID => ContentNetIDs.CLIMBING;
|
||||||
|
|
||||||
protected ICollidableComponent Body;
|
protected IPhysicsComponent Body;
|
||||||
protected bool IsOnClimbableThisFrame = false;
|
protected bool IsOnClimbableThisFrame = false;
|
||||||
|
|
||||||
protected bool OwnerIsTransitioning
|
protected bool OwnerIsTransitioning
|
||||||
|
|||||||
@@ -144,11 +144,11 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnAdd()
|
public override void OnAdd()
|
||||||
{
|
{
|
||||||
// This component requires that the entity has a CollidableComponent.
|
// This component requires that the entity has a IPhysicsComponent.
|
||||||
if (!Owner.HasComponent<ICollidableComponent>())
|
if (!Owner.HasComponent<IPhysicsComponent>())
|
||||||
Logger.Error(
|
Logger.Error(
|
||||||
$"[ECS] {Owner.Prototype?.Name} - {nameof(SharedPlayerInputMoverComponent)} requires" +
|
$"[ECS] {Owner.Prototype?.Name} - {nameof(SharedPlayerInputMoverComponent)} requires" +
|
||||||
$" {nameof(ICollidableComponent)}. ");
|
$" {nameof(IPhysicsComponent)}. ");
|
||||||
|
|
||||||
base.OnAdd();
|
base.OnAdd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
|| ContainerHelpers.IsInContainer(Owner)
|
|| ContainerHelpers.IsInContainer(Owner)
|
||||||
|| _slipped.Contains(entity.Uid)
|
|| _slipped.Contains(entity.Uid)
|
||||||
|| !entity.TryGetComponent(out SharedStunnableComponent stun)
|
|| !entity.TryGetComponent(out SharedStunnableComponent stun)
|
||||||
|| !entity.TryGetComponent(out ICollidableComponent otherBody)
|
|| !entity.TryGetComponent(out IPhysicsComponent otherBody)
|
||||||
|| !Owner.TryGetComponent(out ICollidableComponent body))
|
|| !Owner.TryGetComponent(out IPhysicsComponent body))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -85,10 +85,10 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out ICollidableComponent collidable))
|
if (entity.TryGetComponent(out IPhysicsComponent physics))
|
||||||
{
|
{
|
||||||
var controller = collidable.EnsureController<SlipController>();
|
var controller = physics.EnsureController<SlipController>();
|
||||||
controller.LinearVelocity = collidable.LinearVelocity * LaunchForwardsMultiplier;
|
controller.LinearVelocity = physics.LinearVelocity * LaunchForwardsMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
stun.Paralyze(5);
|
stun.Paralyze(5);
|
||||||
@@ -117,10 +117,10 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(uid);
|
var entity = _entityManager.GetEntity(uid);
|
||||||
var collidable = Owner.GetComponent<ICollidableComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
var otherCollidable = entity.GetComponent<ICollidableComponent>();
|
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||||
|
|
||||||
if (!collidable.WorldAABB.Intersects(otherCollidable.WorldAABB))
|
if (!physics.WorldAABB.Intersects(otherPhysics.WorldAABB))
|
||||||
{
|
{
|
||||||
_slipped.Remove(uid);
|
_slipped.Remove(uid);
|
||||||
}
|
}
|
||||||
@@ -131,11 +131,11 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
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)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.Portal
|
|||||||
{
|
{
|
||||||
base.OnAdd();
|
base.OnAdd();
|
||||||
|
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
if (Owner.TryGetComponent<IPhysicsComponent>(out var physics))
|
||||||
{
|
{
|
||||||
collidable.Hard = false;
|
physics.Hard = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
|
|||||||
|
|
||||||
public GameTick LastUpdate { get; private set; }
|
public GameTick LastUpdate { get; private set; }
|
||||||
|
|
||||||
public GasOverlayChunk(GridId gridIndices, Vector2i Vector2i)
|
public GasOverlayChunk(GridId gridIndices, Vector2i vector2i)
|
||||||
{
|
{
|
||||||
GridIndices = gridIndices;
|
GridIndices = gridIndices;
|
||||||
Vector2i = Vector2i;
|
Vector2i = vector2i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dirty(GameTick currentTick)
|
public void Dirty(GameTick currentTick)
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, ICollidableComponent collidable)
|
protected void UpdateKinematics(ITransformComponent transform, IMoverComponent mover, IPhysicsComponent physics)
|
||||||
{
|
{
|
||||||
collidable.EnsureController<MoverController>();
|
physics.EnsureController<MoverController>();
|
||||||
|
|
||||||
var weightless = !transform.Owner.HasComponent<MovementIgnoreGravityComponent>() &&
|
var weightless = !transform.Owner.HasComponent<MovementIgnoreGravityComponent>() &&
|
||||||
_physicsManager.IsWeightless(transform.Coordinates);
|
_physicsManager.IsWeightless(transform.Coordinates);
|
||||||
@@ -62,7 +62,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
if (weightless)
|
if (weightless)
|
||||||
{
|
{
|
||||||
// No gravity: is our entity touching anything?
|
// No gravity: is our entity touching anything?
|
||||||
var touching = IsAroundCollider(transform, mover, collidable);
|
var touching = IsAroundCollider(transform, mover, physics);
|
||||||
|
|
||||||
if (!touching)
|
if (!touching)
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
var combined = walkDir + sprintDir;
|
var combined = walkDir + sprintDir;
|
||||||
if (combined.LengthSquared < 0.001 || !ActionBlockerSystem.CanMove(mover.Owner) && !weightless)
|
if (combined.LengthSquared < 0.001 || !ActionBlockerSystem.CanMove(mover.Owner) && !weightless)
|
||||||
{
|
{
|
||||||
if (collidable.TryGetController(out MoverController controller))
|
if (physics.TryGetController(out MoverController controller))
|
||||||
{
|
{
|
||||||
controller.StopMoving();
|
controller.StopMoving();
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
if (weightless)
|
if (weightless)
|
||||||
{
|
{
|
||||||
if (collidable.TryGetController(out MoverController controller))
|
if (physics.TryGetController(out MoverController controller))
|
||||||
{
|
{
|
||||||
controller.Push(combined, mover.CurrentPushSpeed);
|
controller.Push(combined, mover.CurrentPushSpeed);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
var total = walkDir * mover.CurrentWalkSpeed + sprintDir * mover.CurrentSprintSpeed;
|
var total = walkDir * mover.CurrentWalkSpeed + sprintDir * mover.CurrentSprintSpeed;
|
||||||
|
|
||||||
{
|
{
|
||||||
if (collidable.TryGetController(out MoverController controller))
|
if (physics.TryGetController(out MoverController controller))
|
||||||
{
|
{
|
||||||
controller.Move(total, 1);
|
controller.Move(total, 1);
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool IsAroundCollider(ITransformComponent transform, IMoverComponent mover,
|
private bool IsAroundCollider(ITransformComponent transform, IMoverComponent mover,
|
||||||
ICollidableComponent collider)
|
IPhysicsComponent collider)
|
||||||
{
|
{
|
||||||
foreach (var entity in _entityManager.GetEntitiesInRange(transform.Owner, mover.GrabRange, true))
|
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!
|
continue; // Don't try to push off of yourself!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent<ICollidableComponent>(out var otherCollider))
|
if (!entity.TryGetComponent<IPhysicsComponent>(out var otherCollider))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Physics
|
|||||||
{
|
{
|
||||||
public class BulletController : VirtualController
|
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)
|
public void Push(Vector2 velocityDirection, float speed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Physics
|
|||||||
{
|
{
|
||||||
public class ConveyedController : VirtualController
|
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)
|
public void Move(Vector2 velocityDirection, float speed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Shared.Physics
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
|
[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)
|
public void Move(Vector2 velocityDirection, float speed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ namespace Content.Shared.Physics.Pull
|
|||||||
|
|
||||||
private const float DistBeforeStopPull = SharedInteractionSystem.InteractionRange;
|
private const float DistBeforeStopPull = SharedInteractionSystem.InteractionRange;
|
||||||
|
|
||||||
private ICollidableComponent? _puller;
|
private IPhysicsComponent? _puller;
|
||||||
|
|
||||||
public bool GettingPulled => _puller != null;
|
public bool GettingPulled => _puller != null;
|
||||||
|
|
||||||
private EntityCoordinates? _movingTo;
|
private EntityCoordinates? _movingTo;
|
||||||
|
|
||||||
public ICollidableComponent? Puller => _puller;
|
public IPhysicsComponent? Puller => _puller;
|
||||||
|
|
||||||
public void StartPull(ICollidableComponent puller)
|
public void StartPull(IPhysicsComponent puller)
|
||||||
{
|
{
|
||||||
DebugTools.AssertNotNull(puller);
|
DebugTools.AssertNotNull(puller);
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ namespace Content.Shared.Physics.Pull
|
|||||||
public class PullMessage : ComponentMessage
|
public class PullMessage : ComponentMessage
|
||||||
{
|
{
|
||||||
public readonly PullController Controller;
|
public readonly PullController Controller;
|
||||||
public readonly ICollidableComponent Puller;
|
public readonly IPhysicsComponent Puller;
|
||||||
public readonly ICollidableComponent Pulled;
|
public readonly IPhysicsComponent Pulled;
|
||||||
|
|
||||||
protected PullMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled)
|
protected PullMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled)
|
||||||
{
|
{
|
||||||
Controller = controller;
|
Controller = controller;
|
||||||
Puller = puller;
|
Puller = puller;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Content.Shared.Physics.Pull
|
|||||||
{
|
{
|
||||||
public class PullStartedMessage : PullMessage
|
public class PullStartedMessage : PullMessage
|
||||||
{
|
{
|
||||||
public PullStartedMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled) :
|
public PullStartedMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled) :
|
||||||
base(controller, puller, pulled)
|
base(controller, puller, pulled)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Content.Shared.Physics.Pull
|
|||||||
{
|
{
|
||||||
public class PullStoppedMessage : PullMessage
|
public class PullStoppedMessage : PullMessage
|
||||||
{
|
{
|
||||||
public PullStoppedMessage(PullController controller, ICollidableComponent puller, ICollidableComponent pulled) :
|
public PullStoppedMessage(PullController controller, IPhysicsComponent puller, IPhysicsComponent pulled) :
|
||||||
base(controller, puller, pulled)
|
base(controller, puller, pulled)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Physics
|
|||||||
{
|
{
|
||||||
public class ShuttleController : VirtualController
|
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)
|
public void Push(Vector2 velocityDirection, float speed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Physics
|
|||||||
{
|
{
|
||||||
public class ThrownController : VirtualController
|
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)
|
public void Push(Vector2 velocityDirection, float speed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
sprite: Mobs/Animals/monkey.rsi
|
sprite: Mobs/Animals/monkey.rsi
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 50
|
mass: 50
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
state: crawling
|
state: crawling
|
||||||
sprite: Mobs/Animals/gorilla.rsi
|
sprite: Mobs/Animals/gorilla.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 90
|
mass: 90
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -111,6 +113,7 @@
|
|||||||
state: chicken-0
|
state: chicken-0
|
||||||
sprite: Mobs/Animals/chicken.rsi
|
sprite: Mobs/Animals/chicken.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 20
|
mass: 20
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -148,6 +151,7 @@
|
|||||||
state: butterfly
|
state: butterfly
|
||||||
sprite: Mobs/Animals/butterfly.rsi
|
sprite: Mobs/Animals/butterfly.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 5
|
mass: 5
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -195,6 +199,7 @@
|
|||||||
state: bat
|
state: bat
|
||||||
sprite: Mobs/Animals/bat.rsi
|
sprite: Mobs/Animals/bat.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 5
|
mass: 5
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -233,6 +238,7 @@
|
|||||||
state: 0
|
state: 0
|
||||||
sprite: Mobs/Animals/bee.rsi
|
sprite: Mobs/Animals/bee.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 5
|
mass: 5
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -267,6 +273,7 @@
|
|||||||
state: goat
|
state: goat
|
||||||
sprite: Mobs/Animals/goat.rsi
|
sprite: Mobs/Animals/goat.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 20
|
mass: 20
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -302,6 +309,7 @@
|
|||||||
state: goose
|
state: goose
|
||||||
sprite: Mobs/Animals/goose.rsi
|
sprite: Mobs/Animals/goose.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 20
|
mass: 20
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -340,6 +348,7 @@
|
|||||||
state: parrot
|
state: parrot
|
||||||
sprite: Mobs/Animals/parrot.rsi
|
sprite: Mobs/Animals/parrot.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 20
|
mass: 20
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -374,6 +383,7 @@
|
|||||||
state: snake
|
state: snake
|
||||||
sprite: Mobs/Animals/snake.rsi
|
sprite: Mobs/Animals/snake.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 10
|
mass: 10
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -411,6 +421,7 @@
|
|||||||
state: tarantula
|
state: tarantula
|
||||||
sprite: Mobs/Animals/spider.rsi
|
sprite: Mobs/Animals/spider.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 10
|
mass: 10
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -445,6 +456,7 @@
|
|||||||
state: crab
|
state: crab
|
||||||
sprite: Mobs/Animals/crab.rsi
|
sprite: Mobs/Animals/crab.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 10
|
mass: 10
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -479,6 +491,7 @@
|
|||||||
state: penguin
|
state: penguin
|
||||||
sprite: Mobs/Animals/penguin.rsi
|
sprite: Mobs/Animals/penguin.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 10
|
mass: 10
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
state: carp
|
state: carp
|
||||||
sprite: Mobs/Aliens/Carps/carp_space.rsi
|
sprite: Mobs/Aliens/Carps/carp_space.rsi
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 50
|
mass: 50
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
sprite: Constructible/Power/VendingMachines/cola.rsi
|
sprite: Constructible/Power/VendingMachines/cola.rsi
|
||||||
state: normal
|
state: normal
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 85
|
mass: 85
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
- type: InteractionOutline
|
- type: InteractionOutline
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 50
|
mass: 50
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
sprite: Mobs/Aliens/Xenos/xeno_hunter.rsi
|
sprite: Mobs/Aliens/Xenos/xeno_hunter.rsi
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 85
|
mass: 85
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: Mind
|
- type: Mind
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 5
|
mass: 5
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -116,6 +116,7 @@
|
|||||||
- map: [ "enum.Slots.MASK" ]
|
- map: [ "enum.Slots.MASK" ]
|
||||||
- map: [ "enum.Slots.HEAD" ]
|
- map: [ "enum.Slots.HEAD" ]
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 85
|
mass: 85
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
@@ -279,6 +280,7 @@
|
|||||||
- map: ["hand-left"]
|
- map: ["hand-left"]
|
||||||
- map: ["hand-right"]
|
- map: ["hand-right"]
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 85
|
mass: 85
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
components:
|
components:
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
bounds: "-0.15,-0.3,0.2,0.3"
|
bounds: "-0.15,-0.3,0.2,0.3"
|
||||||
|
|||||||
@@ -176,6 +176,7 @@
|
|||||||
- state: chempuff
|
- state: chempuff
|
||||||
map: [ "enum.VaporVisualLayers.Base" ]
|
map: [ "enum.VaporVisualLayers.Base" ]
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
hard: false
|
hard: false
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
sprite: Objects/Weapons/Guns/Projectiles/bullet.rsi
|
sprite: Objects/Weapons/Guns/Projectiles/bullet.rsi
|
||||||
state: bullet
|
state: bullet
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
edgeslide: false
|
edgeslide: false
|
||||||
hard: false
|
hard: false
|
||||||
shapes:
|
shapes:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
- type: MovedByPressure
|
- type: MovedByPressure
|
||||||
- type: DamageOnHighSpeedImpact
|
- type: DamageOnHighSpeedImpact
|
||||||
- type: Collidable
|
- type: Collidable
|
||||||
|
anchored: false
|
||||||
mass: 5
|
mass: 5
|
||||||
shapes:
|
shapes:
|
||||||
- !type:PhysShapeAabb
|
- !type:PhysShapeAabb
|
||||||
|
|||||||
Reference in New Issue
Block a user