Table of Contents

Class TriggerExecution

Namespace
FishMMO.Shared.Core
Assembly
FishMMO.Shared.dll

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

conditions List<BaseCondition>

The conditions to evaluate.

eventData EventData

The event data passed to each condition.

filter Func<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

condition BaseCondition

The condition to evaluate.

eventData EventData

The 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

actions List<BaseAction>

The actions to execute.

eventData EventData

The event data passed to each action.

presentationOnly bool

When 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

anySelected bool

True when the selector yielded at least one target.

peerResolvesSelections bool

True when this peer may resolve selections for this event.

actionIsPresentation bool

True 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

selector TargetSelector

Optional selector that fans the event out across multiple targets.

conditions List<BaseCondition>

Conditions that gate which action branch fires.

onConditionsMetActions List<BaseAction>

Actions to dispatch when conditions pass.

onConditionsNotMetActions List<BaseAction>

Actions to dispatch when conditions fail.

eventData EventData

The 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

anySelected bool

True when the selector yielded at least one target.

peerResolvesSelections bool

True 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.