SubscribeLocalEvent<ActionsComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ActionsComponent, ComponentGetState>(OnGetState);
+ SubscribeLocalEvent<ActionComponent, ActionValidateEvent>(OnValidate);
SubscribeLocalEvent<InstantActionComponent, ActionValidateEvent>(OnInstantValidate);
SubscribeLocalEvent<EntityTargetActionComponent, ActionValidateEvent>(OnEntityValidate);
SubscribeLocalEvent<WorldTargetActionComponent, ActionValidateEvent>(OnWorldValidate);
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)