# Impulsor

## 1. Configuration

Making a vehicle use the impulsor framework is very straightforward. Previous iterations required calling the `ls_vehicle_fnc_impulsorMonitor` function, this is no longer the case. This function is no longer used, but kept for backwards compatibility.

Here is an example setup for the impulsor framework using default values:

```cpp
// This class contains default values for impulse settings
// It is strongly encouraged to use this class or inherit
// from the ls_impulsor class of a vehicle itself.
class ls_impulsor_base {
    enabled = 1; // 0-Disabled, 1-Enabled 
    speed = 400; // Speed in km/h
    fuelDrain = 0.0001; // Percent of fuel used every 1/2 seconds
    overchargeSpeed = 600; // Same but for overcharge
    overchargeFuelDrain = 0.0003; // Same but for overcharge
    // Time in seconds before overcharge can be used after turning it off
    overchargeCooldown = 60;

    // CfgSounds class to play when impulse is activated
    impulseSoundOn = "ls_impulseOn_laat";
    // CfgSounds class to play when impulse is de-activated
    impulseSoundOff = "ls_impulseOff_laat";
    repulseSoundOn = ""; // Same but for repulse
    repulseSoundOff = ""; // Same but for repulss
};

class CfgVehicles {
    class ls_laati;
    class TAG_myLAATi: ls_laati {
        class ls_impulsor: ls_impulsor_base {
            // Whatever changes you'd like here
        };
    };
};
```

## 2. Events

### 2.1 Listenable

| Name                       | Description                          | Arguments                                                       | Global / Local |
| -------------------------- | ------------------------------------ | --------------------------------------------------------------- | -------------- |
| `ls_impulsor_activated`    | Vehicle's impulsor is activated.     | `[_vehicle, _impulseSettings]`                                  | Global         |
| `ls_impulsor_deactivated`  | Vehicle's impulsor is deactivated.   | `[_vehicle, _impulseSettings]`                                  | Global         |
| `ls_impulsor_levelChanged` | Vehicle's impulsor level is changed. | `[_vehicle, _impulseSettings, _impulseLevel, _oldImpulseLevel]` | Local          |

## 3. Variables

| Name                           | Description                            | Type    |
| ------------------------------ | -------------------------------------- | ------- |
| `ls_impulsor_active`           | Whether the impulsor is active or not. | Boolean |
| `ls_impulsor_level`            | The current impulsor mode.             | Number  |
| `ls_impulsor_overchargeActive` | Whether overcharge is active or not.   | Boolean |


---

# 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://legion-studios.gitbook.io/legion-studios/frameworks/impulsor.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.
