2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-13 09:53:19 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Measures the wind speed, stores the information in GVAR(MeasuredWindSpeed) and updates GVAR(ImpellerState)
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-13 23:55:54 +00:00
|
|
|
* None
|
2015-04-13 09:53:19 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* wind speed <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
2020-04-25 06:41:45 +00:00
|
|
|
* call ace_kestrel4500_fnc_measureWindSpeed
|
2015-04-13 09:53:19 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _playerDir = getDir ACE_player;
|
2017-11-10 14:44:15 +00:00
|
|
|
private _windSpeed = vectorMagnitude wind;
|
|
|
|
private _windDir = (wind select 0) atan2 (wind select 1);
|
2015-04-13 09:53:19 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
2015-05-11 08:59:07 +00:00
|
|
|
// With wind gradient
|
|
|
|
_windSpeed = [eyePos ACE_player, true, true, true] call EFUNC(weather,calculateWindSpeed);
|
2015-04-13 09:53:19 +00:00
|
|
|
_windSpeed = abs(cos(_playerDir - _windDir)) * _windSpeed;
|
|
|
|
} else {
|
2015-05-11 08:59:07 +00:00
|
|
|
// Without wind gradient
|
|
|
|
_windSpeed = [eyePos ACE_player, false, true, true] call EFUNC(weather,calculateWindSpeed);
|
2015-04-13 09:53:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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)
|