refactor(fuel): more consistency, now SetFuel doesnt return and every SetFuel as type, that will be used only by ti_fuel

This commit is contained in:
XenoS-ITA committed 2025-08-21 00:34:00 +02:00
1 parent 718214d135
commit 3289711297
14 files changed
+145 -118

No files matched your search

+11 -9
View File
@@ -2,26 +2,28 @@
Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@return string
Fuel.GetResourceName = function()
return 'default'
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
---Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return GetVehicleFuelLevel(vehicle)
end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
---@return nil
Fuel.SetFuel = function(vehicle, fuel)
Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end
return SetVehicleFuelLevel(vehicle, fuel)
SetVehicleFuelLevel(vehicle, fuel)
end
return Fuel