Skip to content

Commit

Permalink
feat(natives/vehicle): update body damage vehicles natives (#1066)
Browse files Browse the repository at this point in the history
* feat(natives/vehicle): update body damage vehicles natives

* Update SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE
* Update SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION

* Update SetDisableExplodeFromBodyDamageOnCollision.md

Capitalize `bool` parameter.

* Update SetDisableHeliExplodeFromBodyDamage.md

Capitalize `bool` parameter.

* Update SetDisableExplodeFromBodyDamageOnCollision.md

---------

Co-authored-by: ammonia-cfx <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Mar 16, 2024
1 parent f76d654 commit 73d64e1
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 32 deletions.
17 changes: 0 additions & 17 deletions VEHICLE/N_0x26e13d440e7f6064.md

This file was deleted.

15 changes: 0 additions & 15 deletions VEHICLE/N_0xedbc8405b3895cc9.md

This file was deleted.

58 changes: 58 additions & 0 deletions VEHICLE/SetDisableExplodeFromBodyDamageOnCollision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
ns: VEHICLE
aliases: ["0x26E13D440E7F6064"]
---
## SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION

```c
// 0x26E13D440E7F6064
void SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION(Vehicle vehicle, cs_type(float) BOOL disableExplode);
```
Prevents a vehicle from exploding upon sustaining body damage from physical collisions. This can be used to increase the durability of vehicles in high-impact scenarios, such as races or combat situations, by preventing them from being destroyed due to collision-induced body damage.
For helicopters, you might want to check [`SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE`](#_0xEDBC8405B3895CC9) instead.
```
NativeDB Introduced: v1290
```
## Parameters
* **vehicle**: The vehicle to apply this setting to.
* **disableExplode**: `true` to disable explosion from body damage on collision; `false` to allow explosions as normal.
## Examples
```lua
-- Retrieve the player ped
local playerPed = PlayerPedId()
-- Retrieve the vehicle the player is currently in
local vehicle = GetVehiclePedIsIn(playerPed, false)
-- Disable explosion from body damage on collision for the vehicle
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true)
```

```javascript
// Retrieve the player ped
const playerPed = PlayerPedId();

// Retrieve the vehicle the player is currently in
const vehicle = GetVehiclePedIsIn(playerPed, false);

// Disable explosion from body damage on collision for the vehicle
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true);
```

```csharp
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Ped playerPed = PlayerPedId();

// Retrieve the vehicle the player is currently in
Vehicle vehicle = GetVehiclePedIsIn(playerPed, false);

// Disable explosion from body damage on collision for the vehicle
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true);
```
65 changes: 65 additions & 0 deletions VEHICLE/SetDisableHeliExplodeFromBodyDamage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
ns: VEHICLE
aliases: ["0xEDBC8405B3895CC9"]
---
## SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE

```c
// 0xEDBC8405B3895CC9
void SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE(Vehicle helicopter, cs_type(Any) BOOL disableExplode);
```
Prevents a helicopter from exploding due to relatively minor body damage. This native can be particularly useful in gameplay scenarios or missions where helicopters are subject to damage that would not realistically cause an explosion, ensuring they remain operational unless subjected to more significant damage.
```
NativeDB Introduced: v1103
```
## Parameters
* **helicopter**: The helicopter to apply this setting to.
* **disableExplode**: `true` to disable explosion from body damage on collision; `false` to allow explosions as normal.
## Examples
```lua
-- Retrieve the player ped.
local playerPed = PlayerPedId()
-- Retrieve the helicopter the player is currently in.
local helicopter = GetVehiclePedIsIn(playerPed, false)
-- If the player is not in a helicopter, or the vehicle is not a helicopter, return.
if (helicopter == 0) or (not IsThisModelAHeli(GetEntityModel(helicopter))) then return end
-- Disable explosion from body damage for the helicopter.
SetDisableHeliExplodeFromBodyDamage(helicopter, true)
```

```javascript
// Retrieve the player ped.
const playerPed = PlayerPedId();

// Retrieve the helicopter the player is currently in.
const helicopter = GetVehiclePedIsIn(playerPed, false);

// If the player is not in a helicopter, or the vehicle is not a helicopter, return.
if (helicopter === 0 || !IsThisModelAHeli(GetEntityModel(helicopter))) return;

// Disable explosion from body damage for the helicopter.
SetDisableHeliExplodeFromBodyDamage(helicopter, true);
```

```csharp
using static CitizenFX.Core.Native.API;

// Retrieve the player ped.
Ped playerPed = PlayerPedId();

// Retrieve the helicopter the player is currently in.
Vehicle helicopter = GetVehiclePedIsIn(playerPed, false);

// If the player is not in a helicopter, or the vehicle is not a helicopter, return.
if (helicopter == 0 || !IsThisModelAHeli(GetEntityModel(helicopter))) return;

// Disable explosion from body damage for the helicopter.
SetDisableHeliExplodeFromBodyDamage(helicopter, true);
```

0 comments on commit 73d64e1

Please sign in to comment.