Body, Mind & Soul — API Reference
    Preparing search index...

    Function useEmbeddedAction

    • Shared entry point for an action embedded in another document (an item's embedded action or a glyph's action). Handles the ownership check, resource consumption, glyph durability, combat queuing vs. instant resolution, and optional parent-charge consumption on instant resolution.

      Ordering: resources are validated first, so durability is only consumed after they succeed. If durability then fails, the resources are refunded.

      NOTE: on the in-combat path, the "no swings" warning fires AFTER resources were consumed, so an action without swings still spends its resources. Preserved as current behavior.

      Config:

      • actor: the owning actor. Nothing happens unless actor.isOwner.
      • actionItem: the embedded action item (SyntheticActionItem). Nothing happens when falsy.
      • sourceItemId: parent item id, or glyph UUID, passed to the combat queue.
      • consumeParentCharge: whether the combat queue should also consume the parent charge.
      • onConsumeParentCharge: async callback run after an instant resolution to consume the parent charge.
      • glyphItem: glyph item whose durability is consumed (only when durabilityCost > 0).
      • durabilityCost: durability to consume from glyphItem after resources succeed.
      • busyElement: optional element disabled while the in-combat queue call runs.

      Parameters

      • options: {
            actionItem: any;
            actor: any;
            busyElement?: BusyElement;
            consumeParentCharge?: boolean;
            durabilityCost?: number;
            glyphItem?: any;
            onConsumeParentCharge?: (() => unknown) | null;
            sourceItemId: string;
        }

        Workflow inputs.

        • actionItem: any

          The embedded action item.

        • actor: any

          The actor using the action.

        • OptionalbusyElement?: BusyElement

          Optional element to disable during the in-combat queue call.

        • OptionalconsumeParentCharge?: boolean

          Pass-through flag for the combat queue. Defaults to false.

        • OptionaldurabilityCost?: number

          Durability to consume. Defaults to 0.

        • OptionalglyphItem?: any

          Glyph item for durability. Defaults to null.

        • OptionalonConsumeParentCharge?: (() => unknown) | null

          Callback run after instant resolution. Defaults to null.

        • sourceItemId: string

          Parent item id or glyph UUID.

      Returns Promise<void>

      Resolves when the workflow finishes or stops early.