ACE3/addons/rearm/functions/fnc_getSupplyCount.sqf

39 lines
816 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2016-02-27 19:31:07 +00:00
/*
* Author: GitHawk
* Get the supply count.
*
* Arguments:
2016-02-27 20:05:19 +00:00
* 0: Ammo Truck <OBJECT>
2016-02-27 19:31:07 +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
*/
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 {
if (isNumber (configOf _truck >> QGVAR(defaultSupply))) then {
_supply = getNumber (configOf _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