2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-04-07 15:58:54 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Gathers the weather data for the Kestrel 4500
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-13 23:55:54 +00:00
|
|
|
* None
|
2015-04-07 15:58:54 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-13 23:55:54 +00:00
|
|
|
* None
|
2015-04-07 15:58:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-08-13 23:55:54 +00:00
|
|
|
* call ace_kestrel4500_fnc_collectData
|
2015-04-07 15:58:54 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2024-01-07 23:13:46 +00:00
|
|
|
#define TEMPERATURE_SLOT_INDEX 5
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _playerDir = getDir ACE_player;
|
|
|
|
private _playerAltitude = (getPosASL ACE_player) select 2;
|
|
|
|
private _temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
|
|
|
private _humidity = EGVAR(weather,currentHumidity);
|
|
|
|
private _barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
|
|
|
private _altitude = EGVAR(common,mapAltitude) + _playerAltitude;
|
|
|
|
private _airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity);
|
|
|
|
private _densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude);
|
|
|
|
private _chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
|
|
|
private _heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
|
|
|
private _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
|
|
|
private _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb);
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-11 17:44:38 +00:00
|
|
|
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
2015-06-01 14:21:30 +00:00
|
|
|
GVAR(MIN) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude, _densityAltitude];
|
|
|
|
GVAR(MAX) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude, _densityAltitude];
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
{
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
2015-08-13 23:55:54 +00:00
|
|
|
} count [1, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-05-16 09:13:54 +00:00
|
|
|
|
2015-08-13 23:55:54 +00:00
|
|
|
[0, _playerDir] call FUNC(updateMemory);
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
if (GVAR(MinAvgMaxMode) == 1) then {
|
2024-01-07 23:13:46 +00:00
|
|
|
private _useAB = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false];
|
2015-04-07 18:19:35 +00:00
|
|
|
{
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
2024-01-07 23:13:46 +00:00
|
|
|
} forEach [2, 3, 4];
|
2015-04-14 13:22:26 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// Wind SPD
|
2017-10-10 14:39:59 +00:00
|
|
|
private _windSpeed = call FUNC(measureWindSpeed);
|
2015-08-13 23:55:54 +00:00
|
|
|
[2, _windSpeed] call FUNC(updateMemory);
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// CROSSWIND
|
2017-10-10 14:39:59 +00:00
|
|
|
private _crosswind = 0;
|
2024-01-07 23:13:46 +00:00
|
|
|
if (_useAB) then {
|
2015-04-11 17:44:38 +00:00
|
|
|
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
|
|
} else {
|
|
|
|
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
|
|
|
|
};
|
2015-08-13 23:55:54 +00:00
|
|
|
[3, _crosswind] call FUNC(updateMemory);
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// HEADWIND
|
2017-10-10 14:39:59 +00:00
|
|
|
private _headwind = 0;
|
2024-01-07 23:13:46 +00:00
|
|
|
if (_useAB) then {
|
2015-05-21 17:18:15 +00:00
|
|
|
_headwind = cos(GVAR(RefHeading) - _playerDir) * _windSpeed;
|
2015-04-11 17:44:38 +00:00
|
|
|
} else {
|
2015-05-21 17:18:15 +00:00
|
|
|
_headwind = cos(GVAR(RefHeading)) * _windSpeed;
|
2015-04-11 17:44:38 +00:00
|
|
|
};
|
2015-05-21 17:18:15 +00:00
|
|
|
if (abs(_headwind) > abs(GVAR(MAX) select 4)) then {
|
|
|
|
GVAR(MAX) set [4, _headwind];
|
|
|
|
};
|
|
|
|
if (abs(_headwind) < abs(GVAR(MIN) select 4)) then {
|
|
|
|
GVAR(MIN) set [4, _headwind];
|
|
|
|
};
|
|
|
|
GVAR(TOTAL) set [4, (GVAR(TOTAL) select 4) + _headwind];
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
2024-01-07 23:13:46 +00:00
|
|
|
private _data = [
|
|
|
|
_temperature,
|
|
|
|
_chill,
|
|
|
|
_humidity,
|
|
|
|
_heatIndex,
|
|
|
|
_dewPoint,
|
|
|
|
_wetBulb,
|
|
|
|
_barometricPressure,
|
|
|
|
_altitude,
|
|
|
|
_densityAltitude
|
|
|
|
];
|
|
|
|
|
|
|
|
{
|
|
|
|
[TEMPERATURE_SLOT_INDEX + _forEachIndex, _x] call FUNC(updateMemory);
|
|
|
|
} forEach _data;
|