feat(exports/entities): persistent window state (smashed/intact)

This commit is contained in:
Linden
2022-01-31 23:44:48 +11:00
parent 12d42b6881
commit 4c70dbe64d

View File

@@ -109,6 +109,16 @@ function lib.getVehicleProperties(vehicle)
modDoorR = GetVehicleMod(vehicle, 47),
modLivery = modLivery,
modLightbar = GetVehicleMod(vehicle, 49),
windows = {
IsVehicleWindowIntact(vehicle, 0),
IsVehicleWindowIntact(vehicle, 1),
IsVehicleWindowIntact(vehicle, 2),
IsVehicleWindowIntact(vehicle, 3),
IsVehicleWindowIntact(vehicle, 4),
IsVehicleWindowIntact(vehicle, 5),
IsVehicleWindowIntact(vehicle, 6),
IsVehicleWindowIntact(vehicle, 7),
}
}
end
end
@@ -121,6 +131,7 @@ function lib.setVehicleProperties(vehicle, props)
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
SetVehicleModKit(vehicle, 0)
SetVehicleAutoRepairDisabled(vehicle, true)
if props.plate then
SetVehicleNumberPlateText(vehicle, props.plate)
@@ -202,6 +213,14 @@ function lib.setVehicleProperties(vehicle, props)
end
end
if props.windows then
for i = 1, #props.windows do
if props.windows[i] then
SmashVehicleWindow(vehicle, i - 1)
end
end
end
if props.neonColor then
SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3])
end