Interface IReactiveTrigger
- Namespace
- ElectricDrill.AstraRpgFramework.Triggers
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Holder-aware reactive event delivery contract. Implementations wrap a game event source and invoke registered callbacks when the event fires. Subscriptions are registered on behalf of a EntityCore holder; the holder is passed to Subscribe(EntityCore, Action<object>) so that the caller can identify which modifier instance or system registered the callback, but it does NOT imply that only events concerning that holder are delivered. On a shared global event SO, all subscribed holders are notified — event filtering by entity identity is the responsibility of the callback or an associated Condition.
public interface IReactiveTrigger
Properties
EventSource
Returns the underlying shared event object this trigger wraps, or null.
Triggers returning the same non-null reference are coalesced into a single
subscription per modifier instance so that effects always process before
duration bookkeeping within the same event raise.
object EventSource { get; }
Property Value
- object
PayloadType
The System.Type of the payload delivered by this trigger when it fires.
typeof(void) for parameterless triggers (no payload); a concrete or interface
type for triggers that carry typed event data. Used by
ConditionCompatibility to
verify that a paired
Condition can consume the
payload at design time.
Type PayloadType { get; }
Property Value
- Type
Methods
Subscribe(EntityCore, Action<object>)
Registers callback to be invoked when the trigger fires.
Multiple distinct callbacks may be registered for the same holder.
Registering the exact same callback reference for the same
holder a second time is a no-op (idempotent).
void Subscribe(EntityCore holder, Action<object> callback)
Parameters
holderEntityCoreThe entity on whose behalf the subscription is registered. Used as a key to allow grouped removal, but does not filter which events are delivered.
callbackAction<object>Invoked with the event payload boxed as
object(may benullfor parameterless triggers). The caller is responsible for casting to the expected type.
Unsubscribe(EntityCore, Action<object>)
Removes the subscription for the specific holder/callback
pair. Safe to call even if the pair was never registered or has already been removed.
void Unsubscribe(EntityCore holder, Action<object> callback)
Parameters
holderEntityCorecallbackAction<object>