ACE3/addons/refuel/functions/fnc_getFuel.sqf

30 lines
601 B
Plaintext
Raw Normal View History

2015-08-13 17:33:55 +00:00
/*
* Author: GitHawk, Jonpas
* Get the remaining fuel amount.
2015-08-13 17:33:55 +00:00
*
* Arguments:
* 0: Target <OBJECT>
2015-08-13 17:33:55 +00:00
*
* Return Value:
2015-08-14 01:18:54 +00:00
* Fuel left (in liters) <NUMBER>
2015-08-13 17:33:55 +00:00
*
* Example:
2015-08-21 20:43:45 +00:00
* [fuelTruck] call ace_refuel_fnc_getFuel
2015-08-13 17:33:55 +00:00
*
2016-02-26 09:50:02 +00:00
* Public: Yes
2015-08-13 17:33:55 +00:00
*/
#include "script_component.hpp"
params [["_target", objNull, [objNull]]];
2015-08-14 01:18:54 +00:00
2016-02-26 09:50:02 +00:00
if (isNull _target) exitWith {0};
private _fuel = _target getVariable QGVAR(currentFuelCargo);
2015-08-13 17:33:55 +00:00
if (isNil "_fuel") then {
2015-08-14 01:18:54 +00:00
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];
2015-08-13 17:33:55 +00:00
};
_fuel