diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index e9895e89aa..49e1b1cb84 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -479,17 +479,20 @@ public sealed partial class ShuttleSystem // Get enumeration exceptions from people dropping things if we just paralyze as we go var toKnock = new ValueList(); KnockOverKids(xform, ref toKnock); + TryComp(xform.GridUid, out var grid); if (TryComp(xform.GridUid, out var shuttleBody)) { - foreach (var child in toKnock) { - if (!_statusQuery.TryGetComponent(child, out var status)) continue; + if (!_statusQuery.TryGetComponent(child, out var status)) + continue; + _stuns.TryParalyze(child, _hyperspaceKnockdownTime, true, status); // If the guy we knocked down is on a spaced tile, throw them too - TossIfSpaced(shuttleBody, child); + if (grid != null) + TossIfSpaced(grid, shuttleBody, child); } } } @@ -510,25 +513,23 @@ public sealed partial class ShuttleSystem /// /// Throws people who are standing on a spaced tile, tries to throw them towards a neighbouring space tile /// - private void TossIfSpaced(PhysicsComponent shuttleBody, EntityUid tossed) + private void TossIfSpaced(MapGridComponent shuttleGrid, PhysicsComponent shuttleBody, EntityUid tossed) { - - if (!_xformQuery.TryGetComponent(tossed, out var childXform)) - return; - - if (!_physicsQuery.TryGetComponent(tossed, out var phys)) + if (!_xformQuery.TryGetComponent(tossed, out var childXform) ) return; // only toss if its on lattice/space - var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager); + var tile = shuttleGrid.GetTileRef(childXform.Coordinates); - if (tile != null && tile.Value.IsSpace() && _mapManager.TryGetGrid(tile.Value.GridUid, out var grid)) - { - Vector2 direction = -Vector2.UnitY; + if (!tile.IsSpace(_tileDefManager)) + return; - var foo = childXform.LocalPosition - shuttleBody.LocalCenter; - _throwing.TryThrow(tossed, foo.Normalized() * 10.0f, 50.0f); - } + var throwDirection = childXform.LocalPosition - shuttleBody.LocalCenter; + + if (throwDirection == Vector2.Zero) + return; + + _throwing.TryThrow(tossed, throwDirection.Normalized() * 10.0f, 50.0f); } /// @@ -694,10 +695,8 @@ public sealed partial class ShuttleSystem return; // Flatten anything not parented to a grid. - var xformQuery = GetEntityQuery(); - var transform = _physics.GetPhysicsTransform(uid, xform, xformQuery); + var transform = _physics.GetPhysicsTransform(uid, xform, _xformQuery); var aabbs = new List(manager.Fixtures.Count); - var mobQuery = GetEntityQuery(); var immune = new HashSet(); foreach (var fixture in manager.Fixtures.Values) @@ -717,7 +716,7 @@ public sealed partial class ShuttleSystem continue; } - if (mobQuery.TryGetComponent(ent, out var mob)) + if (_bodyQuery.TryGetComponent(ent, out var mob)) { var gibs = _bobby.GibBody(ent, body: mob); immune.UnionWith(gibs); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index cc93858948..41e4cbc2be 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -22,8 +22,10 @@ namespace Content.Server.Shuttles.Systems; [UsedImplicitly] public sealed partial class ShuttleSystem : SharedShuttleSystem { + [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; [Dependency] private readonly BodySystem _bobby = default!; [Dependency] private readonly DockingSystem _dockSystem = default!; [Dependency] private readonly DoorSystem _doors = default!; @@ -40,7 +42,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem [Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ThrusterSystem _thruster = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; - [Dependency] private readonly IConfigurationManager _cfg = default!; private ISawmill _sawmill = default!;