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;
private EntityQuery<BodyComponent> _bodyQuery;
private EntityQuery<BuckleComponent> _buckleQuery;
+ private EntityQuery<PhysicsComponent> _physicsQuery;
private EntityQuery<StatusEffectsComponent> _statusQuery;
private EntityQuery<TransformComponent> _xformQuery;
{
_bodyQuery = GetEntityQuery<BodyComponent>();
_buckleQuery = GetEntityQuery<BuckleComponent>();
+ _physicsQuery = GetEntityQuery<PhysicsComponent>();
_statusQuery = GetEntityQuery<StatusEffectsComponent>();
_xformQuery = GetEntityQuery<TransformComponent>();
/// </summary>
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<EntityUid>();
KnockOverKids(xform, ref toKnock);
- foreach (var child in toKnock)
+ if (TryComp<PhysicsComponent>(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);
+ }
}
}
}
}
- private void GibKids(TransformComponent xform, ref ValueList<(EntityUid, BodyComponent)> toGib)
+ /// <summary>
+ /// Throws people who are standing on a spaced tile, tries to throw them towards a neighbouring space tile
+ /// </summary>
+ 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(child.Value, out var childXform))
- continue;
- // not something that can be gibbed
- if (!_bodyQuery.TryGetComponent(child.Value, out var body))
- continue;
+ if (!_xformQuery.TryGetComponent(tossed, out var childXform))
+ return;
- // only gib if its on lattice/space
- var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager);
- if (tile != null && !tile.Value.IsSpace())
- continue;
+ 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))
+ {
+ Vector2 direction = -Vector2.UnitY;
- toGib.Add((child.Value, body));
+ var foo = childXform.LocalPosition - shuttleBody.LocalCenter;
+ _throwing.TryThrow(tossed, foo.Normalized() * 10.0f, 50.0f);
}
}
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;
[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!;