diff --git a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs index ce12643b59..60e034abe6 100644 --- a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs +++ b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs @@ -272,15 +272,6 @@ namespace Content.Shared.ActionBlocker RaiseLocalEvent(entity.Uid, ev); - foreach (var blocker in ev.Entity.GetAllComponents()) - { - if (!blocker.CanChangeDirection()) - { - ev.Cancel(); - break; - } - } - return !ev.Cancelled; } diff --git a/Content.Shared/ActionBlocker/IActionBlocker.cs b/Content.Shared/ActionBlocker/IActionBlocker.cs index 4d0a78bc79..f92829159b 100644 --- a/Content.Shared/ActionBlocker/IActionBlocker.cs +++ b/Content.Shared/ActionBlocker/IActionBlocker.cs @@ -39,8 +39,5 @@ namespace Content.Shared.ActionBlocker [Obsolete("Use UnequipAttemptEvent instead")] bool CanUnequip() => true; - - [Obsolete("Use ChangeDirectionAttemptEvent instead")] - bool CanChangeDirection() => true; } } diff --git a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs index db60285697..6ee880c22c 100644 --- a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs +++ b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs @@ -1,5 +1,4 @@ using System; -using Content.Shared.ActionBlocker; using Content.Shared.DragDrop; using Content.Shared.EffectBlocker; using Content.Shared.Interaction; @@ -12,7 +11,7 @@ using Robust.Shared.ViewVariables; namespace Content.Shared.Buckle.Components { [NetworkedComponent()] - public abstract class SharedBuckleComponent : Component, IActionBlocker, IEffectBlocker, IDraggable + public abstract class SharedBuckleComponent : Component, IEffectBlocker, IDraggable { public sealed override string Name => "Buckle"; @@ -36,11 +35,6 @@ namespace Content.Shared.Buckle.Components public abstract bool TryBuckle(IEntity? user, IEntity to); - bool IActionBlocker.CanChangeDirection() - { - return !Buckled; - } - bool IEffectBlocker.CanFall() => !Buckled; bool IDraggable.CanDrop(CanDropEvent args) diff --git a/Content.Shared/Buckle/SharedBuckleSystem.cs b/Content.Shared/Buckle/SharedBuckleSystem.cs index 700deb5540..cdbbe06a91 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.cs @@ -1,4 +1,5 @@ using Content.Shared.Buckle.Components; +using Content.Shared.Interaction.Events; using Content.Shared.Movement; using Content.Shared.Standing; using Content.Shared.Throwing; @@ -17,6 +18,13 @@ namespace Content.Shared.Buckle SubscribeLocalEvent(HandleStand); SubscribeLocalEvent(HandleThrowPushback); SubscribeLocalEvent(HandleMove); + SubscribeLocalEvent(OnBuckleChangeDirectionAttempt); + } + + private void OnBuckleChangeDirectionAttempt(EntityUid uid, SharedBuckleComponent component, ChangeDirectionAttemptEvent args) + { + if (component.Buckled) + args.Cancel(); } private void HandleMove(EntityUid uid, SharedBuckleComponent component, MovementAttemptEvent args) diff --git a/Content.Shared/MobState/Components/MobStateComponent.cs b/Content.Shared/MobState/Components/MobStateComponent.cs index d0138e0838..1c6a531453 100644 --- a/Content.Shared/MobState/Components/MobStateComponent.cs +++ b/Content.Shared/MobState/Components/MobStateComponent.cs @@ -368,11 +368,6 @@ namespace Content.Shared.MobState.Components { return CurrentState?.CanUnequip() ?? true; } - - bool IActionBlocker.CanChangeDirection() - { - return CurrentState?.CanChangeDirection() ?? true; - } } [Serializable, NetSerializable] diff --git a/Content.Shared/MobState/EntitySystems/MobStateSystem.cs b/Content.Shared/MobState/EntitySystems/MobStateSystem.cs index 39c3353195..5f05420d11 100644 --- a/Content.Shared/MobState/EntitySystems/MobStateSystem.cs +++ b/Content.Shared/MobState/EntitySystems/MobStateSystem.cs @@ -1,4 +1,5 @@ using Content.Shared.Damage; +using Content.Shared.Interaction.Events; using Content.Shared.MobState.Components; using Content.Shared.MobState.State; using Content.Shared.Movement; @@ -14,6 +15,7 @@ namespace Content.Shared.MobState.EntitySystems { base.Initialize(); + SubscribeLocalEvent(OnChangeDirectionAttempt); SubscribeLocalEvent(OnStartPullAttempt); SubscribeLocalEvent(UpdateState); SubscribeLocalEvent(OnMoveAttempt); @@ -21,6 +23,17 @@ namespace Content.Shared.MobState.EntitySystems // Note that there's no check for Down attempts because if a mob's in crit or dead, they can be downed... } + private void OnChangeDirectionAttempt(EntityUid uid, MobStateComponent component, ChangeDirectionAttemptEvent args) + { + switch (component.CurrentState) + { + case SharedDeadMobState: + case SharedCriticalMobState: + args.Cancel(); + break; + } + } + private void OnStartPullAttempt(EntityUid uid, MobStateComponent component, StartPullAttemptEvent args) { if(component.IsIncapacitated()) diff --git a/Content.Shared/MobState/State/BaseMobState.cs b/Content.Shared/MobState/State/BaseMobState.cs index d82771b00f..bb8dec110f 100644 --- a/Content.Shared/MobState/State/BaseMobState.cs +++ b/Content.Shared/MobState/State/BaseMobState.cs @@ -83,10 +83,5 @@ namespace Content.Shared.MobState.State { return true; } - - public virtual bool CanChangeDirection() - { - return true; - } } } diff --git a/Content.Shared/MobState/State/SharedCriticalMobState.cs b/Content.Shared/MobState/State/SharedCriticalMobState.cs index 099fd1d4ac..bfde092263 100644 --- a/Content.Shared/MobState/State/SharedCriticalMobState.cs +++ b/Content.Shared/MobState/State/SharedCriticalMobState.cs @@ -85,10 +85,5 @@ namespace Content.Shared.MobState.State { return false; } - - public override bool CanChangeDirection() - { - return false; - } } } diff --git a/Content.Shared/MobState/State/SharedDeadMobState.cs b/Content.Shared/MobState/State/SharedDeadMobState.cs index 09804138ba..e3d4305e62 100644 --- a/Content.Shared/MobState/State/SharedDeadMobState.cs +++ b/Content.Shared/MobState/State/SharedDeadMobState.cs @@ -94,11 +94,6 @@ namespace Content.Shared.MobState.State return false; } - public override bool CanChangeDirection() - { - return false; - } - public bool CanShiver() { return false; diff --git a/Content.Shared/MobState/State/SharedNormalMobState.cs b/Content.Shared/MobState/State/SharedNormalMobState.cs index 0dddbbcf3c..fd1863be10 100644 --- a/Content.Shared/MobState/State/SharedNormalMobState.cs +++ b/Content.Shared/MobState/State/SharedNormalMobState.cs @@ -71,10 +71,5 @@ namespace Content.Shared.MobState.State { return true; } - - public override bool CanChangeDirection() - { - return true; - } } }