Module triggers

Source
Expand description

Native functions for the trigger category — the offer trigger_script slot (OfferTemplate::trigger_script). A trigger script decides whether a wrapper runs it as run_expression::<bool> with Event / CharacterState / Offer in scope (see should_give_new_offer in logic/handler.rs).

offer is skipped — the effective outcome is “do not auto-give this offer”. The single trivial native fn below mirrors that default by returning false.

Follows the reference shape in [super::power]: a typed *Ctx, a *Fn alias, a native impl, and a register.

Structs§

TriggerCtx
trigger_script sees: the firing event (Event), the player (CharacterState), and the candidate offer (Offer). config is carried for parity with the other categories’ contexts even though the trivial default does not read it.

Functions§

always_trigger
Native port of the trigger_script: "true" content used by every offer that is meant to be auto-given the moment one of its events_subscribe events fires. By the time should_give_new_offer runs, the candidate offer is already known to be enabled and to have the firing event in its events_subscribe list (see try_give_new_offers), so the faithful decision for a subscribing offer is simply “give it” → true.

Type Aliases§

TriggerFn
Signature of a trigger native fn. Free fn (no captured state) so it is Copy and trivially stored in the registry; runtime context arrives via