Knockdown (#535)
* - add: Better knockdown. * - add: Some stuff. * - add: Ghetto alert.
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared._White.Wizard.Timestop;
|
||||
using Content.Shared.Buckle;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -52,6 +53,7 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<StandingStateComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
|
||||
SubscribeLocalEvent<StandingStateComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeed);
|
||||
SubscribeLocalEvent<StandingStateComponent, TileFrictionEvent>(OnTileFriction);
|
||||
SubscribeLocalEvent<StandingStateComponent, SlipAttemptEvent>(OnSlipAttempt);
|
||||
|
||||
InitializeColliding();
|
||||
@@ -98,12 +100,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
|
||||
private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
|
||||
{
|
||||
if (args.Handled || _stun.IsParalyzed(uid)) // WD EDIT
|
||||
{
|
||||
if (args.Handled || args.Cancelled || HasComp<KnockedDownComponent>(uid) ||
|
||||
_mobState.IsIncapacitated(uid) || !Stand(uid)) // WD EDIT
|
||||
component.CurrentState = StandingState.Lying;
|
||||
return;
|
||||
}
|
||||
Stand(uid);
|
||||
}
|
||||
|
||||
private void OnRefreshMovementSpeed(EntityUid uid, StandingStateComponent component,
|
||||
@@ -115,6 +114,12 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
args.ModifySpeed(1f, 1f);
|
||||
}
|
||||
|
||||
private void OnTileFriction(Entity<StandingStateComponent> ent, ref TileFrictionEvent args)
|
||||
{
|
||||
if (IsDown(ent))
|
||||
args.Modifier *= SharedStunSystem.KnockDownModifier;
|
||||
}
|
||||
|
||||
private void OnSlipAttempt(EntityUid uid, StandingStateComponent component, SlipAttemptEvent args)
|
||||
{
|
||||
if (IsDown(uid))
|
||||
@@ -217,6 +222,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
|
||||
return false;
|
||||
|
||||
if (standingState.CurrentState is StandingState.Lying or StandingState.GettingUp)
|
||||
return true;
|
||||
|
||||
// This is just to avoid most callers doing this manually saving boilerplate
|
||||
// 99% of the time you'll want to drop items but in some scenarios (e.g. buckling) you don't want to.
|
||||
// We do this BEFORE downing because something like buckle may be blocking downing but we want to drop hand items anyway
|
||||
@@ -226,9 +234,6 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, new DropHandItemsEvent());
|
||||
}
|
||||
|
||||
if (standingState.CurrentState is StandingState.Lying or StandingState.GettingUp)
|
||||
return true;
|
||||
|
||||
var msg = new DownAttemptEvent();
|
||||
RaiseLocalEvent(uid, msg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user