ACE3/addons/rearm/functions/fnc_getSupplyCount.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

39 lines
816 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: GitHawk
* Get the supply count.
*
* Arguments:
* 0: Ammo Truck <OBJECT>
*
* Return Value:
* 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
};
private _supply = _truck getVariable QGVAR(currentSupply);
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];
};
};
_supply