Skip to content

Conversation

@cyrrileric
Copy link

Description

This PR adds support for tracking completely broken-off vehicle wheels through a new brokenTyres field in the VehicleProperties class. This feature complements the existing tire damage tracking system by distinguishing between burst tires and completely missing wheels.

Changes

Added

  • brokenTyres field to VehicleProperties class definition
  • Detection logic using IsVehicleWheelBrokenOff native in getVehicleProperties
  • Setting logic using BreakOffVehicleWheel native in setVehicleProperties

Technical Details

  • Field Type: table<number | string, boolean> - tracks wheel index to broken status
  • Wheel Indices: Supports wheels 0-7 (standard GTA wheel indices)
  • Detection: Only wheels that are completely broken off are included in the table
  • Setting: Uses conservative parameters (no debris trail, no deletion, no fire)

Usage Examples

Getting broken wheels

local props = lib.getVehicleProperties(vehicle)
if props.brokenTyres then
    for wheelIndex, isBroken in pairs(props.brokenTyres) do
        if isBroken then
            print("Wheel " .. wheelIndex .. " is completely broken off")
        end
    end
end

Setting broken wheels

local props = {
    brokenTyres = {
        [0] = true,  -- Front left wheel broken off
        [1] = true,  -- Front right wheel broken off
    }
}
lib.setVehicleProperties(vehicle, props)

## Description

This PR adds support for tracking completely broken-off vehicle wheels through a new `brokenTyres` field in the VehicleProperties class. This feature complements the existing tire damage tracking system by distinguishing between burst tires and completely missing wheels.

## Changes

### Added
- `brokenTyres` field to VehicleProperties class definition
- Detection logic using `IsVehicleWheelBrokenOff` native in `getVehicleProperties`
- Setting logic using `BreakOffVehicleWheel` native in `setVehicleProperties`

### Technical Details
- **Field Type**: `table<number | string, boolean>` - tracks wheel index to broken status
- **Wheel Indices**: Supports wheels 0-7 (standard GTA wheel indices)
- **Detection**: Only wheels that are completely broken off are included in the table
- **Setting**: Uses conservative parameters (no debris trail, no deletion, no fire)

## Usage Examples

### Getting broken wheels
```lua
local props = lib.getVehicleProperties(vehicle)
if props.brokenTyres then
    for wheelIndex, isBroken in pairs(props.brokenTyres) do
        if isBroken then
            print("Wheel " .. wheelIndex .. " is completely broken off")
        end
    end
end
```

### Setting broken wheels
```lua
local props = {
    brokenTyres = {
        [0] = true,  -- Front left wheel broken off
        [1] = true,  -- Front right wheel broken off
    }
}
lib.setVehicleProperties(vehicle, props)
```

Signed-off-by: Praryo <cyrrilericv@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant