mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Refactored and expanded the kestrel data collection
This commit is contained in:
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
GVAR(Menus) = ["Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "User Screen 1", "User Screen 2"];
|
GVAR(Menus) = ["Direction", "Wind SPD m/s", "CROSSWIND m/s", "HEADWIND m/s", "TEMP °C", "CHILL °C", "HUMIDITY %", "HEAT INDEX °C", "DEW POINT °C", "WET BULB °C", "BARO hPA", "ALTITUDE m", "User Screen 1", "User Screen 2"];
|
||||||
|
|
||||||
GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(TOTAL) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0];
|
GVAR(ENTRIES) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
|
||||||
GVAR(MinAvgMax) = false;
|
GVAR(MinAvgMax) = false;
|
||||||
GVAR(MinAvgMaxMode) = 0;
|
GVAR(MinAvgMaxMode) = 0;
|
||||||
|
@ -14,27 +14,35 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_playerAltitude", "_playerDir", "_windSpeed", "_crosswind", "_headwind", "_humidity", "_temperature", "_humidity", "_barometricPressure", "_altitude"];
|
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_fnc_updateMemory", "_windSpeed", "_crosswind", "_headwind"];
|
||||||
|
_playerDir = getDir ACE_player;
|
||||||
_playerAltitude = (getPosASL ACE_player) select 2;
|
_playerAltitude = (getPosASL ACE_player) select 2;
|
||||||
|
|
||||||
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
|
||||||
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
||||||
_humidity = EGVAR(weather,currentHumidity);
|
_humidity = EGVAR(weather,currentHumidity);
|
||||||
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
||||||
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
||||||
GVAR(MIN) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude];
|
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
|
||||||
GVAR(MAX) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude];
|
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
|
||||||
|
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
|
||||||
|
_wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb);
|
||||||
|
|
||||||
|
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
||||||
|
GVAR(MIN) = [_playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude];
|
||||||
|
GVAR(MAX) = [_playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude];
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
||||||
} forEach [0, 4, 5, 6 ,7];
|
} forEach [0, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||||
|
|
||||||
// Direction
|
_fnc_updateMemory = {
|
||||||
_playerDir = getDir ACE_player;
|
PARAMS_2(_slot,_value);
|
||||||
GVAR(MIN) set [0, (GVAR(MIN) select 0) min _playerDir];
|
GVAR(MIN) set [_slot, (GVAR(MIN) select _slot) min _value];
|
||||||
GVAR(MAX) set [0, _playerDir max (GVAR(MAX) select 0)];
|
GVAR(MAX) set [_slot, _value max (GVAR(MAX) select _slot)];
|
||||||
GVAR(TOTAL) set [0, (GVAR(TOTAL) select 0) + _playerDir];
|
GVAR(TOTAL) set [_slot, (GVAR(TOTAL) select _slot) + _value];
|
||||||
|
};
|
||||||
|
|
||||||
|
[0, _playerDir] call _fnc_updateMemory;
|
||||||
|
|
||||||
if (GVAR(MinAvgMaxMode) == 1) then {
|
if (GVAR(MinAvgMaxMode) == 1) then {
|
||||||
{
|
{
|
||||||
@ -43,9 +51,7 @@ if (GVAR(MinAvgMaxMode) == 1) then {
|
|||||||
|
|
||||||
// Wind SPD
|
// Wind SPD
|
||||||
_windSpeed = call FUNC(measureWindSpeed);
|
_windSpeed = call FUNC(measureWindSpeed);
|
||||||
GVAR(MIN) set [1, (GVAR(MIN) select 1) min _windSpeed];
|
[1, _windSpeed] call _fnc_updateMemory;
|
||||||
GVAR(MAX) set [1, _windSpeed max (GVAR(MAX) select 1)];
|
|
||||||
GVAR(TOTAL) set [1, (GVAR(TOTAL) select 1) + _windSpeed];
|
|
||||||
|
|
||||||
// CROSSWIND
|
// CROSSWIND
|
||||||
_crosswind = 0;
|
_crosswind = 0;
|
||||||
@ -54,9 +60,7 @@ if (GVAR(MinAvgMaxMode) == 1) then {
|
|||||||
} else {
|
} else {
|
||||||
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
|
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
|
||||||
};
|
};
|
||||||
GVAR(MIN) set [2, (GVAR(MIN) select 2) min _crosswind];
|
[2, _crosswind] call _fnc_updateMemory;
|
||||||
GVAR(MAX) set [2, _crosswind max (GVAR(MAX) select 2)];
|
|
||||||
GVAR(TOTAL) set [2, (GVAR(TOTAL) select 2) + _crosswind];
|
|
||||||
|
|
||||||
// HEADWIND
|
// HEADWIND
|
||||||
_headwind = 0;
|
_headwind = 0;
|
||||||
@ -65,31 +69,14 @@ if (GVAR(MinAvgMaxMode) == 1) then {
|
|||||||
} else {
|
} else {
|
||||||
_headwind = abs(cos(GVAR(RefHeading)) * _windSpeed);
|
_headwind = abs(cos(GVAR(RefHeading)) * _windSpeed);
|
||||||
};
|
};
|
||||||
GVAR(MIN) set [3, (GVAR(MIN) select 3) min _headwind];
|
[3, _headwind] call _fnc_updateMemory;
|
||||||
GVAR(MAX) set [3, _headwind max (GVAR(MAX) select 3)];
|
|
||||||
GVAR(TOTAL) set [3, (GVAR(TOTAL) select 3) + _headwind];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TEMP
|
[4, _temperature] call _fnc_updateMemory;
|
||||||
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
|
[5, _chill] call _fnc_updateMemory;
|
||||||
GVAR(MIN) set [4, (GVAR(MIN) select 4) min _temperature];
|
[6, _humidity] call _fnc_updateMemory;
|
||||||
GVAR(MAX) set [4, _temperature max (GVAR(MAX) select 4)];
|
[7, _heatIndex] call _fnc_updateMemory;
|
||||||
GVAR(TOTAL) set [4, (GVAR(TOTAL) select 4) + _temperature];
|
[8, _dewPoint] call _fnc_updateMemory;
|
||||||
|
[9, _wetBulb] call _fnc_updateMemory;
|
||||||
// HUMIDITY
|
[10, _barometricPressure] call _fnc_updateMemory;
|
||||||
_humidity = EGVAR(weather,currentHumidity);
|
[11, _altitude] call _fnc_updateMemory;
|
||||||
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];
|
|
||||||
|
|
||||||
// BARO
|
|
||||||
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
|
|
||||||
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];
|
|
||||||
|
|
||||||
// ALTITUDE
|
|
||||||
_altitude = EGVAR(weather,Altitude) + _playerAltitude;
|
|
||||||
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];
|
|
||||||
|
Reference in New Issue
Block a user