Deprecate a bunch of IActionBlocker (#4852)

* Deprecate IActionBlocker ChangeDirectionAttempt

* Woops

* Throw and interact

* Deperacte speech

* ActionBlocker in fucking shambles

* CanEmote go byebye

* CanAttack is GONE

* IActionBlocker finally ded

* DRY
This commit is contained in:
metalgearsloth
2021-10-21 13:03:14 +11:00
committed by GitHub
parent 339982d05b
commit 7beb363285
20 changed files with 196 additions and 437 deletions

View File

@@ -1,10 +1,15 @@
using Content.Shared.Damage;
using Content.Shared.DragDrop;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.MobState.Components;
using Content.Shared.MobState.State;
using Content.Shared.Movement;
using Content.Shared.Pulling.Events;
using Content.Shared.Speech;
using Content.Shared.Standing;
using Content.Shared.Throwing;
using Robust.Shared.GameObjects;
namespace Content.Shared.MobState.EntitySystems
@@ -16,6 +21,15 @@ namespace Content.Shared.MobState.EntitySystems
base.Initialize();
SubscribeLocalEvent<MobStateComponent, ChangeDirectionAttemptEvent>(OnChangeDirectionAttempt);
SubscribeLocalEvent<MobStateComponent, UseAttemptEvent>(OnUseAttempt);
SubscribeLocalEvent<MobStateComponent, InteractionAttemptEvent>(OnInteractAttempt);
SubscribeLocalEvent<MobStateComponent, ThrowAttemptEvent>(OnThrowAttempt);
SubscribeLocalEvent<MobStateComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<MobStateComponent, EquipAttemptEvent>(OnEquipAttempt);
SubscribeLocalEvent<MobStateComponent, UnequipAttemptEvent>(OnUnequipAttempt);
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(OnAttackAttempt);
SubscribeLocalEvent<MobStateComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<MobStateComponent, PickupAttemptEvent>(OnPickupAttempt);
SubscribeLocalEvent<MobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
SubscribeLocalEvent<MobStateComponent, DamageChangedEvent>(UpdateState);
SubscribeLocalEvent<MobStateComponent, MovementAttemptEvent>(OnMoveAttempt);
@@ -23,7 +37,9 @@ 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)
#region ActionBlocker
private void CheckAct(EntityUid uid, MobStateComponent component, CancellableEntityEventArgs args)
{
switch (component.CurrentState)
{
@@ -34,6 +50,58 @@ namespace Content.Shared.MobState.EntitySystems
}
}
private void OnChangeDirectionAttempt(EntityUid uid, MobStateComponent component, ChangeDirectionAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnUseAttempt(EntityUid uid, MobStateComponent component, UseAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnInteractAttempt(EntityUid uid, MobStateComponent component, InteractionAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnThrowAttempt(EntityUid uid, MobStateComponent component, ThrowAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnSpeakAttempt(EntityUid uid, MobStateComponent component, SpeakAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnEquipAttempt(EntityUid uid, MobStateComponent component, EquipAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnUnequipAttempt(EntityUid uid, MobStateComponent component, UnequipAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnAttackAttempt(EntityUid uid, MobStateComponent component, AttackAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnDropAttempt(EntityUid uid, MobStateComponent component, DropAttemptEvent args)
{
CheckAct(uid, component, args);
}
private void OnPickupAttempt(EntityUid uid, MobStateComponent component, PickupAttemptEvent args)
{
CheckAct(uid, component, args);
}
#endregion
private void OnStartPullAttempt(EntityUid uid, MobStateComponent component, StartPullAttemptEvent args)
{
if(component.IsIncapacitated())