ACE3/addons/rearm/functions/fnc_canRearm.sqf

28 lines
713 B
Plaintext
Raw Normal View History

2015-08-15 16:43:13 +00:00
/*
* Author: GitHawk, Jonpas
* Check if a unit can rearm.
2015-08-15 16:43:13 +00:00
*
* Arguments:
* 0: Target <OBJECT>
* 1: Unit <OBJECT>
2015-08-15 16:43:13 +00:00
*
* Return Value:
* 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"
private ["_magazineClass", "_magazines", "_turretPath"];
params ["_target", "_unit"];
2015-08-15 16:43:13 +00:00
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_target distance _unit > REARM_ACTION_DISTANCE}) exitWith {false};
2015-08-15 16:43:13 +00:00
_magazineClass = _unit getVariable QGVAR(carriedMagazine);
if (isNil "_magazineClass") exitWith {false};
2015-08-15 16:43:13 +00:00
([_target, _magazines, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0