* Generic offering window * More work * weh * Parity * Progression meter * magnet * rona * PG asteroid work * code red * Asteroid spawnings * clams * a * Marker fixes * More fixes * Workings of biome asteroids * A * Fix this loading code * a * Fix masking * weh * Fixes * Magnet claiming * toe * petogue * magnet * Bunch of fixes * Fix default * Fixes * asteroids * Fix offerings * Localisation and a bunch of fixes * a * Fixes * Preliminary draft * Announcement fixes * Fixes and bump spawn rate * Fix asteroid spawns and UI * More fixes * Expeditions fix * fix * Gravity * Fix announcement rounding * a * Offset tweak * sus * jankass * Fix merge
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Content.Server.Shuttles.Components;
|
|
using Robust.Shared.Physics;
|
|
using Robust.Shared.Physics.Dynamics;
|
|
using Robust.Shared.Physics.Events;
|
|
|
|
namespace Content.Server.Shuttles.Systems;
|
|
|
|
/// <summary>
|
|
/// Deletes anything with <see cref="SpaceGarbageComponent"/> that has a cross-grid collision with a static body.
|
|
/// </summary>
|
|
public sealed class SpaceGarbageSystem : EntitySystem
|
|
{
|
|
private EntityQuery<TransformComponent> _xformQuery;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
_xformQuery = GetEntityQuery<TransformComponent>();
|
|
SubscribeLocalEvent<SpaceGarbageComponent, StartCollideEvent>(OnCollide);
|
|
}
|
|
|
|
private void OnCollide(EntityUid uid, SpaceGarbageComponent component, ref StartCollideEvent args)
|
|
{
|
|
if (args.OtherBody.BodyType != BodyType.Static)
|
|
return;
|
|
|
|
var ourXform = _xformQuery.GetComponent(uid);
|
|
var otherXform = _xformQuery.GetComponent(args.OtherEntity);
|
|
|
|
if (ourXform.GridUid == otherXform.GridUid)
|
|
return;
|
|
|
|
QueueDel(uid);
|
|
}
|
|
}
|