# SModularVehicle

## Index

### Functions Index

| Function Name                                                          |
| ---------------------------------------------------------------------- |
| void [**ForceSetOwner** ](#forcesetowner)(int newOwner, int vehicleId) |
| void [**ForceActivate** ](#forceactivate)()                            |
| void [**ForceDeactivate** ](#forcedeactivate)()                        |
| void [**SuppressTimeout** ](#suppresstimeout)()                        |
| void [**OverrideOnClick** ](#overrideonclick)(Closure onClick)         |

### Properties Index

| Property Name                                             |
| --------------------------------------------------------- |
| float [**VerticalInput** ](#verticalinput)`get` `set`     |
| float [**HorizontalInput** ](#horizontalinput)`get` `set` |
| float [**StrafeInput** ](#strafeinput)`get` `set`         |
| float [**DepthInput** ](#depthinput)`get` `set`           |
| bool [**IgnoreUserInput** ](#ignoreuserinput)`get` `set`  |
| SAvatar [**Driver** ](#driver)`get`                       |
| SGameObject [**GameObject** ](#gameobject)`get`           |

## Functions

### ForceSetOwner

void **ForceSetOwner** (int newOwner, int vehicleId)

*Force player of the id owned this vehicle, but only between this spawned vehicle. But it seems the new owner can’t drive on this vehicle.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.ForceSetOwner(AvatarID)
```

{% endtab %}
{% endtabs %}

### ForceActivate

void **ForceActivate** ()

*Force player drive on this vehicle*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.ForceActivate()
```

{% endtab %}
{% endtabs %}

### ForceDeactivate

void **ForceDeactivate** ()

*Force player out of the vehicle*.

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.ForceDeactivate()
```

{% endtab %}
{% endtabs %}

### SuppressTimeout

void **SuppressTimeout** ()

*Disable the vehicle automatic respawn*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.SuppressTimeout()
```

{% endtab %}
{% endtabs %}

### OverrideOnClick

void **OverrideOnClick** (Closure onClick)

*Add onClick method to this vehicle,onClick have to be a closure.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.OverrideOnClick(NewOnClickFunction)
```

{% endtab %}
{% endtabs %}

## Properties

### VerticalInput

float **VerticalInput** `get` `set`

*Force vertical offset value, it would be added to vertical control and never set to zero.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.VerticalInput = 0.5
```

{% endtab %}
{% endtabs %}

### HorizontalInput

float **HorizontalInput** `get` `set`

*Force horizontal offset value, it would be added to horizontal control and never set to zero.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.HorizontalInput = 0.5
```

{% endtab %}
{% endtabs %}

### StrafeInput

float **StrafeInput** `get` `set`

*Force strafe offset value,it would be added to strafe control and never set to zero.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.StrafeInput = 0.5
```

{% endtab %}
{% endtabs %}

### DepthInput

float **DepthInput** `get` `set`

*Force depth offset value, it would be added to depth control and never set to zero.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.DepthInput = 0.5
```

{% endtab %}
{% endtabs %}

### IgnoreUserInput

bool **IgnoreUserInput** `get` `set`

*If this option is enabled, user input would be ignored until disable this.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Vehicle.IgnoreUserInput = true
```

{% endtab %}
{% endtabs %}

### Driver

[SAvatar](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/savatar) **Driver** `get`

*Get the player avatar component.*

{% tabs %}
{% tab title="Lua" %}

```lua
DriverAvatar = Space.Host.ExecutingObject.Vehicle.Driver
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Returns the GameObject of this Vehicle component.*

{% tabs %}
{% tab title="Lua" %}

```lua
VehicleGameObject = Space.Host.ExecutingObject.Vehicle.GameObject
```

{% endtab %}
{% endtabs %}
