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-10-06 15:56:32 +00:00
|
|
|
*
|
2015-09-08 12:07:16 +00:00
|
|
|
* Return Value:
|
2015-10-06 15:56:32 +00:00
|
|
|
* Unit can pass magazine <BOOL>
|
2015-09-08 12:07:16 +00:00
|
|
|
*
|
|
|
|
* 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-08 12:07:16 +00:00
|
|
|
|
2015-11-24 18:07:17 +00:00
|
|
|
if (!GVAR(enableMagazinePassing)) exitWith {false};
|
2016-02-14 20:53:04 +00:00
|
|
|
if (((vehicle _target) != _target) && {(vehicle _target) != (vehicle _player)}) exitWith {false};
|
2015-11-24 18:07:17 +00:00
|
|
|
|
2016-02-14 20:53:04 +00:00
|
|
|
private _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
|
2015-09-11 21:52:00 +00:00
|
|
|
{
|
|
|
|
_x params ["_className", "", "_loaded"];
|
|
|
|
if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true};
|
2015-09-10 20:23:37 +00:00
|
|
|
false
|
2015-10-06 15:56:32 +00:00
|
|
|
} foreach (magazinesAmmoFull _player);
|