Deprecate IActionBlocker ChangeDirectionAttempt (#4851)

* Deprecate IActionBlocker ChangeDirectionAttempt

* Woops
This commit is contained in:
metalgearsloth
2021-10-13 13:14:30 +11:00
committed by GitHub
parent 31208c2636
commit 7fe7c46373
10 changed files with 22 additions and 44 deletions

View File

@@ -368,11 +368,6 @@ namespace Content.Shared.MobState.Components
{
return CurrentState?.CanUnequip() ?? true;
}
bool IActionBlocker.CanChangeDirection()
{
return CurrentState?.CanChangeDirection() ?? true;
}
}
[Serializable, NetSerializable]

View File

@@ -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<MobStateComponent, ChangeDirectionAttemptEvent>(OnChangeDirectionAttempt);
SubscribeLocalEvent<MobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
SubscribeLocalEvent<MobStateComponent, DamageChangedEvent>(UpdateState);
SubscribeLocalEvent<MobStateComponent, MovementAttemptEvent>(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())

View File

@@ -83,10 +83,5 @@ namespace Content.Shared.MobState.State
{
return true;
}
public virtual bool CanChangeDirection()
{
return true;
}
}
}

View File

@@ -85,10 +85,5 @@ namespace Content.Shared.MobState.State
{
return false;
}
public override bool CanChangeDirection()
{
return false;
}
}
}

View File

@@ -94,11 +94,6 @@ namespace Content.Shared.MobState.State
return false;
}
public override bool CanChangeDirection()
{
return false;
}
public bool CanShiver()
{
return false;

View File

@@ -71,10 +71,5 @@ namespace Content.Shared.MobState.State
{
return true;
}
public override bool CanChangeDirection()
{
return true;
}
}
}