using Content.Server.Shuttles.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.Shuttles.EntitySystems;
///
/// Deletes anything with that has a cross-grid collision with a static body.
///
public sealed class SpaceGarbageSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnCollide);
}
private void OnCollide(EntityUid uid, SpaceGarbageComponent component, StartCollideEvent args)
{
var ourXform = Transform(args.OurFixture.Body.Owner);
var otherXform = Transform(args.OtherFixture.Body.Owner);
if (ourXform.GridEntityId == otherXform.GridEntityId ||
args.OtherFixture.Body.BodyType != BodyType.Static) return;
QueueDel(uid);
}
}