ACE3/addons/rearm/functions/fnc_isSource.sqf
PabstMirror e8693c8db9
Various - Use configOf command for faster lookup (#8100)
* configOf

* replace some use of CBA_fnc_getObjectConfig
2021-02-18 12:58:08 -06:00

31 lines
851 B
Plaintext

#include "script_component.hpp"
/*
* Author: shukari
* Returns if vehicle or object is a rearm source.
*
* Arguments:
* 0: target <OBJECT>
* 1: check for vanilla rearm vehicle <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* [cursorObject] call ace_rearm_fnc_isSource
*
* Public: Yes
*/
params [
["_target", objNull, [objNull]],
["_testVanillaRearm", false, [false]]
];
if ((_target getVariable [QGVAR(currentSupply), 0]) < 0) exitWith {false};
private _vehCfg = configOf _target;
private _vanillaCargoConfig = getNumber (_vehCfg >> "transportAmmo");
private _rearmCargoConfig = getNumber (_vehCfg >> QGVAR(defaultSupply));
private _supplyVehicle = _target getVariable [QGVAR(isSupplyVehicle), false];
_rearmCargoConfig > 0 || {_supplyVehicle} || {_testVanillaRearm && _vanillaCargoConfig > 0}