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"
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
|
|
private ["_playerDir", "_windSpeed", "_windDir", "_crosswind", "_headwind", "_humidity", "_temperature", "_humidity", "_barometricPressure", "_altitude"];
|
|
|
|
|
2015-04-08 09:25:15 +00:00
|
|
|
if (isNil QUOTE(GVAR(MIN)) || isNil QUOTE(GVAR(MAX))) then {
|
2015-04-07 15:43:54 +00:00
|
|
|
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
|
|
|
|
_humidity = EGVAR(weather,currentHumidity);
|
2015-04-08 10:56:34 +00:00
|
|
|
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast;
|
|
|
|
_altitude = EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2);
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude];
|
|
|
|
GVAR(MAX) = [0, 0, 0, 0, _temperature, _humidity, _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-04-07 15:43:54 +00:00
|
|
|
} forEach [0, 4, 5, 6 ,7];
|
|
|
|
|
|
|
|
// Direction
|
|
|
|
_playerDir = getDir ACE_player;
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [0, (GVAR(MIN) select 0) min _playerDir];
|
|
|
|
GVAR(MAX) set [0, _playerDir max (GVAR(MAX) select 0)];
|
|
|
|
GVAR(TOTAL) set [0, (GVAR(TOTAL) select 0) + _playerDir];
|
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-04-07 18:19:35 +00:00
|
|
|
} forEach [1, 2, 3];
|
|
|
|
|
|
|
|
// Wind SPD
|
|
|
|
_windSpeed = vectorMagnitude ACE_wind;
|
|
|
|
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
if (isClass (configFile >> "CfgPatches" >> "ACE_Advanced_Ballistics")) then {
|
|
|
|
_windSpeed = (eyePos ACE_player) call EFUNC(advanced_ballistics,calculateWindSpeed);
|
|
|
|
};
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
_windSpeed = cos(_playerDir - _windDir) * _windSpeed;
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [1, (GVAR(MIN) select 1) min abs(_windSpeed)];
|
|
|
|
GVAR(MAX) set [1, abs(_windSpeed) max (GVAR(MAX) select 1)];
|
|
|
|
GVAR(TOTAL) set [1, (GVAR(TOTAL) select 1) + abs(_windSpeed)];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// CROSSWIND
|
2015-04-08 09:25:15 +00:00
|
|
|
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
|
|
GVAR(MIN) set [2, (GVAR(MIN) select 2) min _crosswind];
|
|
|
|
GVAR(MAX) set [2, _crosswind max (GVAR(MAX) select 2)];
|
|
|
|
GVAR(TOTAL) set [2, (GVAR(TOTAL) select 2) + _crosswind];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
2015-04-07 18:19:35 +00:00
|
|
|
// HEADWIND
|
2015-04-08 09:25:15 +00:00
|
|
|
_headwind = abs(cos(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
|
|
GVAR(MIN) set [3, (GVAR(MIN) select 3) min _headwind];
|
|
|
|
GVAR(MAX) set [3, _headwind max (GVAR(MAX) select 3)];
|
|
|
|
GVAR(TOTAL) set [3, (GVAR(TOTAL) select 3) + _headwind];
|
2015-04-07 15:43:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// TEMP
|
|
|
|
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [4, (GVAR(MIN) select 4) min _temperature];
|
|
|
|
GVAR(MAX) set [4, _temperature max (GVAR(MAX) select 4)];
|
|
|
|
GVAR(TOTAL) set [4, (GVAR(TOTAL) select 4) + _temperature];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
|
|
|
// HUMIDITY
|
|
|
|
_humidity = EGVAR(weather,currentHumidity);
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [5, (GVAR(MIN) select 5) min _humidity];
|
|
|
|
GVAR(MAX) set [5, _humidity max (GVAR(MAX) select 5)];
|
|
|
|
GVAR(TOTAL) set [5, (GVAR(TOTAL) select 5) + _humidity];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
|
|
|
// BARO
|
2015-04-08 10:56:34 +00:00
|
|
|
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast;
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [6, (GVAR(MIN) select 6) min _barometricPressure];
|
|
|
|
GVAR(MAX) set [6, _barometricPressure max (GVAR(MAX) select 6)];
|
|
|
|
GVAR(TOTAL) set [6, (GVAR(TOTAL) select 6) + _barometricPressure];
|
2015-04-07 15:43:54 +00:00
|
|
|
|
|
|
|
// ALTITUDE
|
2015-04-08 10:56:34 +00:00
|
|
|
_altitude = EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2);
|
2015-04-08 09:25:15 +00:00
|
|
|
GVAR(MIN) set [7, (GVAR(MIN) select 7) min _altitude];
|
|
|
|
GVAR(MAX) set [7, _altitude max (GVAR(MAX) select 7)];
|
|
|
|
GVAR(TOTAL) set [7, (GVAR(TOTAL) select 7) + _altitude];
|