mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d339b9567d
WIP
42 lines
754 B
Plaintext
42 lines
754 B
Plaintext
/*
|
|
* Author: bux578
|
|
* Switches to a unit close to a clicked map position
|
|
*
|
|
* Arguments:
|
|
* 0: unit <OBJECT>
|
|
* 1: sides <ARRAY<OBJECT>>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [_unit, _sides] call FUNC(handleMapClick)
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
private ["_sides", "_pos", "_sideNearest"];
|
|
|
|
_sides = (_this select 0) select 1;
|
|
_pos = _this select 1;
|
|
|
|
_sideNearest = [];
|
|
|
|
{
|
|
if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then {
|
|
_sideNearest pushBack _x;
|
|
};
|
|
} forEach (nearestObjects [_pos, ["Man"], 20]);
|
|
|
|
|
|
if (count _sideNearest > 0) then {
|
|
private ["_switchUnit"];
|
|
|
|
_switchUnit = _sideNearest select 0;
|
|
[ACE_player, _switchUnit] call FUNC(switchUnit);
|
|
|
|
openMap false;
|
|
};
|