# Hotbar

The resource ships with two configurable hotbar contexts:

* `patient`: actions used while interacting with another player.
* `vehicle`: actions used while interacting with a configured ambulance vehicle.

Main config file:

* `config/hotbar.lua`

Type file for editor hints:

* `modules/types/hotbar.lua`

## Context Config

Each top-level context supports:

* `enabled`
* `interactionType`
* `targetLabel`
* `targetOpenDistance`
* `closeDistance`
* `hideAfterUse`
* `useKeybinds`
* `openKeybind`
* `targetDistance`
* `defaultJobs`
* `items`

Patient-only extra field:

* `assistiveDurationMaxMinutes`
* `assistiveDevices`

Notes:

* `interactionType` accepts `target` or `textui`.
* `defaultJobs = nil` falls back to `Config.ambulanceJobs`.
* `targetDistance` controls server-side validation for patient actions and nearby interaction checks.
* If both contexts use the same `openKeybind`, the nearest valid context is opened.

## Item Config

Each hotbar item supports:

* `id`
* `label`
* `keybind`
* `keyLabel`
* `image`
* `side`
* `enabled`
* `jobs`
* `handler`
* `event`
* `serverEvent`
* `init`
* `allowWhileDowned`
* `targetDistance`
* `submenu`

Notes:

* `side` accepts `left` or `right`.
* If `keybind` is omitted on a top-level item, the client assigns the next free key automatically.
* `submenu` items use the same data shape as a regular item.
* `jobs` can override the context-level `defaultJobs` list for a single action.
* `allowWhileDowned = true` bypasses the default block for dead / laststand usage.

## Action Resolution Order

When an item is used, the client resolves the action in this order:

1. `handler`
2. `init`
3. `event`
4. `serverEvent`

If none of these are defined, the resource notifies that the item is missing a handler.

## Built-in Defaults

Default patient items include:

* remove clothing
* give crutch
* give wheelchair
* serum / blood submenu
* draw blood
* neck brace / arm plaster submenu
* open monitor
* write prescription
* carry patient
* bandage treatment
* stretcher control submenu

Default vehicle items include:

* extract stretcher
* load stretcher
* toggle rear doors
* toggle rear compartment

## Assistive Devices

Patient hotbar assistive flows are configured through `Config.hotbar.patient.assistiveDevices`.

Default device keys:

* `crutch`
* `serum`
* `blood`
* `neckbrace`
* `arm_plaster`
* `wheelchair`
* `monitor`

Device entries can define object, animation, attachment, and vehicle behavior:

* `bone`
* `model`
* `clipset`
* `animDict`
* `animClip`
* `animFlag`
* `animTime`
* `offset`
* `rotation`
* `rotationOrder`
* `syncRot`
* `scale`
* `stateKey`
* `seat`

Notes:

* `scale` is optional and accepts a number or `vector3`.
* Leave `scale` unset when the model does not need matrix scaling.
* `wheelchair.stateKey` controls the player state bag used for wheelchair tracking.
* `monitor.model` may be a single model or a fallback list.
* `assistiveDurationMaxMinutes` limits the duration requested by patient-side assistive actions.

Admins can tune the active assistive prop offset and rotation in-game with the configured debug command:

```
/hotbar_assistive_debug
```

The command is controlled by `Config.commands.hotbarAssistiveDebug` in `config/init.lua` and is restricted to `group.admin` by default.

## UI Images

* Hotbar item images are UI assets, not inventory item definitions.
* Keep configured `image` names aligned with files in `ui/build/items`.
* When editing the dev UI source, mirror those assets in `ui/dev/public/items` before rebuilding.

## Optional Dependencies

Some shipped default handlers expect optional resources or content:

* `iak_wheelchair` for wheelchair flows.
* `emsprops` and `qua_ambulance_int` for ambulance vehicle/interior flows.

If you do not use those resources, disable or replace the related hotbar items in `config/hotbar.lua`.

## Example

```lua
{
    id = "open_monitor",
    label = locale("hotbar_item_open_monitor"),
    keybind = "7",
    keyLabel = "7",
    image = "open_monitor.png",
    side = "right",
    handler = "open_monitor",
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0r-resources/0r-ambulancejob/hotbar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
