ACE3/addons/kestrel4500/functions/fnc_measureWindSpeed.sqf
Dedmen Miller 81e02a7336 Refactor private ARRAY to private keyword (#5598)
* Everything

* Fixed missing ;

* Fix missing ; and double private

* Fixed cannot isNull on number

* Turn _temparture back to isNil

* Fix error from merge
2017-10-10 09:39:59 -05:00

40 lines
1.2 KiB
Plaintext

/*
* Author: Ruthberg
* Measures the wind speed, stores the information in GVAR(MeasuredWindSpeed) and updates GVAR(ImpellerState)
*
* Arguments:
* None
*
* Return Value:
* wind speed <NUMBER>
*
* Example:
* call ace_kestrel4500_fnc_canShow
*
* Public: No
*/
#include "script_component.hpp"
private _playerDir = getDir ACE_player;
private _windSpeed = vectorMagnitude ACE_wind;
private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
// With wind gradient
_windSpeed = [eyePos ACE_player, true, true, true] call EFUNC(weather,calculateWindSpeed);
_windSpeed = abs(cos(_playerDir - _windDir)) * _windSpeed;
} else {
// Without wind gradient
_windSpeed = [eyePos ACE_player, false, true, true] call EFUNC(weather,calculateWindSpeed);
};
if (_windSpeed > 0.3 || {GVAR(MeasuredWindSpeed) > 0.1 && _windSpeed > 0.125}) then {
GVAR(MeasuredWindSpeed) = _windSpeed;
} else {
GVAR(MeasuredWindSpeed) = GVAR(MeasuredWindSpeed) * 0.99;
if (GVAR(MeasuredWindSpeed) < 0.05) then {
GVAR(MeasuredWindSpeed) = 0;
};
};
GVAR(MeasuredWindSpeed)