2015-09-08 12:07:16 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Checks if unit has a spare magazine for the specified weapon.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-09-10 20:23:37 +00:00
|
|
|
* 0: Unit that passes the magazine <OBJECT>
|
|
|
|
* 1: Unit to pass the magazine to <OBJECT>
|
|
|
|
* 2: Weapon classname <STRING>
|
2015-09-08 12:07:16 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-09-10 20:23:37 +00:00
|
|
|
* [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine
|
2015-09-08 12:07:16 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
2015-09-10 20:23:37 +00:00
|
|
|
params ["_player", "_target", "_weapon"];
|
2015-09-11 13:36:23 +00:00
|
|
|
private ["_compatibleMags", "_filteredMags"];
|
2015-09-08 12:07:16 +00:00
|
|
|
|
|
|
|
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
|
2015-09-11 13:36:23 +00:00
|
|
|
_filteredMags = [magazinesAmmoFull _player, {
|
|
|
|
params ["_className", "", "_loaded"];
|
|
|
|
_className in _compatibleMags && !_loaded
|
|
|
|
}] call EFUNC(common,filter);
|
2015-09-08 12:07:16 +00:00
|
|
|
|
2015-09-11 16:24:46 +00:00
|
|
|
if (!(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}) then {
|
|
|
|
true
|
2015-09-10 20:23:37 +00:00
|
|
|
} else {
|
|
|
|
false
|
|
|
|
};
|