2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-13 17:33:55 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk
|
2015-08-20 20:10:26 +00:00
|
|
|
* Set the remaining fuel amount.
|
2015-08-13 17:33:55 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2017-09-10 19:43:03 +00:00
|
|
|
* 0: Fuel Source <OBJECT>
|
2015-08-21 20:43:45 +00:00
|
|
|
* 1: Amount (in liters)<NUMBER>
|
2015-08-13 17:33:55 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-14 01:18:54 +00:00
|
|
|
* None
|
2015-08-13 17:33:55 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-08-21 20:43:45 +00:00
|
|
|
* [fuelTruck, 42] call ace_refuel_fnc_setFuel
|
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
|
|
|
*/
|
2016-02-02 14:03:06 +00:00
|
|
|
|
2017-09-10 19:43:03 +00:00
|
|
|
params [["_source", objNull, [objNull]], ["_fuel", nil, [0]]];
|
2015-08-13 17:33:55 +00:00
|
|
|
|
2023-02-17 02:06:11 +00:00
|
|
|
// Ensure valid fuel quantity
|
|
|
|
if (isNull _source || {isNil "_fuel"}) exitWith {};
|
2015-08-13 17:33:55 +00:00
|
|
|
|
2023-02-17 02:06:11 +00:00
|
|
|
// Make sure this is actually a finite fuel source
|
|
|
|
private _capacity = [_source] call FUNC(getCapacity);
|
|
|
|
if (_capacity in [REFUEL_INFINITE_FUEL, REFUEL_DISABLED_FUEL]) exitWith {};
|
|
|
|
|
|
|
|
// Don't overfill or underfill tank
|
|
|
|
_source setVariable [QGVAR(currentFuelCargo), (_fuel min _capacity) max 0, true];
|