ACE3/addons/refuel/functions/fnc_setFuel.sqf

25 lines
636 B
Plaintext
Raw Normal View History

2015-08-13 17:33:55 +00:00
/*
* Author: GitHawk
* Set the remaining fuel amount
*
* Arguments:
* 0: The unit <OBJECT>
* 1: The target <OBJECT>
* 2: The amout <NUMBER>
*
* Return Value:
2015-08-14 01:18:54 +00:00
* None
2015-08-13 17:33:55 +00:00
*
* Example:
* [unit, target] call ace_refuel_fnc_getFuel
*
2015-08-14 01:18:54 +00:00
* Public: No
2015-08-13 17:33:55 +00:00
*/
#include "script_component.hpp"
2015-08-14 01:18:54 +00:00
private ["_maxFuel"];
2015-08-13 17:33:55 +00:00
params ["_unit", "_target", "_fuel"];
if (isNull _unit || {isNull _target} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0};
2015-08-14 01:18:54 +00:00
_target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true];