> For the complete documentation index, see [llms.txt](https://devmosaic.gitbook.io/devmosaic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devmosaic.gitbook.io/devmosaic/resources/devmosaic-ox-fuel-rework/vehicle-inlets.md).

# Vehicle Fuel Inlets

How the nozzle finds the fuel cap, and how to correct a model that is wrong.

### It Is Automatic

Most GTA vehicles have no usable fuel cap bone, so the script works the position out instead. You do not need to configure anything for this to work.

It tries these in order and stops at the first that gives a sensible answer:

1. **Your override**, if the model is listed in `data/vehicles.lua`.
2. **The `petrolcap` bone**, if the model has one *and* it passes a sanity check. Custom models often export this bone onto a handlebar, a roof accessory or the model origin, so it is validated rather than trusted.
3. **Tank bones** - `petroltank`, `fuel_tank`, `fueltank` - projected out onto the body side.
4. **Rear and middle axle bones**, which give a far better lengthwise reference than the bounding box on long vehicles.
5. **Body proportions**, as a last resort, with separate handling for bikes and for tall trucks.

Once it has a position it raycasts inward from outside the vehicle so the nozzle lands on actual bodywork rather than floating or sinking, and it places the inlet on whichever side faces the pump.

### Overriding A Model

If one vehicle looks wrong, add a line to `data/vehicles.lua`:

```lua
return {
    [`sanchez`] = { pos = vec3(0.0, 0.196537, 0.529419), rot = vec3(-70.0, 0.0, 0.0), depth = 0.02 },
}
```

| Field   | Meaning                                                           |
| ------- | ----------------------------------------------------------------- |
| `pos`   | Where the filler opening sits, relative to the vehicle.           |
| `rot`   | Aims the nozzle spout into the opening. Pitch and roll both work. |
| `depth` | How far the spout sits inside the opening, from `0.00` to `0.08`. |

{% hint style="info" %}
`pos` is the **opening itself**, not where the player's hand should be. The script works the grip out from the spout.
{% endhint %}

### Finding The Numbers

Open the vehicle model in a viewer such as CodeWalker, put the cursor on the filler cap, and read off the local coordinates. Vehicle local `+Y` points forward and `+Z` points up.

For `rot`, start with `vec3(0, 0, -90)` for a filler on the left side and `vec3(0, 0, 90)` for the right. Bikes with a tank opening on top usually want `vec3(-90, 0, 0)`.

Adjust `depth` last, and only if the spout looks like it is hovering above the paint or buried in it.

{% hint style="warning" %}
Do not add an override just because you have not tested a vehicle. The automatic placement is sensible on the overwhelming majority of models, and an override that is slightly wrong looks worse than the automatic one.
{% endhint %}
