Skip to main content

Action On Use (Power Type)

Runs an action when one entity right-clicks another. One power type covers both sides of the interaction, and target_used picks the side.

Type ID: apoli:action_on_use

It is also reached through 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.

The actor is always the entity doing the right-clicking and the target is the entity being right-clicked. With target_used: false the actor is the entity with the power, and with target_used: true the target is.

Fields

FieldTypeDefaultDescription
bientity_actionBi-entity Action TypeoptionalIf set, this runs on the actor and target pair.
held_item_actionItem Action TypeoptionalIf set, this runs on the stack in the actor's hand that triggered the use.
result_item_actionItem Action TypeoptionalIf set, this runs on result_stack before the actor gets it. Without result_stack it does nothing, so to change the item in hand, use held_item_action.
bientity_conditionBi-entity Condition TypeoptionalThe actions only run if this passes for the actor and target pair.
item_conditionItem Condition TypeoptionalThe actions only run if this passes for the actor's held stack.
handsArray of Hand["off_hand", "main_hand"]The actor's hands that can trigger this power.
result_stackItem StackoptionalIf set, this stack is given to the actor. It replaces the held stack if that is empty, and otherwise goes into the inventory or is dropped.
action_resultAction Result"success"The interaction result returned to the game when this power fires.
target_usedBooleanfalsefalse listens on the actor's side (using another entity), and true listens on the target's side (being used). The legacy aliases set it for you.

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
    }
}

A player with this power can ride any entity by right-clicking it with an empty main hand while not sneaking. This is the same as 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
        }
    }
}

Others can ride the entity with this power by right-clicking it, unless it already has a passenger. This is the same as the legacy apoli:action_on_being_used form.