Interface EventAction
- All Known Implementing Classes:
EffectsAction, EventStartAction, EventStopAction, GlobalEventStartAction, GlobalEventStopAction, MapMarkerOverrideAddAction, MapMarkerOverrideRemoveAction, MessageAction, NoAction, PrefabPasteAction, PrefabRemoveAction, ShowEventTitleAction, TriggerVolumeCreateAction, TriggerVolumeRemoveAction
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final ArrayCodec<EventAction> static final EventAction[]static final CodecMapCodec<EventAction> -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Ref<EntityStore> ref, CommandBuffer<EntityStore> buffer, WorldEvent event) Executes the action.default voidCalled at asset-load time so the action can register theContextKeyvalues it depends on, enabling the validator to catch dangling or mismatched key names.
-
Field Details
-
TYPE_CODEC
-
ARRAY_CODEC
-
EMPTY_ARRAY
-
-
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
nullvalues and returnfalsewith 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
bufferrather than applied directly, to maintain world-thread consistency.- Parameters:
ref- the entity reference for the world event entitybuffer- the command buffer used to submit ECS mutationsevent- the running world event, including its context- Returns:
trueif the action succeeded;falseto abort the current stage
-
validate
Called at asset-load time so the action can register theContextKeyvalues 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, andValidator.addDefinedKey(String, String, ContextKey)for each key this action writes to context.- Parameters:
validator- the validator to register key references with
-