2015-08-15 16:43:13 +00:00
|
|
|
/*
|
2015-08-18 00:32:10 +00:00
|
|
|
* Author: GitHawk, Jonpas
|
|
|
|
* Check if a unit can rearm.
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-18 01:37:02 +00:00
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Unit <OBJECT>
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-18 00:32:10 +00:00
|
|
|
* Can Rearm <BOOL>
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, tank] call ace_rearm_fnc_canRearm
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-19 23:20:31 +00:00
|
|
|
private ["_dummy","_magazineClass"];
|
2016-02-01 19:05:53 +00:00
|
|
|
params [["_target", objNull, [objNull]], ["_unit", objNull, [objNull]]];
|
2015-08-15 16:43:13 +00:00
|
|
|
|
2015-11-23 16:08:06 +00:00
|
|
|
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_target distance _unit > REARM_ACTION_DISTANCE} || {_target getVariable [QGVAR(disabled), false]}) exitWith {false};
|
2015-08-15 16:43:13 +00:00
|
|
|
|
2015-08-19 23:20:31 +00:00
|
|
|
_dummy = _unit getVariable [QGVAR(dummy), objNull];
|
|
|
|
if (isNull _dummy) exitwith {false};
|
|
|
|
_magazineClass = _dummy getVariable QGVAR(magazineClass);
|
2015-08-18 00:32:10 +00:00
|
|
|
if (isNil "_magazineClass") exitWith {false};
|
2015-08-15 16:43:13 +00:00
|
|
|
|
2015-08-18 14:20:11 +00:00
|
|
|
([_target, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0
|