2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
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
|
|
|
|
*/
|
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};
|
2019-04-07 12:22:25 +00:00
|
|
|
if (_weapon isEqualTo "") 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
|
|
|
|
2019-03-31 01:49:59 +00:00
|
|
|
private _compatibleMags = [_weapon] call CBA_fnc_compatibleMagazines;
|
|
|
|
|
|
|
|
(magazinesAmmoFull _player) findIf {
|
2015-09-11 21:52:00 +00:00
|
|
|
_x params ["_className", "", "_loaded"];
|
2021-02-27 16:26:12 +00:00
|
|
|
(_className in _compatibleMags) && {!_loaded} && {[_target, _className] call CBA_fnc_canAddItem}
|
2019-03-31 01:49:59 +00:00
|
|
|
} > -1
|