Class TriggerExecution
Shared helpers for evaluating trigger conditions and executing trigger action lists. All helpers honor optional per-condition / per-action TargetSelector and TargetSelector fan-out.
public static class TriggerExecution
- Inheritance
-
TriggerExecution
- Inherited Members
Methods
AreConditionsMet(List<BaseCondition>, EventData, Func<BaseCondition, bool>)
Evaluates a condition list against the supplied event data, honoring per-condition
TargetSelector fan-out. When filter
is null, falls back to ConditionFilter so the same
filter applied at the top level propagates into composites and selector-scoped
condition lists.
public static bool AreConditionsMet(List<BaseCondition> conditions, EventData eventData, Func<BaseCondition, bool> filter = null)
Parameters
conditionsList<BaseCondition>The conditions to evaluate.
eventDataEventDataThe event data passed to each condition.
filterFunc<BaseCondition, bool>Optional explicit filter override (rarely needed — prefer setting ConditionFilter at the top of a trigger fire).
Returns
- bool
True when every (non-skipped) condition passes; otherwise false.
EvaluateCondition(BaseCondition, EventData)
Evaluates a single condition, fanning out across TargetSelector when set and combining results per Combine.
public static bool EvaluateCondition(BaseCondition condition, EventData eventData)
Parameters
conditionBaseConditionThe condition to evaluate.
eventDataEventDataThe event data passed to the condition.
Returns
- bool
True when the condition is satisfied.
ExecuteActions(List<BaseAction>, EventData, bool)
Executes an action list against the supplied event data, fanning out across per-action TargetSelector when set. Actions implementing IAbortableAction with StopChainOnFailure set will abort the rest of the chain when their TryExecute(ICharacter, EventData) returns false (e.g. a resource cost that couldn't be paid).
public static void ExecuteActions(List<BaseAction> actions, EventData eventData, bool presentationOnly = false)
Parameters
actionsList<BaseAction>The actions to execute.
eventDataEventDataThe event data passed to each action.
presentationOnlyboolWhen true, only actions reporting IsPresentation run. Set by the trigger-level fallback in Execute(EventData) for a peer that declined to select; see PresentationFallbackApplies(bool, bool, bool).
PresentationFallbackApplies(bool, bool, bool)
Whether an action whose selector produced nothing should still run once, for presentation.
public static bool PresentationFallbackApplies(bool anySelected, bool peerResolvesSelections, bool actionIsPresentation)
Parameters
anySelectedboolTrue when the selector yielded at least one target.
peerResolvesSelectionsboolTrue when this peer may resolve selections for this event.
actionIsPresentationboolTrue when the action's whole effect is rendered.
Returns
- bool
True when the action should run once against the unforked event.
Remarks
The rule this encodes. A spatial selector answers false to
ResolvesSelectionsLocally(EventData) on a third-party OBSERVER and
yields an empty set — correct, and an observer must never resolve somebody else's
targets. But a fan-out runs its action once per selected target, so an empty set ran the
action list ZERO times and took every purely presentational action down with the
authoritative ones. A chain-damage OnHit event therefore drew its arcs and impacts on the
caster's screen alone: every observer saw floating numbers pop over three characters,
delivered by CombatEventBroadcast, with no visual link between them. This is the
same observer-invisibility class AbilityObject.PublishActionHit was introduced to
close for the area and hitscan apply-actions, left unclosed for selector fan-out.
Why it is three booleans and not an inline condition. Two of the three rows that
must stay false are easy to lose. "Nobody was standing there" — an empty selection on the
peer that DID resolve — must run nothing, or a blast that hit no one still plays an impact
on the caster's screen; that is the peerResolvesSelections row. And an
action that is not presentation must never run here however empty the selection was, or an
observer applies damage it has no authority for and draws a number nobody asked it for;
that is the actionIsPresentation row, answered by the action itself
through IsPresentation rather than by a type list kept here.
What the fallback runs against. The event's own scope, unforked — for an ability hit that is the victim the server named, which is where the authored effect belongs. The observer selects nothing, applies nothing and predicts nothing; it plays the picture it was told about, once.
RunInline(TargetSelector, List<BaseCondition>, List<BaseAction>, List<BaseAction>, EventData)
Shared selector-fanout + condition-branch helper used by both the asset-based
Trigger and inline trigger types (e.g. WorldSceneTrigger). When
selector is null the event data is processed as-is; otherwise the
event is forked per selected target. For each scope conditions is
evaluated and the matching action branch is dispatched. Centralising this loop keeps
inline triggers in lock-step with future Trigger behaviour changes
(fault isolation, ambient ConditionFilter, …).
public static void RunInline(TargetSelector selector, List<BaseCondition> conditions, List<BaseAction> onConditionsMetActions, List<BaseAction> onConditionsNotMetActions, EventData eventData)
Parameters
selectorTargetSelectorOptional selector that fans the event out across multiple targets.
conditionsList<BaseCondition>Conditions that gate which action branch fires.
onConditionsMetActionsList<BaseAction>Actions to dispatch when conditions pass.
onConditionsNotMetActionsList<BaseAction>Actions to dispatch when conditions fail.
eventDataEventDataThe event data driving execution.
SelectionWasDeclined(bool, bool)
True when an empty selection means "this peer was not allowed to look" rather than "nobody was there".
public static bool SelectionWasDeclined(bool anySelected, bool peerResolvesSelections)
Parameters
anySelectedboolTrue when the selector yielded at least one target.
peerResolvesSelectionsboolTrue when this peer may resolve selections for this event.
Returns
- bool
True when the selection was declined for authority rather than genuinely empty.
Remarks
The two rows of PresentationFallbackApplies(bool, bool, bool) that do not depend on any one action, split out because the list-level callers — Execute(EventData) and RunInline(TargetSelector, List<BaseCondition>, List<BaseAction>, List<BaseAction>, EventData) — decide the third row per action inside ExecuteActions(List<BaseAction>, EventData, bool) and would otherwise have to assert it here on behalf of a list they have not walked yet.