// Get enumeration exceptions from people dropping things if we just paralyze as we go
var toKnock = new ValueList<EntityUid>();
KnockOverKids(xform, ref toKnock);
+ TryComp<MapGridComponent>(xform.GridUid, out var grid);
if (TryComp<PhysicsComponent>(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);
}
}
}
/// <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)
+ private void TossIfSpaced(MapGridComponent shuttleGrid, PhysicsComponent shuttleBody, EntityUid tossed)
{
-
- if (!_xformQuery.TryGetComponent(tossed, out var childXform))
+ if (!_xformQuery.TryGetComponent(tossed, out var childXform) )
return;
- if (!_physicsQuery.TryGetComponent(tossed, out var phys))
+ // only toss if its on lattice/space
+ var tile = shuttleGrid.GetTileRef(childXform.Coordinates);
+
+ if (!tile.IsSpace(_tileDefManager))
return;
- // only toss if its on lattice/space
- var tile = childXform.Coordinates.GetTileRef(EntityManager, _mapManager);
+ var throwDirection = childXform.LocalPosition - shuttleBody.LocalCenter;
- if (tile != null && tile.Value.IsSpace() && _mapManager.TryGetGrid(tile.Value.GridUid, out var grid))
- {
- Vector2 direction = -Vector2.UnitY;
+ if (throwDirection == Vector2.Zero)
+ return;
- var foo = childXform.LocalPosition - shuttleBody.LocalCenter;
- _throwing.TryThrow(tossed, foo.Normalized() * 10.0f, 50.0f);
- }
+ _throwing.TryThrow(tossed, throwDirection.Normalized() * 10.0f, 50.0f);
}
/// <summary>
return;
// Flatten anything not parented to a grid.
- var xformQuery = GetEntityQuery<TransformComponent>();
- var transform = _physics.GetPhysicsTransform(uid, xform, xformQuery);
+ var transform = _physics.GetPhysicsTransform(uid, xform, _xformQuery);
var aabbs = new List<Box2>(manager.Fixtures.Count);
- var mobQuery = GetEntityQuery<BodyComponent>();
var immune = new HashSet<EntityUid>();
foreach (var fixture in manager.Fixtures.Values)
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);
[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!;
[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!;