diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index ddc05e6b87..1af09827ab 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -6,15 +6,13 @@ * None * * Return Value: - * Whether the camera is in external view or not. If the "showInThirdPerson" option is checked, this will always return false. + * Whether the camera is in external view or not. * * Example: - * call ace_goggles_fnc_removeRainEffect; + * call ace_goggles_fnc_externalCamera; * * Public: Yes */ #include "script_component.hpp" -if (GVAR(showInThirdPerson)) exitWith { false }; - -(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) +cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive) // return diff --git a/addons/goggles/functions/fnc_getExplosionIndex.sqf b/addons/goggles/functions/fnc_getExplosionIndex.sqf index 6e16085b2c..9d7c4004c7 100644 --- a/addons/goggles/functions/fnc_getExplosionIndex.sqf +++ b/addons/goggles/functions/fnc_getExplosionIndex.sqf @@ -1,5 +1,5 @@ /* - * Author: Garth 'L-H' de Wet + * Author: Garth 'L-H' de Wet, commy2 * Turns 0-1 damage of explosion Event into a rating system of 0-3 * * Arguments: @@ -13,13 +13,12 @@ * * Public: No */ -private ["_effectIndex"]; +#include "script_component.hpp" -_effectIndex = switch true do { - case (_this <= 0.04): {0}; - case (_this <= 0.06): {1}; - case (_this <= 0.09): {2}; - default {3}; -}; +params ["_damage"]; -_effectIndex +if (_damage <= 0.04) exitWith {0}; +if (_damage <= 0.06) exitWith {1}; +if (_damage <= 0.09) exitWith {2}; + +3 diff --git a/addons/goggles/functions/fnc_isInRotorWash.sqf b/addons/goggles/functions/fnc_isInRotorWash.sqf index ef6391fdc6..5ddc59192a 100644 --- a/addons/goggles/functions/fnc_isInRotorWash.sqf +++ b/addons/goggles/functions/fnc_isInRotorWash.sqf @@ -1,10 +1,10 @@ /* - * Author: Garth 'L-H' de Wet + * Author: Garth 'L-H' de Wet, commy2 * Checks for nearby running helicopters (within 15m) * * Arguments: * 0: Unit - * 1: Radius to check for helicopter Default: 15 (optional) + * 1: Radius to check for helicopter (default: 15) * * Return Value: * : @@ -12,35 +12,31 @@ * 1: Amount of rotor wash. * * 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"; }; + * 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 */ #include "script_component.hpp" -private ["_heli", "_unit", "_result", "_radius"]; -_unit = _this select 0; -_radius = 15; -if (count _this > 1) then { - _radius = _this select 1; -}; -_result = [false, _radius + 2]; -_heli = (getPosATL _unit) nearEntities [["Helicopter"], _radius]; +params ["_unit", ["_radius", 15]]; + +local _rotorWash = [false, 0]; + { - 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]; - }; + if (isEngineOn _x) then { + local _distance = _unit distance _x; + + // convert distance to 0...1 range, where 0 is the maximum radius + _distance = 1 - _distance / _radius; + + // use highest amount of rotor wash as return value in case of multiple helicopters + if (_distance > _rotorWash select 1) then { + _rotorWash set [0, true]; + _rotorWash set [1, _distance]; }; }; false -} count _heli; +} count (position _unit nearEntities [["Helicopter"], _radius]); -_result +_rotorWash