Remove IActionBlocker.CanMove (#4449)
* Remove IActionBlocker.CanMove Ported the remainders over to using MovementAttemptEvent which should also help make mob movement a bit faster. * Make that check faster
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.MobState.State;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Pulling.Events;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -11,6 +13,7 @@ namespace Content.Shared.MobState.EntitySystems
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedMobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
|
||||
SubscribeLocalEvent<SharedMobStateComponent, MovementAttemptEvent>(OnMoveAttempt);
|
||||
}
|
||||
|
||||
private void OnStartPullAttempt(EntityUid uid, SharedMobStateComponent component, StartPullAttemptEvent args)
|
||||
@@ -18,5 +21,18 @@ namespace Content.Shared.MobState.EntitySystems
|
||||
if(component.IsIncapacitated())
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnMoveAttempt(EntityUid uid, SharedMobStateComponent component, MovementAttemptEvent args)
|
||||
{
|
||||
switch (component.CurrentState)
|
||||
{
|
||||
case SharedCriticalMobState:
|
||||
case SharedDeadMobState:
|
||||
args.Cancel();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user