2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 22:28:27 +00:00
|
|
|
* Author: bux578
|
|
|
|
* Switches to a unit close to a clicked map position
|
|
|
|
*
|
|
|
|
* Arguments:
|
2017-06-08 13:31:51 +00:00
|
|
|
* 0: Faction <ARRAY>
|
2015-08-07 07:18:42 +00:00
|
|
|
* 0: unit <OBJECT>
|
|
|
|
* 1: sides <ARRAY>
|
|
|
|
* 1: Map Position <ARRAY>
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-08-07 07:18:42 +00:00
|
|
|
* [[unit, _sides], [20, 30]] call ace_switchunits_fnc_handleMapClick
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 07:18:42 +00:00
|
|
|
params ["_faction", "_pos"];
|
|
|
|
_faction params ["", "_sides"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2016-01-10 18:08:28 +00:00
|
|
|
private _sideNearest = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
{
|
2015-02-02 22:28:27 +00:00
|
|
|
if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then {
|
|
|
|
_sideNearest pushBack _x;
|
|
|
|
};
|
2015-08-07 07:18:42 +00:00
|
|
|
nil
|
|
|
|
} count (nearestObjects [_pos, ["Man"], 15]);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (count _sideNearest > 0) then {
|
2015-05-09 12:05:58 +00:00
|
|
|
[_sideNearest select 0] call FUNC(switchUnit);
|
2015-02-02 22:28:27 +00:00
|
|
|
openMap false;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|