[Action Refactor Fix] Action blockers now work on Actions (#37948)

This commit is contained in:
Princess Cheeseballs
2025-05-29 21:30:26 -07:00
committed by GitHub
parent 93f780c22d
commit f6c9ef344e

View File

@@ -58,6 +58,7 @@ public abstract class SharedActionsSystem : EntitySystem
SubscribeLocalEvent<ActionsComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ActionsComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<ActionComponent, ActionValidateEvent>(OnValidate);
SubscribeLocalEvent<InstantActionComponent, ActionValidateEvent>(OnInstantValidate);
SubscribeLocalEvent<EntityTargetActionComponent, ActionValidateEvent>(OnEntityValidate);
SubscribeLocalEvent<WorldTargetActionComponent, ActionValidateEvent>(OnWorldValidate);
@@ -316,19 +317,9 @@ public abstract class SharedActionsSystem : EntitySystem
private void OnValidate(Entity<ActionComponent> ent, ref ActionValidateEvent args)
{
if (ent.Comp.CheckConsciousness && !_actionBlocker.CanConsciouslyPerformAction(args.User))
{
if ((ent.Comp.CheckConsciousness && !_actionBlocker.CanConsciouslyPerformAction(args.User))
|| (ent.Comp.CheckCanInteract && !_actionBlocker.CanInteract(args.User, null)))
args.Invalid = true;
return;
}
if (ent.Comp.CheckCanInteract && !_actionBlocker.CanInteract(args.User, null))
{
args.Invalid = true;
return;
}
// Event is not set here, only below
}
private void OnInstantValidate(Entity<InstantActionComponent> ent, ref ActionValidateEvent args)