2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Buckle.Components;
|
2021-05-30 23:30:44 +10:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Physics.Dynamics;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Buckle
|
2021-05-30 23:30:44 +10:00
|
|
|
{
|
|
|
|
|
public abstract class SharedBuckleSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<SharedBuckleComponent, PreventCollideEvent>(PreventCollision);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PreventCollision(EntityUid uid, SharedBuckleComponent component, PreventCollideEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.BodyB.Owner.Uid != component.LastEntityBuckledTo) return;
|
|
|
|
|
|
|
|
|
|
component.IsOnStrapEntityThisFrame = true;
|
|
|
|
|
if (component.Buckled || component.DontCollide)
|
|
|
|
|
{
|
|
|
|
|
args.Cancel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|