Don't pushback when throwing while buckled (#4232)

* Don't pushback when throwing while buckled

* Address reviews

* Fix
This commit is contained in:
metalgearsloth
2021-06-28 14:17:08 +10:00
committed by GitHub
parent 50cc526ebd
commit 05e31c2cd3
3 changed files with 20 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Buckle.Components;
using Content.Shared.Standing;
using Content.Shared.Throwing;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Dynamics;
@@ -13,6 +14,7 @@ namespace Content.Shared.Buckle
SubscribeLocalEvent<SharedBuckleComponent, PreventCollideEvent>(PreventCollision);
SubscribeLocalEvent<SharedBuckleComponent, DownAttemptEvent>(HandleDown);
SubscribeLocalEvent<SharedBuckleComponent, StandAttemptEvent>(HandleStand);
SubscribeLocalEvent<SharedBuckleComponent, ThrowPushbackAttemptEvent>(HandleThrowPushback);
}
private void HandleStand(EntityUid uid, SharedBuckleComponent component, StandAttemptEvent args)
@@ -31,6 +33,12 @@ namespace Content.Shared.Buckle
}
}
private void HandleThrowPushback(EntityUid uid, SharedBuckleComponent component, ThrowPushbackAttemptEvent args)
{
if (!component.Buckled) return;
args.Cancel();
}
private void PreventCollision(EntityUid uid, SharedBuckleComponent component, PreventCollideEvent args)
{
if (args.BodyB.Owner.Uid != component.LastEntityBuckledTo) return;