refactor(client/functions): Remove local rounding function for QBCore.Shared.Round

This commit is contained in:
Mojito-Fivem
2021-11-07 11:15:17 +00:00
parent ce56fea2b0
commit ec95fef7f5
+5 -14
View File
@@ -265,15 +265,6 @@ end
-- Vehicle
local function Round(value, numDecimalPlaces)
if numDecimalPlaces then
local power = 10 ^ numDecimalPlaces
return math.floor((value * power) + 0.5) / (power)
else
return math.floor(value + 0.5)
end
end
local function Trim(value)
if value then
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
@@ -343,11 +334,11 @@ function QBCore.Functions.GetVehicleProperties(vehicle)
model = GetEntityModel(vehicle),
plate = Trim(GetVehicleNumberPlateText(vehicle)),
plateIndex = GetVehicleNumberPlateTextIndex(vehicle),
bodyHealth = Round(GetVehicleBodyHealth(vehicle), 1),
engineHealth = Round(GetVehicleEngineHealth(vehicle), 1),
tankHealth = Round(GetVehiclePetrolTankHealth(vehicle), 1),
fuelLevel = Round(GetVehicleFuelLevel(vehicle), 1),
dirtLevel = Round(GetVehicleDirtLevel(vehicle), 1),
bodyHealth = QBCore.Shared.Round(GetVehicleBodyHealth(vehicle), 0.1),
engineHealth = QBCore.Shared.Round(GetVehicleEngineHealth(vehicle), 0.1),
tankHealth = QBCore.Shared.Round(GetVehiclePetrolTankHealth(vehicle), 0.1),
fuelLevel = QBCore.Shared.Round(GetVehicleFuelLevel(vehicle), 0.1),
dirtLevel = QBCore.Shared.Round(GetVehicleDirtLevel(vehicle), 0.1),
color1 = colorPrimary,
color2 = colorSecondary,
pearlescentColor = pearlescentColor,