Skip to content

Commit

Permalink
Merge pull request #1333 from itsmaty/refactor-vehicle-burst-tyres
Browse files Browse the repository at this point in the history
refactor(client/functions): refactor getting burst tyres on vehicle
  • Loading branch information
Gellipapa authored Mar 18, 2024
2 parents 98f8fc0 + 16c9913 commit a5157bd
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions [core]/es_extended/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,15 @@ function ESX.Game.GetVehicleProperties(vehicle)
end

local doorsBroken, windowsBroken, tyreBurst = {}, {}, {}
local numWheels = tostring(GetVehicleNumberOfWheels(vehicle))

local TyresIndex = { -- Wheel index list according to the number of vehicle wheels.
["2"] = { 0, 4 }, -- Bike and cycle.
["3"] = { 0, 1, 4, 5 }, -- Vehicle with 3 wheels (get for wheels because some 3 wheels vehicles have 2 wheels on front and one rear or the reverse).
["4"] = { 0, 1, 4, 5 }, -- Vehicle with 4 wheels.
["6"] = { 0, 1, 2, 3, 4, 5 }, -- Vehicle with 6 wheels.
}

if TyresIndex[numWheels] then
for _, idx in pairs(TyresIndex[numWheels]) do
tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false)
end
local wheel_count = GetVehicleNumberOfWheels(vehicle);

for wheel_index = 0, wheel_count - 1 do
tyreBurst[tostring(wheel_index)] = IsVehicleTyreBurst(vehicle, wheel_index, false)
end


for windowId = 0, 7 do -- 13
RollUpWindow(vehicle, windowId) --fix when you put the car away with the window down
windowsBroken[tostring(windowId)] = not IsVehicleWindowIntact(vehicle, windowId)
Expand Down

0 comments on commit a5157bd

Please sign in to comment.