Action On Use (Power Type)

Executes an action when one entity right-clicks another.

Executes an action when one entity right-clicks another. The same power type covers both sides of the interaction — toggle with target_used.

Type ID: apoli:action_on_use

Aliases the two legacy ids: apoli:action_on_entity_use (target_used defaults to false) and apoli:action_on_being_used (target_used defaults to true). Old data packs using either id load unchanged.

When target_used is false (entity-use side), the actor is the entity that has the power and target is the entity that was right-clicked. When target_used is true (being-used side), the actor is the entity that did the right-clicking and target is the entity that has the power. In both cases, actor = the right-clicker and target = the entity being right-clicked.

Fields

FieldTypeDefaultDescription
bientity_actionBi-entity Action TypeoptionalIf specified, run on the actor/target pair.
held_item_actionItem Action TypeoptionalIf specified, run on the actor’s held stack in the hand that triggered the use.
result_item_actionItem Action TypeoptionalIf specified, run on whatever stack ends up in the actor’s hand AFTER held_item_action and result_stack have applied. Skipped if the stack ends up empty.
bientity_conditionBi-entity Condition TypeoptionalGate: only run if this passes for the actor/target pair.
item_conditionItem Condition TypeoptionalGate: only run if this passes for the actor’s held stack.
handsArray of Hand["off_hand", "main_hand"]Which hand(s) of the actor are allowed to trigger this power.
result_stackItem StackoptionalIf specified, this stack is given to the actor (replacing the held stack if empty, otherwise added to inventory or dropped).
action_resultAction Result"success"The InteractionResult returned to the engine when this power fires.
target_usedBooleanfalsefalse = listen on the actor side (entity-use); true = listen on the target side (being-used). Authored automatically when using the legacy aliases.

Examples

{
    "type": "apoli:action_on_use",
    "bientity_action": {
        "type": "apoli:mount"
    },
    "item_condition": {
        "type": "apoli:empty"
    },
    "hands": ["main_hand"],
    "condition": {
        "type": "apoli:sneaking",
        "inverted": true
    }
}

Player with this power can right-click any entity (empty main hand, not sneaking) to mount it. Equivalent to the legacy apoli:action_on_entity_use form.

{
    "type": "apoli:action_on_use",
    "target_used": true,
    "bientity_action": {
        "type": "apoli:mount"
    },
    "bientity_condition": {
        "type": "apoli:target_condition",
        "condition": {
            "type": "apoli:passenger",
            "inverted": true
        }
    }
}

The entity with this power can be mounted by right-clicking it, unless it already has a passenger. Equivalent to the legacy apoli:action_on_being_used form.