From ec95fef7f556469a4fbc4d27ca1c8420d5b758d0 Mon Sep 17 00:00:00 2001 From: Mojito-Fivem Date: Sun, 7 Nov 2021 11:15:17 +0000 Subject: [PATCH] refactor(client/functions): Remove local rounding function for QBCore.Shared.Round --- client/functions.lua | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index 70bd678..71e0ef4 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -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,