> For the complete documentation index, see [llms.txt](https://aero-labs.gitbook.io/aero-labs-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aero-labs.gitbook.io/aero-labs-docs/scripts/aheadblocks.md).

# AHeadblocks

Fit head blocks to immobilise a patient's head, synced for every player.

![AHeadblocks](https://3178353394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fm2Hc1pmEtJtEBI0blIeE%2Fuploads%2FoQYYJFigWzc6CKvT7bRF%2FAHeadblocks.jpg?alt=media)

Fit head blocks to a patient to immobilise their head and neck. The medic kneels and fits the blocks, and the prop stays attached to the patient for every player until it is removed.

## Requirements

| Dependency                                        | Required | Notes                          |
| ------------------------------------------------- | -------- | ------------------------------ |
| [ox\_lib](https://github.com/overextended/ox_lib) | Yes      | Progress bar and notifications |
| QBCore / QBox / TMC                               | Optional | Item use                       |
| ox\_inventory / qb-inventory / TMC                | Optional | Item checks                    |

The head blocks prop (`capital_hj_headblocks`) is streamed by the resource itself.

## Installation

1. Drag the `AHeadblocks` folder into your `resources` folder.
2. Add it to your `server.cfg` after ox\_lib:

   ```cfg
   ensure ox_lib
   ensure AHeadblocks
   ```
3. Set your framework and inventory in `config.lua`.
4. **Framework only:** add a `headblocks` item to your inventory.

## Configuration

```lua
Config.Debug = false

Config.Framework = "Standalone" -- "Standalone", "QBCore", "QBox", "TMC"
Config.Inventory = "ox"         -- "ox", "tmc", "qb" (ignored in Standalone)

Config.Command = {
    enabled       = true,
    command       = "useheadblocks",
    removeCommand = "removeheadblocks",
}

Config.HeadBlocks = {
    Item       = 'headblocks',
    Prop       = 'capital_hj_headblocks',
    ApplyTime  = 3000, -- ms to fit the blocks
    MaxRayDist = 10.0, -- how far away you can target a patient
    AnimDict   = 'amb@medic@standing@kneel@base',
    AnimClip   = 'base',
    -- Bone / Offset: prop placement, only change if you swap the prop
}
```

| Option                   | Description                                             |
| ------------------------ | ------------------------------------------------------- |
| `Config.Inventory`       | Which inventory to check and take the item from.        |
| `Config.Command.enabled` | Registers `/useheadblocks` **and** `/removeheadblocks`. |
| `HeadBlocks.ApplyTime`   | Duration of the fitting progress bar.                   |
| `HeadBlocks.MaxRayDist`  | Maximum targeting distance in metres.                   |

{% hint style="warning" %}
The remove command only exists while `Config.Command.enabled = true`. Leave it on in framework mode too, so players can take head blocks off. The item is still required to fit them.
{% endhint %}

## Usage

### Fitting head blocks

1. Use the **headblocks** item, or type `/useheadblocks`.
2. Look at the patient. A **blue marker** appears above their head.
3. Press **E** to select them. Press **Esc**, or press **E** while not looking at anyone, to cancel.
4. A 3-second *"Fitting head blocks"* progress bar plays while you kneel. You can cancel it.
5. The blocks are attached, and one `headblocks` item is used up (framework mode).

### Removing head blocks

1. Type `/removeheadblocks`.
2. Look at the patient and press **E**.
3. The blocks are removed and the item goes back to your inventory (framework mode).

{% hint style="info" %}
A patient can only wear one set of head blocks at a time, and the target must be a player.
{% endhint %}

## Developer events

| Event (client)          | Description                         |
| ----------------------- | ----------------------------------- |
| `MDXHeadblocks:useItem` | Starts target selection and fitting |
