2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-01-14 01:57:15 +00:00
|
|
|
Name: ACE_SwitchUnits_fnc_handleMapClick
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
Author(s):
|
|
|
|
bux578
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Finds the clicked unit
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
0: OBJECT - MapClickEventHandlerArgs
|
2015-01-27 08:01:57 +00:00
|
|
|
0: OBJECT - unit // useless
|
2015-01-11 16:42:31 +00:00
|
|
|
1: ARRAY<OBJECT> - sides
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
VOID
|
|
|
|
*/
|
|
|
|
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-27 08:01:57 +00:00
|
|
|
private ["_sides", "_pos", "_sideNearest"];
|
|
|
|
|
|
|
|
// that's wrong
|
|
|
|
//_currentPlayerUnit = (_this select 0) select 0;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_sides = (_this select 0) select 1;
|
|
|
|
_pos = _this select 1;
|
|
|
|
|
|
|
|
_sideNearest = [];
|
|
|
|
|
|
|
|
{
|
2015-01-12 14:47:22 +00:00
|
|
|
if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then {
|
2015-01-11 16:42:31 +00:00
|
|
|
_sideNearest pushBack _x;
|
|
|
|
};
|
|
|
|
} forEach (nearestObjects [_pos, ["Man"], 20]);
|
|
|
|
|
|
|
|
|
|
|
|
if (count _sideNearest > 0) then {
|
|
|
|
private ["_switchUnit"];
|
|
|
|
|
|
|
|
_switchUnit = _sideNearest select 0;
|
2015-01-27 08:01:57 +00:00
|
|
|
[ACE_player, _switchUnit] call FUNC(switchUnit);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
openMap false;
|
|
|
|
};
|