2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-08 06:26:15 +00:00
|
|
|
/*
|
2015-08-10 06:45:43 +00:00
|
|
|
* Author: Dslyecxi, MikeMatrix
|
2015-08-08 06:26:15 +00:00
|
|
|
* Returns all players in a given range and in the units vehicle.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2020-06-19 15:35:57 +00:00
|
|
|
* 0: Positions (objects or posAGLs) <ARRAY>
|
2015-08-08 06:26:15 +00:00
|
|
|
* 1: Range <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2020-08-18 17:44:16 +00:00
|
|
|
* All units in proximity with Distances to render from <ARRAY<ARRAY<OBJECT,NUMBER>>>
|
2015-08-08 06:26:15 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2020-08-18 17:44:16 +00:00
|
|
|
* [[[player, 6]]] call ace_map_gestures_fnc_getProximityPlayers
|
2015-08-08 06:26:15 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2020-06-19 15:35:57 +00:00
|
|
|
private _proximityPlayers = [];
|
2016-10-27 17:54:58 +00:00
|
|
|
|
2020-08-18 17:44:16 +00:00
|
|
|
private _fnc_getProximitsPlayers = {
|
|
|
|
{
|
|
|
|
_x params ["_position", ["_range", GVAR(maxRange)]];
|
|
|
|
private _temp = (_position nearEntities [["CAMAnBase"], _range]);
|
|
|
|
if (_position isEqualType objNull) then {
|
|
|
|
_temp append (crew vehicle _position);
|
|
|
|
if (GVAR(onlyShowFriendlys)) then {
|
|
|
|
_temp = _temp select { [side group _position, side _x] call BIS_fnc_areFriendly; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
_proximityPlayers append _temp;
|
|
|
|
} forEach _this;
|
|
|
|
};
|
|
|
|
|
|
|
|
switch (_this) do {
|
|
|
|
case (0): { // All
|
|
|
|
_proximityPlayers append allUnits;
|
|
|
|
};
|
|
|
|
case (1): { // Players in Group
|
2020-12-02 14:49:35 +00:00
|
|
|
_proximityPlayers append units ace_player;
|
2020-08-18 17:44:16 +00:00
|
|
|
};
|
|
|
|
case (2): { // Players on Side
|
|
|
|
_proximityPlayers append (allUnits select {side (group _x) == side (group ace_player)});
|
|
|
|
};
|
|
|
|
case (3): { // Proximity
|
|
|
|
[[ace_player, GVAR(maxRange)]] call _fnc_getProximitsPlayers;
|
2020-06-19 15:35:57 +00:00
|
|
|
};
|
2020-08-18 17:44:16 +00:00
|
|
|
case (4): {}; // Disabled
|
|
|
|
default {
|
|
|
|
_this call _fnc_getProximitsPlayers;
|
|
|
|
};
|
|
|
|
};
|
2020-06-19 15:35:57 +00:00
|
|
|
|
|
|
|
_proximityPlayers = _proximityPlayers arrayIntersect _proximityPlayers;
|
|
|
|
_proximityPlayers = _proximityPlayers select { [_x, false] call EFUNC(common,isPlayer); };
|
|
|
|
_proximityPlayers
|