Type Parameters

Hierarchy

Properties

alignment?: SupplierOr<undefined | ArrayOr<DeityReal>, [IUsableActionPossibleUsing]>
bindable?: default | ((using: IUsableActionUsing<REQUIREMENTS>) => undefined | default)

The bindable assigned to this action, for use in action context menus (ie, right clicking on the world or an item.) Allows for a dynamically generated bindable based on what this action is using — item, doodad, etc.

clientSide?: true

Marks this usable action as only executable client-side. This disables support for "auto-use" in action slots.

discoveredByDefault?: true | (() => boolean)
displayLevel?: ActionDisplayLevel | ((using: IUsableActionPossibleUsing) => undefined | ActionDisplayLevel)

The contexts this action appears in.

  • "Always" means whenever an action of this type is shown, it will be. For example, the "item actions" menu.
  • "Direct" means whenever an action of this type is applicable to given objects, it will be. For example, a specific item's menu.
  • "Never" means it will never be shown in menus. This results in an action which is executable but never appears in menus.
forceDisplayWhenEmpty?: undefined
historyRememberLocation?: true

Whether action history should remember the tile this action was used on

icon?: SupplierOr<false | UsableActionIconReference, [using: IUsableActionPossibleUsing, action: default<REQUIREMENTS, IUsableActionDefinition<REQUIREMENTS>>, context: UsableActionDisplayContext]>

The icon this action should have, if any.

iconLocationOnItem?: ItemDetailIconLocation

Where the icon should appear, when slotted with an item. Defaults to bottom right.

Generally, top left means "something else interacting with the slotted item" rather than "the slotted item interacting with something."
For example, "Harvest" shows in bottom right, because it's using this tool to harvest. Whereas "Repair With X" shows in top left, because it's repairing this tool.

id?: string | number
inspectTypes?: InspectType[]
interactionDistance?: InteractionDistance | ((using: IUsableActionPossibleUsing) => undefined | InteractionDistance)

By default, actions are assumed to be interacting with the tile in front of them. This recategorises the action as one that either is unrelated to the tile in front, or interacting with the tile below.

This affects where the game chooses to path the player to in order to use the action.

noSlotItem?: true

Marks this usable action as, when slotted in the action bar on an item, the item should be ignored and instead the type should be used. Compatible with noSlotQuality

noSlotQuality?: true

Marks this usable action as, when slotted in the action bar on an item, the item & quality should be ignored. Compatible with noSlotItem

priority?: number | ((using: IUsableActionPossibleUsing) => undefined | number)

Controls the display order of this action compared to other actions. Generally you want to leave this as 0 (default) and just register your action in the correct place. Priority can be generated dynamically based on the given objects — item, doodad, etc.

Higher priority === appears first.
Lower priority === appears last.

requirementsErrorDisplayLevel?: ActionDisplayLevel

The display level of the action when there's an error with its requirements.

slottable?: boolean | ActionId

Whether this action can be slotted in the action bar. Defaults to true.

If set to an ActionId, the ActionId will be attempted to be slotted instead.

submenu?: undefined
targetHoveredTile?: true

Whether to target the tile the mouse is over by default.

Type declaration

useHintAction?: ActionType

A hint for the inspection system that this UA is internally using a specific action. Use tooltip filtering checks this.

Methods

  • Executes this action. Generally, this is where you want to execute an internal action registered with @Register.action, as internal actions are called on all sides, rather than only clientside*.

    *Warning: While usable actions appear to only ever be client-side, they're not always. The "auto-use" feature for action slots results in actions being executed only on the server's side. If you try to perform a client-side UI function here, such as showing a prompt, and a player puts the action in a "auto-use" action slot, the host will receive the prompt instead!

    If you'd like to execute some things on clientside, you can check if the player is the local player by checking if (player.asLocalPlayer), or ensure that this action is only executed clientside by setting clientSide: true, which disables support for the "auto-use" feature.

    Parameters

    • player: default

      The player executing this action. This isn't always the local player!

    • using: IUsableActionUsing<REQUIREMENTS>

      What the player is using — items, doodads, etc.

    • context: IUsableActionExecutionContext

      Context to do with this action execution — where it's executed from, etc.

    Returns any

Generated using TypeDoc