2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 09:04:53 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Checks for nearby running helicopters (within 15m)
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Radius to check for helicopter Default: 15 (optional) <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* <ARRAY>:
|
2015-04-06 16:22:43 +00:00
|
|
|
* 0: In rotorwash <BOOL>
|
|
|
|
* 1: Amount of rotor wash. <NUMBER>
|
2015-02-02 09:04:53 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* if (([ace_player, 10] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
|
|
|
|
* if (([ace_player] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-18 21:50:45 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
private ["_heli", "_unit", "_result", "_radius"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_radius = 15;
|
|
|
|
if (count _this > 1) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
_radius = _this select 1;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
_result = [false, _radius + 2];
|
|
|
|
|
|
|
|
_heli = (getPosATL _unit) nearEntities [["Helicopter"], _radius];
|
|
|
|
{
|
2015-04-06 16:22:43 +00:00
|
|
|
if !(_x isKindOf "ParachuteBase") then {
|
|
|
|
if (isEngineOn _x) then {
|
|
|
|
private "_distance";
|
|
|
|
_distance = (_radius - (_unit distance _x));
|
|
|
|
if (_distance != 0) then {
|
|
|
|
_distance = _distance / _radius;
|
|
|
|
};
|
|
|
|
if (_distance < (_result select 1)) then {
|
|
|
|
_result = [true, _distance];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
false
|
2015-01-11 16:42:31 +00:00
|
|
|
} count _heli;
|
|
|
|
|
|
|
|
_result
|