2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2016-05-18 20:19:52 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
|
|
|
* Commands the group the module is placed on to search the nearest building
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The module logic <OBJECT>
|
|
|
|
* 1: Synchronized units <ARRAY>
|
|
|
|
* 2: Activated <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2016-11-15 12:07:48 +00:00
|
|
|
* None
|
2016-05-18 20:19:52 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleSearchNearby
|
|
|
|
*
|
2016-05-18 20:19:52 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2017-12-10 18:29:38 +00:00
|
|
|
params ["_logic"];
|
2016-05-18 20:19:52 +00:00
|
|
|
|
2017-12-10 18:29:38 +00:00
|
|
|
if !(local _logic) exitWith {};
|
2016-05-18 20:19:52 +00:00
|
|
|
|
|
|
|
//Validate the module target:
|
|
|
|
private _unit = effectiveCommander (attachedTo _logic);
|
|
|
|
private _building = nearestBuilding (getPosASL _unit);
|
|
|
|
|
|
|
|
scopeName "Main";
|
|
|
|
private _fnc_errorAndClose = {
|
|
|
|
params ["_msg"];
|
|
|
|
deleteVehicle _logic;
|
2017-03-02 23:47:49 +00:00
|
|
|
[_msg] call FUNC(showMessage);
|
2016-05-18 20:19:52 +00:00
|
|
|
breakOut "Main";
|
|
|
|
};
|
|
|
|
|
|
|
|
switch (false) do {
|
|
|
|
case !(isNull _unit): {
|
|
|
|
[LSTRING(NothingSelected)] call _fnc_errorAndClose;
|
|
|
|
};
|
|
|
|
case (_unit isKindOf "CAManBase"): {
|
|
|
|
[LSTRING(OnlyInfantry)] call _fnc_errorAndClose;
|
|
|
|
};
|
|
|
|
case (alive _unit): {
|
|
|
|
[LSTRING(OnlyAlive)] call _fnc_errorAndClose;
|
|
|
|
};
|
|
|
|
case (_unit distance _building < 500): {
|
|
|
|
[LSTRING(BuildingTooFar)] call _fnc_errorAndClose;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//Perform the module function:
|
2016-06-11 20:02:16 +00:00
|
|
|
[QGVAR(moduleSearchNearby), [_unit], _unit] call CBA_fnc_targetEvent;
|
2016-05-19 21:32:05 +00:00
|
|
|
deleteVehicle _logic;
|