FTL on a spaced tile yeets instead of gibs (#19883)
* -Changes gibbing on FTL when on a spaced tile to yeeting on FTL if you're not buckled and on a space tile. * -Throw relative to local shuttle position instead, fine for most cases and more performant -Use throw code to throw. * Blanks removal woops Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ using Content.Shared.Buckle.Components;
|
|||||||
using Content.Shared.Doors.Components;
|
using Content.Shared.Doors.Components;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
|
using Content.Shared.Throwing;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -79,6 +80,7 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
private EntityQuery<BodyComponent> _bodyQuery;
|
private EntityQuery<BodyComponent> _bodyQuery;
|
||||||
private EntityQuery<BuckleComponent> _buckleQuery;
|
private EntityQuery<BuckleComponent> _buckleQuery;
|
||||||
|
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||||
private EntityQuery<StatusEffectsComponent> _statusQuery;
|
private EntityQuery<StatusEffectsComponent> _statusQuery;
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
|
|
||||||
@@ -86,6 +88,7 @@ public sealed partial class ShuttleSystem
|
|||||||
{
|
{
|
||||||
_bodyQuery = GetEntityQuery<BodyComponent>();
|
_bodyQuery = GetEntityQuery<BodyComponent>();
|
||||||
_buckleQuery = GetEntityQuery<BuckleComponent>();
|
_buckleQuery = GetEntityQuery<BuckleComponent>();
|
||||||
|
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||||
_statusQuery = GetEntityQuery<StatusEffectsComponent>();
|
_statusQuery = GetEntityQuery<StatusEffectsComponent>();
|
||||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
|
|
||||||
@@ -473,24 +476,21 @@ public sealed partial class ShuttleSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void DoTheDinosaur(TransformComponent xform)
|
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
|
// Get enumeration exceptions from people dropping things if we just paralyze as we go
|
||||||
var toKnock = new ValueList<EntityUid>();
|
var toKnock = new ValueList<EntityUid>();
|
||||||
KnockOverKids(xform, ref toKnock);
|
KnockOverKids(xform, ref toKnock);
|
||||||
|
|
||||||
|
if (TryComp<PhysicsComponent>(xform.GridUid, out var shuttleBody))
|
||||||
|
{
|
||||||
|
|
||||||
foreach (var child in toKnock)
|
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);
|
_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)
|
/// <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 (!_xformQuery.TryGetComponent(tossed, out var childXform))
|
||||||
if (!_bodyQuery.TryGetComponent(child.Value, out var body))
|
return;
|
||||||
continue;
|
|
||||||
|
|
||||||
// only gib if its on lattice/space
|
if (!_physicsQuery.TryGetComponent(tossed, out var phys))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only toss if its on lattice/space
|
||||||
var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager);
|
var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager);
|
||||||
if (tile != null && !tile.Value.IsSpace())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
toGib.Add((child.Value, body));
|
if (tile != null && tile.Value.IsSpace() && _mapManager.TryGetGrid(tile.Value.GridUid, out var grid))
|
||||||
|
{
|
||||||
|
Vector2 direction = -Vector2.UnitY;
|
||||||
|
|
||||||
|
var foo = childXform.LocalPosition - shuttleBody.LocalCenter;
|
||||||
|
_throwing.TryThrow(tossed, foo.Normalized() * 10.0f, 50.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.Stunnable;
|
|||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Shuttles.Systems;
|
using Content.Shared.Shuttles.Systems;
|
||||||
|
using Content.Shared.Throwing;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
@@ -36,6 +37,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
|||||||
[Dependency] private readonly ShuttleConsoleSystem _console = default!;
|
[Dependency] private readonly ShuttleConsoleSystem _console = default!;
|
||||||
[Dependency] private readonly StationSystem _station = default!;
|
[Dependency] private readonly StationSystem _station = default!;
|
||||||
[Dependency] private readonly StunSystem _stuns = default!;
|
[Dependency] private readonly StunSystem _stuns = default!;
|
||||||
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||||
[Dependency] private readonly ThrusterSystem _thruster = default!;
|
[Dependency] private readonly ThrusterSystem _thruster = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|||||||
Reference in New Issue
Block a user