2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2016-02-27 19:31:07 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk
|
|
|
|
* Get the supply count.
|
|
|
|
*
|
2016-06-06 18:42:20 +00:00
|
|
|
* Arguments:
|
2016-02-27 20:05:19 +00:00
|
|
|
* 0: Ammo Truck <OBJECT>
|
2016-02-27 19:31:07 +00:00
|
|
|
*
|
2016-06-06 18:42:20 +00:00
|
|
|
* Return Value:
|
2016-02-27 19:31:07 +00:00
|
|
|
* Supply count <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ammo_truck] call ace_rearm_fnc_getSupplyCount
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2017-06-08 16:47:52 +00:00
|
|
|
params [["_truck", objNull, [objNull]]];
|
|
|
|
|
|
|
|
if (GVAR(supply) != 1) exitWith {
|
|
|
|
WARNING("supply setting is not set to limited"); // func shouldn't have been called
|
|
|
|
-1
|
|
|
|
};
|
2016-02-27 19:31:07 +00:00
|
|
|
|
2016-02-27 20:05:19 +00:00
|
|
|
private _supply = _truck getVariable QGVAR(currentSupply);
|
2016-02-27 19:31:07 +00:00
|
|
|
|
|
|
|
if (isNil "_supply") then {
|
2017-06-08 16:47:52 +00:00
|
|
|
if (isNumber (configFile >> "CfgVehicles" >> typeOf _truck >> QGVAR(defaultSupply))) then {
|
|
|
|
_supply = getNumber (configFile >> "CfgVehicles" >> typeOf _truck >> QGVAR(defaultSupply));
|
|
|
|
} else {
|
|
|
|
_supply = 1200;
|
|
|
|
};
|
|
|
|
if (_supply > 0) then {
|
|
|
|
_truck setVariable [QGVAR(currentSupply), _supply, true];
|
|
|
|
};
|
2016-02-27 19:31:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_supply
|