mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e9cb2740e8
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
95 lines
3.0 KiB
Plaintext
95 lines
3.0 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: Ruthberg
|
|
* Gathers the weather data for the Kestrel 4500
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* call ace_kestrel4500_fnc_collectData
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#define TEMPERATURE_SLOT_INDEX 5
|
|
|
|
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);
|
|
|
|
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
|
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];
|
|
};
|
|
|
|
{
|
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
|
} count [1, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
|
|
|
|
[0, _playerDir] call FUNC(updateMemory);
|
|
|
|
if (GVAR(MinAvgMaxMode) == 1) then {
|
|
private _useAB = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false];
|
|
{
|
|
GVAR(ENTRIES) set [_x, (GVAR(ENTRIES) select _x) + 1];
|
|
} forEach [2, 3, 4];
|
|
|
|
// Wind SPD
|
|
private _windSpeed = call FUNC(measureWindSpeed);
|
|
[2, _windSpeed] call FUNC(updateMemory);
|
|
|
|
// CROSSWIND
|
|
private _crosswind = 0;
|
|
if (_useAB) then {
|
|
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
|
|
} else {
|
|
_crosswind = abs(sin(GVAR(RefHeading)) * _windSpeed);
|
|
};
|
|
[3, _crosswind] call FUNC(updateMemory);
|
|
|
|
// HEADWIND
|
|
private _headwind = 0;
|
|
if (_useAB) then {
|
|
_headwind = cos(GVAR(RefHeading) - _playerDir) * _windSpeed;
|
|
} else {
|
|
_headwind = cos(GVAR(RefHeading)) * _windSpeed;
|
|
};
|
|
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];
|
|
};
|
|
|
|
private _data = [
|
|
_temperature,
|
|
_chill,
|
|
_humidity,
|
|
_heatIndex,
|
|
_dewPoint,
|
|
_wetBulb,
|
|
_barometricPressure,
|
|
_altitude,
|
|
_densityAltitude
|
|
];
|
|
|
|
{
|
|
[TEMPERATURE_SLOT_INDEX + _forEachIndex, _x] call FUNC(updateMemory);
|
|
} forEach _data;
|