diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index a10eddff1b..e9895e89aa 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -19,6 +19,7 @@ using Content.Shared.Buckle.Components; using Content.Shared.Doors.Components; using Content.Shared.Mobs.Components; using Content.Shared.Shuttles.Components; +using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Shared.Map.Components; using Robust.Shared.Physics; @@ -79,6 +80,7 @@ public sealed partial class ShuttleSystem private EntityQuery _bodyQuery; private EntityQuery _buckleQuery; + private EntityQuery _physicsQuery; private EntityQuery _statusQuery; private EntityQuery _xformQuery; @@ -86,6 +88,7 @@ public sealed partial class ShuttleSystem { _bodyQuery = GetEntityQuery(); _buckleQuery = GetEntityQuery(); + _physicsQuery = GetEntityQuery(); _statusQuery = GetEntityQuery(); _xformQuery = GetEntityQuery(); @@ -473,24 +476,21 @@ public sealed partial class ShuttleSystem /// private void DoTheDinosaur(TransformComponent xform) { - // gib anything sitting outside aka on a lattice - // this is done before knocking since why knock down if they are gonna be gibbed too - var toGib = new ValueList<(EntityUid, BodyComponent)>(); - GibKids(xform, ref toGib); - - foreach (var (child, body) in toGib) - { - _bobby.GibBody(child, gibOrgans: false, body); - } - // Get enumeration exceptions from people dropping things if we just paralyze as we go var toKnock = new ValueList(); KnockOverKids(xform, ref toKnock); - foreach (var child in toKnock) + if (TryComp(xform.GridUid, out var shuttleBody)) { - if (!_statusQuery.TryGetComponent(child, out var status)) continue; - _stuns.TryParalyze(child, _hyperspaceKnockdownTime, true, status); + + foreach (var child in toKnock) + { + 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); + } } } @@ -507,25 +507,27 @@ public sealed partial class ShuttleSystem } } - private void GibKids(TransformComponent xform, ref ValueList<(EntityUid, BodyComponent)> toGib) + /// + /// 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) { - // this is not recursive so people hiding in crates are spared, sadly - var childEnumerator = xform.ChildEnumerator; - while (childEnumerator.MoveNext(out var child)) + + if (!_xformQuery.TryGetComponent(tossed, out var childXform)) + return; + + if (!_physicsQuery.TryGetComponent(tossed, out var phys)) + return; + + // only toss if its on lattice/space + var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager); + + if (tile != null && tile.Value.IsSpace() && _mapManager.TryGetGrid(tile.Value.GridUid, out var grid)) { - if (!_xformQuery.TryGetComponent(child.Value, out var childXform)) - continue; + Vector2 direction = -Vector2.UnitY; - // not something that can be gibbed - if (!_bodyQuery.TryGetComponent(child.Value, out var body)) - continue; - - // only gib if its on lattice/space - var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager); - if (tile != null && !tile.Value.IsSpace()) - continue; - - toGib.Add((child.Value, body)); + var foo = childXform.LocalPosition - shuttleBody.LocalCenter; + _throwing.TryThrow(tossed, foo.Normalized() * 10.0f, 50.0f); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index 46eb0fba80..cc93858948 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -6,6 +6,7 @@ using Content.Server.Stunnable; using Content.Shared.GameTicking; using Content.Shared.Mobs.Systems; using Content.Shared.Shuttles.Systems; +using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Configuration; @@ -36,6 +37,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem [Dependency] private readonly ShuttleConsoleSystem _console = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StunSystem _stuns = default!; + [Dependency] private readonly ThrowingSystem _throwing = default!; [Dependency] private readonly ThrusterSystem _thruster = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;