Interface EventAction

All Known Implementing Classes:
EffectsAction, EventStartAction, EventStopAction, GlobalEventStartAction, GlobalEventStopAction, MapMarkerOverrideAddAction, MapMarkerOverrideRemoveAction, MessageAction, NoAction, PrefabPasteAction, PrefabRemoveAction, ShowEventTitleAction, TriggerVolumeCreateAction, TriggerVolumeRemoveAction

public interface EventAction
An action executed on completion of a world event stage. Actions are run in order after all conditions for a stage have been satisfied, and each action's success or failure determines whether the stage proceeds or aborts.

Actions interact with the running event through its ContextMap. Use get to read values placed by earlier conditions or actions, and consume to read-and-remove values that should not persist past this action.

  • Field Details

  • Method Details

    • apply

      boolean apply(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> buffer, @Nonnull WorldEvent event)
      Executes the action.

      Actions that read from the event context should check for null values and return false with a warning log if a required entry is missing, as the context may not have been populated if an earlier condition or action failed.

      ECS mutations (spawning entities, setting blocks, etc.) should be submitted through buffer rather than applied directly, to maintain world-thread consistency.

      Parameters:
      ref - the entity reference for the world event entity
      buffer - the command buffer used to submit ECS mutations
      event - the running world event, including its context
      Returns:
      true if the action succeeded; false to abort the current stage
    • validate

      default void validate(@Nonnull Validator validator)
      Called at asset-load time so the action can register the ContextKey values it depends on, enabling the validator to catch dangling or mismatched key names.

      Call Validator.addReferencedKey(String, String, ContextKey) for each key this action reads from context, and Validator.addDefinedKey(String, String, ContextKey) for each key this action writes to context.

      Parameters:
      validator - the validator to register key references with