2015-04-07 15:58:54 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Gathers the weather data for the Kestrel 4500
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-07 15:43:54 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-16 09:13:54 +00:00
|
|
|
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_updateMemory", "_windSpeed", "_crosswind", "_headwind"];
|
|
|
|
_playerDir = getDir ACE_player;
|
2015-05-14 14:07:41 +00:00
|
|
|
_playerAltitude = (getPosASL ACE_player) select 2;
|
2015-05-16 09:13:54 +00:00
|
|
|
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
|
|
|
_humidity = EGVAR(weather,currentHumidity);
|
|
|
|
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
|
|
|
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
|
|
|
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
|
|
|
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
|
|
|
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
|
|
|
_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-05-16 18:26:52 +00:00
|
|
|
GVAR(MIN) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude];
|
|
|
|
GVAR(MAX) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude];
|
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-05-16 18:26:52 +00:00
|
|
|
} forEach [1, 5, 6, 7, 8, 9, 10, 11, 12];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-05-16 09:13:54 +00:00
|
|
|
_fnc_updateMemory = {
|
|
|
|
PARAMS_2(_slot,_value);
|
|
|
|
GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value];
|
|
|
|
GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)];
|
|
|
|
GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value];
|
|
|
|
};
|
|
|
|
|
|
|
|
[0, _playerDir] call _fnc_updateMemory;
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
if (GVAR(MinAvgMaxMode) == 1) then {
|
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];
|
2015-05-16 18:26:52 +00:00
|
|
|
} forEach [2, 3, 4];
|
2015-04-14 13:22:26 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// Wind SPD
|
2015-04-13 09:53:19 +00:00
|
|
|
_windSpeed = call FUNC(measureWindSpeed);
|
2015-05-16 18:26:52 +00:00
|
|
|
[2, _windSpeed] call _fnc_updateMemory;
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// CROSSWIND
|
2015-04-13 09:53:19 +00:00
|
|
|
_crosswind = 0;
|
2015-04-11 17:44:38 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
|
|
|
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
|
|
} else {
|
|
|
|
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
|
|
|
|
};
|
2015-05-16 18:26:52 +00:00
|
|
|
[3, _crosswind] call _fnc_updateMemory;
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// HEADWIND
|
2015-04-13 09:53:19 +00:00
|
|
|
_headwind = 0;
|
2015-04-11 17:44:38 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
|
|
|
_headwind = abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
|
|
} else {
|
|
|
|
_headwind = abs(cos(GVAR(RefHeading)) * _windSpeed);
|
|
|
|
};
|
2015-05-16 18:26:52 +00:00
|
|
|
[4, _headwind] call _fnc_updateMemory;
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
2015-05-16 18:26:52 +00:00
|
|
|
[5, _temperature] call _fnc_updateMemory;
|
|
|
|
[6, _chill] call _fnc_updateMemory;
|
|
|
|
[7, _humidity] call _fnc_updateMemory;
|
|
|
|
[8, _heatIndex] call _fnc_updateMemory;
|
|
|
|
[9, _dewPoint] call _fnc_updateMemory;
|
|
|
|
[10, _wetBulb] call _fnc_updateMemory;
|
|
|
|
[11, _barometricPressure] call _fnc_updateMemory;
|
|
|
|
[12, _altitude] call _fnc_updateMemory;
|