mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3126 from acemod/weatherCleanup
Weather cleanup, fix wind inversion, add non-color based wind speed indicator
This commit is contained in:
commit
5df211c586
@ -28,7 +28,7 @@ if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false };
|
||||
|
||||
2 cutText ["", "PLAIN"];
|
||||
EGVAR(weather,WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = true;
|
||||
|
||||
[{
|
||||
|
@ -53,4 +53,4 @@ class CfgVehicles {
|
||||
description = CSTRING(Module_Description);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -48,4 +48,4 @@ class CfgWorlds {
|
||||
{0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November
|
||||
{0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,17 +1,13 @@
|
||||
class RscTitles
|
||||
{
|
||||
class RscWindIntuitive
|
||||
{
|
||||
class RscTitles {
|
||||
class RscWindIntuitive {
|
||||
idd=-1;
|
||||
onLoad="with uiNameSpace do { RscWindIntuitive = _this select 0 };";
|
||||
movingEnable=0;
|
||||
duration=60;
|
||||
fadeIn="false";
|
||||
fadeOut="false";
|
||||
class controls
|
||||
{
|
||||
class RscWindIntuitive
|
||||
{
|
||||
class controls {
|
||||
class RscWindIntuitive {
|
||||
idc=132948;
|
||||
type=0;
|
||||
style=48;
|
||||
@ -28,4 +24,4 @@ class RscTitles
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addons/weather/UI/wind_arrow_ca.paa
Normal file
BIN
addons/weather/UI/wind_arrow_ca.paa
Normal file
Binary file not shown.
BIN
addons/weather/UI/wind_dot_ca.paa
Normal file
BIN
addons/weather/UI/wind_dot_ca.paa
Normal file
Binary file not shown.
@ -14,6 +14,7 @@ GVAR(ACE_rain) = rain;
|
||||
"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = ACE_time; };
|
||||
"ACE_MISC_PARAMS" addPublicVariableEventHandler {
|
||||
if (!isServer) then {
|
||||
TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS);
|
||||
if (GVAR(syncMisc)) then {
|
||||
30 setLightnings (ACE_MISC_PARAMS select 0);
|
||||
30 setRainbow (ACE_MISC_PARAMS select 1);
|
||||
@ -27,10 +28,11 @@ GVAR(ACE_rain) = rain;
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(WindInfo) = false;
|
||||
["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKey),
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[] call FUNC(displayWindInfo);
|
||||
@ -40,12 +42,40 @@ GVAR(ACE_rain) = rain;
|
||||
|
||||
simulWeatherSync;
|
||||
|
||||
[FUNC(updateTemperature), 20, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateHumidity), 20, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateWind), 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateRain), 2, []] call CBA_fnc_addPerFrameHandler;
|
||||
[{
|
||||
|
||||
|
||||
|
||||
["SettingsInitialized",{
|
||||
TRACE_1("SettingsInitialized",GVAR(syncRain));
|
||||
|
||||
//Create a 0 sec delay PFEH to update rain every frame:
|
||||
if (GVAR(syncRain)) then {
|
||||
0 setRain GVAR(ACE_rain);
|
||||
[{
|
||||
0 setRain GVAR(ACE_rain);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
//Create a 1 sec delay PFEH to update wind/rain/temp/humidity:
|
||||
|
||||
//If we don't sync rain, set next time to infinity
|
||||
GVAR(nextUpdateRain) = if (GVAR(syncRain)) then {0} else {1e99};
|
||||
GVAR(nextUpdateTempAndHumidity) = 0;
|
||||
[{
|
||||
BEGIN_COUNTER(weatherPFEH);
|
||||
|
||||
[] call FUNC(updateWind); //Every 1 second
|
||||
|
||||
if (ACE_time >= GVAR(nextUpdateRain)) then {
|
||||
[] call FUNC(updateRain); //Every 2 seconds
|
||||
GVAR(nextUpdateRain) = 2 + ACE_time;
|
||||
};
|
||||
if (ACE_time >= GVAR(nextUpdateTempAndHumidity)) then {
|
||||
[] call FUNC(updateTemperature); //Every 20 seconds
|
||||
[] call FUNC(updateHumidity); //Every 20 seconds
|
||||
GVAR(nextUpdateTempAndHumidity) = 20 + ACE_time;
|
||||
};
|
||||
|
||||
END_COUNTER(weatherPFEH);
|
||||
}, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -9,4 +9,10 @@ GVAR(rain_current_range) = -1+(random 2);
|
||||
// Wind
|
||||
call FUNC(initWind);
|
||||
|
||||
[FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler;
|
||||
["SettingsInitialized", {
|
||||
TRACE_2("SettingsInitialized",GVAR(enableServerController),GVAR(serverUpdateInterval));
|
||||
|
||||
if (GVAR(enableServerController)) then {
|
||||
[FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the air density
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 0: temperature - degrees celsius <NUMBER>
|
||||
* 1: pressure - hPa <NUMBER>
|
||||
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* density of air - kg * m^(-3) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* [0, 1020, 0.5] call ace_weather_fnc_calculateAirDensity
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -21,11 +22,10 @@ params ["_temperature", "_pressure", "_relativeHumidity"];
|
||||
_pressure = _pressure * 100; // hPa to Pa
|
||||
|
||||
if (_relativeHumidity > 0) then {
|
||||
private ["_pSat", "_vaporPressure", "_partialPressure"];
|
||||
// Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm
|
||||
_pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3));
|
||||
_vaporPressure = _relativeHumidity * _pSat;
|
||||
_partialPressure = _pressure - _vaporPressure;
|
||||
private _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3));
|
||||
private _vaporPressure = _relativeHumidity * _pSat;
|
||||
private _partialPressure = _pressure - _vaporPressure;
|
||||
|
||||
(_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature))
|
||||
} else {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the barometric pressure based on altitude and weather
|
||||
*
|
||||
* Arguments:
|
||||
@ -9,8 +8,10 @@
|
||||
* Return Value:
|
||||
* barometric pressure - hPA <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* 0 call ace_weather_fnc_calculateBarometricPressure
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates density altitude for a given air density
|
||||
*
|
||||
* Arguments:
|
||||
@ -9,8 +8,10 @@
|
||||
* Return Value:
|
||||
* density altitude - m <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* 1.225 call ace_weather_fnc_calculateDensityAltitude
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates dew point based on temperature and relative humidity
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
* 0: temperature - degrees celsius <NUMBER>
|
||||
* 1: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* dew point <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* [32, 0.4] call ace_weather_fnc_calculateDewPoint
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -24,7 +25,6 @@ if (_rh == 0) exitWith { CELSIUS(0) };
|
||||
|
||||
// Source: https://en.wikipedia.org/wiki/Dew_point
|
||||
|
||||
private ["_gamma"];
|
||||
_gamma = ln(_rh) + (__b * _t) / (__c + _t);
|
||||
private _gamma = ln(_rh) + (__b * _t) / (__c + _t);
|
||||
|
||||
(__c * _gamma) / (__b - _gamma)
|
||||
|
@ -1,17 +1,18 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates heat index based on temperature and relative humidity
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 0: temperature - degrees celsius <NUMBER>
|
||||
* 1: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* heat index <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* [36, 0.75] call ace_weather_fnc_calculateHeatIndex
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the terrain roughness length at a given world position
|
||||
*
|
||||
* Arguments:
|
||||
@ -9,19 +8,20 @@
|
||||
* Return Value:
|
||||
* roughness length <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* (getPosASL player) call ace_weather_fnc_calculateRoughnessLength
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_roughness_lengths", "_windSource", "_nearBuildings", "_isWater"];
|
||||
|
||||
// Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html
|
||||
_roughness_lengths = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6];
|
||||
#define ROUGHNESS_LENGTHS [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6]
|
||||
|
||||
_windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25);
|
||||
private _windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25);
|
||||
|
||||
_nearBuildings = count (_windSource nearObjects ["Building", 50]);
|
||||
_isWater = surfaceIsWater _windSource;
|
||||
private _nearBuildings = count (_windSource nearObjects ["Building", 50]);
|
||||
private _isWater = surfaceIsWater _windSource;
|
||||
|
||||
if (_nearBuildings == 0 && _isWater) exitWith {
|
||||
0.0005
|
||||
@ -31,4 +31,4 @@ if (_nearBuildings >= 10) exitWith {
|
||||
1.6
|
||||
};
|
||||
|
||||
_roughness_lengths select (2 + (_nearBuildings min 6))
|
||||
ROUGHNESS_LENGTHS select (2 + (_nearBuildings min 6))
|
||||
|
@ -1,16 +1,17 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the speed of sound for a given temperature
|
||||
*
|
||||
* Arguments:
|
||||
* temperature - degrees celcius <NUMBER>
|
||||
* temperature - degrees celsius <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* speed of sound - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* 0 call ace_weather_fnc_calculateSpeedOfSound
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the temperature based on altitude and weather
|
||||
*
|
||||
* Arguments:
|
||||
@ -9,8 +8,10 @@
|
||||
* Return Value:
|
||||
* temperature - degrees celsius <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* 500 call ace_weather_fnc_calculateTemperatureAtHeight
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
|
@ -1,36 +1,35 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates wet bulb based on temperature and relative humidity
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 0: temperature - degrees celsius <NUMBER>
|
||||
* 1: pressure - hPa <NUMBER>
|
||||
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* wet bulb <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Example:
|
||||
* [0, 1020, 0.5] call ace_weather_fnc_calculateWetBulb
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_es", "_e", "_eDiff", "_eGuessPrev", "_cTempDelta", "_twGuess", "_eguess"];
|
||||
|
||||
params ["_temperature", "_pressure", "_relativeHumidity"];
|
||||
|
||||
// Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb
|
||||
_es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5));
|
||||
_e = _es * _relativeHumidity;
|
||||
_eDiff = _es - _e;
|
||||
_eGuessPrev = _es;
|
||||
_cTempDelta = 3.3145;
|
||||
_twGuess = _temperature;
|
||||
private _es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5));
|
||||
private _e = _es * _relativeHumidity;
|
||||
private _eDiff = _es - _e;
|
||||
private _eGuessPrev = _es;
|
||||
private _cTempDelta = 3.3145;
|
||||
private _twGuess = _temperature;
|
||||
|
||||
for "_j" from 1 to 50 do {
|
||||
_twGuess = _twGuess - _cTempDelta;
|
||||
_eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5));
|
||||
private _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5));
|
||||
_eguess = _eguess - (_pressure * (_temperature - _twGuess) * 0.00066 * (1 + (0.00115 * _twGuess)));
|
||||
_eDiff = _eguess - _e;
|
||||
if (abs(_eDiff) <= 0.001) exitWith {};
|
||||
|
@ -1,15 +1,17 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates wind chill based on temperature and wind speed
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 0: temperature - degrees celsius <NUMBER>
|
||||
* 1: wind speed - m/s <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* wind chill <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [0, 10] call ace_weather_fnc_calculateWindChill
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
@ -1,43 +1,42 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the true wind speed at a given world position
|
||||
*
|
||||
* Arguments:
|
||||
* 0: world position - posASL <POSTION>
|
||||
* 1: Account for wind gradient <BOOL>
|
||||
* 1: Account for wind gradient (used in advanced ballistics) <BOOL>
|
||||
* 2: Account for terrain <BOOL>
|
||||
* 3: Account for obstacles <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* wind speed - m/s <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [eyePos ACE_player, true, true, true] call ace_weather_fnc_calculateWindSpeed;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_fnc_polar2vect", "_windSpeed", "_windDir", "_windDirAdjusted", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"];
|
||||
|
||||
params ["_position", "_windGradientEnabled", "_terrainEffectEnabled", "_obstacleEffectEnabled"];
|
||||
|
||||
_fnc_polar2vect = {
|
||||
private ["_mag2D"];
|
||||
params ["_x", "_y", "_z"];
|
||||
_mag2D = _x * cos(_z);
|
||||
[_mag2D * sin(_y), _mag2D * cos(_y), _x * sin(_z)];
|
||||
private _fnc_polar2vect = {
|
||||
params ["_mag","_dir","_elev"];
|
||||
private _mag2D = _mag * cos(_elev);
|
||||
[_mag2D * sin(_dir), _mag2D * cos(_dir), _mag * sin(_elev)];
|
||||
};
|
||||
|
||||
_windSpeed = vectorMagnitude ACE_wind;
|
||||
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
_windDirAdjusted = _windDir + 180;
|
||||
private _windSpeed = vectorMagnitude ACE_wind;
|
||||
private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
private _windDirAdjusted = _windDir + 180;
|
||||
|
||||
// Wind gradient
|
||||
if (_windGradientEnabled) then {
|
||||
if (_windSpeed > 0.05) then {
|
||||
_height = (ASLToATL _position) select 2;
|
||||
private _height = (ASLToATL _position) select 2;
|
||||
_height = 0 max _height min 20;
|
||||
if (_height < 20) then {
|
||||
_roughnessLength = _position call FUNC(calculateRoughnessLength);
|
||||
private _roughnessLength = _position call FUNC(calculateRoughnessLength);
|
||||
_windSpeed = _windSpeed * abs(ln(_height / _roughnessLength) / ln(20 / _roughnessLength));
|
||||
};
|
||||
};
|
||||
@ -46,9 +45,9 @@ if (_windGradientEnabled) then {
|
||||
// Terrain effect on wind
|
||||
if (_terrainEffectEnabled) then {
|
||||
if (_windSpeed > 0.05) then {
|
||||
_newWindSpeed = 0;
|
||||
private _newWindSpeed = 0;
|
||||
{
|
||||
_windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect;
|
||||
private _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect;
|
||||
if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith {
|
||||
_newWindSpeed = cos(_x * 9) * _windSpeed;
|
||||
};
|
||||
@ -60,6 +59,7 @@ if (_terrainEffectEnabled) then {
|
||||
if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith {
|
||||
_newWindSpeed = cos(_x * 9) * _windSpeed;
|
||||
};
|
||||
nil
|
||||
} count [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
_windSpeed = _newWindSpeed;
|
||||
};
|
||||
@ -68,9 +68,9 @@ if (_terrainEffectEnabled) then {
|
||||
// Obstacle effect on wind
|
||||
if (_obstacleEffectEnabled) then {
|
||||
if (_windSpeed > 0.05) then {
|
||||
_newWindSpeed = 0;
|
||||
private _newWindSpeed = 0;
|
||||
{
|
||||
_windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect;
|
||||
private _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect;
|
||||
if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith {
|
||||
_newWindSpeed = cos(_x * 2) * _windSpeed;
|
||||
};
|
||||
@ -82,6 +82,7 @@ if (_obstacleEffectEnabled) then {
|
||||
if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith {
|
||||
_newWindSpeed = cos(_x * 2) * _windSpeed;
|
||||
};
|
||||
nil
|
||||
} count [0, 5, 10, 15, 20, 25, 30, 35, 40, 45];
|
||||
_windSpeed = _newWindSpeed;
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Displays a wind info (colored arrow) in the top left corner of the screen
|
||||
*
|
||||
* Argument:
|
||||
@ -8,6 +7,11 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_displayWindInfo
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -16,64 +20,87 @@
|
||||
|
||||
if (GVAR(WindInfo)) exitWith {
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
true
|
||||
};
|
||||
if (underwater ACE_player) exitWith { false };
|
||||
if (vehicle ACE_player != ACE_player) exitWith { false };
|
||||
|
||||
2 cutText ["", "PLAIN"];
|
||||
EGVAR(advanced_ballistics,Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = true;
|
||||
|
||||
[{
|
||||
private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor"];
|
||||
|
||||
if !(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player) exitWith {
|
||||
TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo));
|
||||
|
||||
[{
|
||||
disableSerialization;
|
||||
params ["", "_pfID"];
|
||||
|
||||
if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith {
|
||||
TRACE_1("Ending Wind Info PFEH", GVAR(WindInfo));
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_windIndex = 12;
|
||||
_windColor = [1, 1, 1, 1];
|
||||
_windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
||||
//Keeps the display open:
|
||||
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
|
||||
private _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
||||
// With wind gradient
|
||||
[eyePos ACE_player, true, true, true] call FUNC(calculateWindSpeed);
|
||||
} else {
|
||||
// Without wind gradient
|
||||
[eyePos ACE_player, false, true, true] call FUNC(calculateWindSpeed);
|
||||
};
|
||||
|
||||
if (_windSpeed > 0.2) then {
|
||||
_playerDir = (ACE_player call CBA_fnc_headDir) select 0;
|
||||
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
_windIndex = round(((_playerDir - _windDir + 360) % 360) / 30);
|
||||
_windIndex = _windIndex % 12;
|
||||
};
|
||||
|
||||
|
||||
private _playerDir = (ACE_player call CBA_fnc_headDir) select 0;
|
||||
private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
_windDir = 30 * (round(((_playerDir - _windDir + 360) % 360) / 30));
|
||||
|
||||
// Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; };
|
||||
private _beaufortNumber = 0;
|
||||
private _windColor = [1, 1, 1, 1];
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; _beaufortNumber = 1; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; _beaufortNumber = 2; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; _beaufortNumber = 3; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; _beaufortNumber = 4; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; _beaufortNumber = 5; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; _beaufortNumber = 6; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; _beaufortNumber = 7; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; _beaufortNumber = 8; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; _beaufortNumber = 9; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; _beaufortNumber = 10; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; _beaufortNumber = 11; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; _beaufortNumber = 12; };
|
||||
|
||||
0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
|
||||
__ctrl ctrlSetScale 0.75;
|
||||
TRACE_3("update display",_beaufortNumber,_windDir,_windSpeed);
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
if (_beaufortNumber > 0) then {
|
||||
__ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_arrow_ca.paa));
|
||||
__ctrl ctrlSetAngle [_windDir, 0.5, 0.5];
|
||||
} else {
|
||||
__ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_noneCircle_ca.paa));
|
||||
};
|
||||
__ctrl ctrlCommit 0;
|
||||
|
||||
__ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex];
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
//Update the beaufort balls:
|
||||
(ctrlPosition __ctrl) params ["_ctrlX", "_ctrlY", "_ctrlWidth", "_ctrlHeight"];
|
||||
private _centerX = _ctrlX + _ctrlWidth / 2;
|
||||
private _centerY = _ctrlY + _ctrlHeight / 2;
|
||||
private _ballHeight = _ctrlHeight / 17;
|
||||
private _ballWidth = _ballHeight * 3/4;
|
||||
|
||||
for "_index" from 0 to (_beaufortNumber - 1) do {
|
||||
private _ball = __dsp ctrlCreate ["RscPicture", _index];
|
||||
_ball ctrlSetText QUOTE(PATHTOF(UI\wind_dot_ca.paa));
|
||||
_ball ctrlSetTextColor [1,1,1,1];
|
||||
private _ballCenterX = _centerX - (_ballWidth / 2) + ((sin _windDir) * 0.013333) * (_index - 4.9) + ((cos _windDir) * 0.0125);
|
||||
private _ballCenterY = _centerY - (_ballHeight / 2) - ((1 * cos _windDir) * 4/3*0.013333) * (_index - 4.9) + ((sin _windDir) * 0.0125);
|
||||
_ball ctrlSetPosition [_ballCenterX, _ballCenterY, _ballWidth, _ballHeight];
|
||||
_ball ctrlCommit 0;
|
||||
};
|
||||
|
||||
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg, esteldunedain
|
||||
*
|
||||
* Get the weather data for the current map
|
||||
*
|
||||
* Argument:
|
||||
@ -8,6 +7,11 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_getMapData
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -207,4 +211,4 @@ GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
|
||||
GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
|
||||
|
||||
GVAR(currentTemperature) = 20;
|
||||
GVAR(currentHumidity) = 0.5;
|
||||
GVAR(currentHumidity) = 0.5;
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: ACE2 Team, Ruthberg
|
||||
*
|
||||
* Calculate current wind locally from the data broadcasted by the server
|
||||
*
|
||||
* Argument:
|
||||
@ -8,17 +7,21 @@
|
||||
*
|
||||
* Return value:
|
||||
* Wind <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_getWind
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_periodPercent", "_periodPosition"];
|
||||
|
||||
if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] };
|
||||
|
||||
ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"];
|
||||
//Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];]
|
||||
|
||||
_periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period;
|
||||
_periodPercent = _periodPosition / _period;
|
||||
private _periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period;
|
||||
private _periodPercent = _periodPosition / _period;
|
||||
|
||||
_spd = _spd + _spdChange * _periodPercent;
|
||||
_dir = _dir + _dirChange * _periodPercent;
|
||||
|
@ -10,6 +10,9 @@
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Example:
|
||||
* [module, [], true] call ace_weather_fnc_initModuleSettings
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Inits the wind variables on mission start
|
||||
*
|
||||
* Argument:
|
||||
@ -8,28 +7,32 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_initWind
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_sum", "_rand", "_csum", "_index", "_month", "_windDirectionProbabilities"];
|
||||
_month = date select 1;
|
||||
_windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1);
|
||||
private _month = date select 1;
|
||||
private _windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1);
|
||||
|
||||
ACE_wind = [0, 0, 0];
|
||||
|
||||
GVAR(wind_direction_reference) = random 360;
|
||||
_sum = 0;
|
||||
private _sum = 0;
|
||||
for "_i" from 0 to 7 do {
|
||||
_sum = _sum + (_windDirectionProbabilities select _i);
|
||||
};
|
||||
_rand = random _sum;
|
||||
_csum = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
private _rand = random _sum;
|
||||
private _csum = [0, 0, 0, 0, 0, 0, 0, 0];
|
||||
for "_i" from 0 to 7 do {
|
||||
for "_j" from 0 to _i do {
|
||||
_csum set [_i, (_csum select _i) + (_windDirectionProbabilities select _j)];
|
||||
};
|
||||
};
|
||||
_index = 0;
|
||||
private _index = 0;
|
||||
for "_i" from 0 to 7 do {
|
||||
if (_rand > (_csum select _i)) then {
|
||||
_index = _index + 1;
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Gather weather parameters and broadcast them to the clients
|
||||
*
|
||||
* Argument:
|
||||
@ -8,11 +7,14 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_serverController
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!GVAR(enableServerController)) exitWith {};
|
||||
|
||||
if (GVAR(useACEWeather)) then {
|
||||
// Use location based real world weather data
|
||||
[] call FUNC(updateAceWeather);
|
||||
@ -23,7 +25,9 @@ if (GVAR(useACEWeather)) then {
|
||||
publicVariable "ACE_RAIN_PARAMS";
|
||||
};
|
||||
if (GVAR(syncWind)) then {
|
||||
ACE_WIND_PARAMS = [wind call CBA_fnc_vectDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)];
|
||||
//Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];]
|
||||
private _windDir = ((((wind select 0) atan2 (wind select 1)) + 180) % 360);
|
||||
ACE_WIND_PARAMS = [_windDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)];
|
||||
publicVariable "ACE_WIND_PARAMS";
|
||||
};
|
||||
if (GVAR(syncMisc)) then {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: ACE2 Team, esteldunedain, ruthberg
|
||||
*
|
||||
* Updates the wind and rain evolution on the server. Broadcasts the current and next values to the clients
|
||||
*
|
||||
* Argument:
|
||||
@ -8,40 +7,44 @@
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_updateAceWeather
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_overcastMultiplier", "_lastRain", "_rainOverCast", "_transitionTime", "_windDirectionVariance", "_windSpeed", "_windSpeedChange", "_windMaxDiff", "_windMinDiff", "_windDirection", "_windDirectionChange", "_ratioMin", "_ratioMax"];
|
||||
|
||||
_overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1)
|
||||
private _overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1)
|
||||
|
||||
// Rain simulation
|
||||
if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then {
|
||||
if (GVAR(syncRain) && {GVAR(rain_period_count) > GVAR(rain_next_period)}) then {
|
||||
|
||||
GVAR(rain_next_period) = ceil((1 + (random 10)) / _overcastMultiplier);
|
||||
GVAR(rain_period_count) = 0;
|
||||
|
||||
_lastRain = GVAR(current_rain);
|
||||
|
||||
|
||||
private _lastRain = GVAR(current_rain);
|
||||
private _rainOverCast = 0;
|
||||
|
||||
if (overcast >= 0.7) then {
|
||||
_rainOverCast = (overcast - 0.7) / 0.3;
|
||||
if (GVAR(current_rain) == 0) then {
|
||||
// Initialize rain with a random strength depending on the current overcast value
|
||||
GVAR(current_rain) = -0.25 + (random 0.75) + (random 0.5) * _rainOverCast;
|
||||
};
|
||||
|
||||
|
||||
GVAR(current_rain) = GVAR(current_rain) + GVAR(current_rain) * ((_rainOverCast * _overcastMultiplier) / 8) * GVAR(rain_current_range);
|
||||
GVAR(current_rain) = 0 max GVAR(current_rain) min 1;
|
||||
|
||||
|
||||
GVAR(rain_current_range) = -1 + (random 2);
|
||||
} else {
|
||||
_rainOverCast = 1;
|
||||
|
||||
|
||||
GVAR(current_rain) = 0;
|
||||
};
|
||||
|
||||
_transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20));
|
||||
|
||||
|
||||
private _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20));
|
||||
|
||||
ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime];
|
||||
TRACE_4("",_lastRain,_rainOverCast,_transitionTime,overcast);
|
||||
|
||||
@ -50,47 +53,47 @@ if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then {
|
||||
};
|
||||
|
||||
// Wind simulation
|
||||
if (GVAR(syncWind) && GVAR(wind_period_count) > GVAR(wind_next_period)) then {
|
||||
|
||||
if (GVAR(syncWind) && {GVAR(wind_period_count) > GVAR(wind_next_period)}) then {
|
||||
|
||||
GVAR(wind_next_period) = ceil((2 + (random 5)) / _overcastMultiplier);
|
||||
GVAR(wind_period_count) = 0;
|
||||
|
||||
_windDirectionVariance = (90 - (random 180)) * (overcast ^ 2);
|
||||
_windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360;
|
||||
_windDirectionChange = _windDirection - GVAR(current_wind_direction);
|
||||
|
||||
private _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2);
|
||||
private _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360;
|
||||
private _windDirectionChange = _windDirection - GVAR(current_wind_direction);
|
||||
if (_windDirectionChange > 180) then {
|
||||
_windDirectionChange = _windDirectionChange - 360;
|
||||
};
|
||||
if (_windDirectionChange < -180) then {
|
||||
_windDirectionChange = 360 + _windDirectionChange;
|
||||
};
|
||||
|
||||
_windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed);
|
||||
_windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed);
|
||||
|
||||
_ratioMax = (random 1) ^ 2;
|
||||
_ratioMin = (random 1) ^ 2;
|
||||
|
||||
_windSpeed = GVAR(current_wind_speed);
|
||||
_windSpeedChange = 0;
|
||||
|
||||
private _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed);
|
||||
private _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed);
|
||||
|
||||
private _ratioMax = (random 1) ^ 2;
|
||||
private _ratioMin = (random 1) ^ 2;
|
||||
|
||||
private _windSpeed = GVAR(current_wind_speed);
|
||||
private _windSpeedChange = 0;
|
||||
if ((random 1) < (0.3 max overcast)) then {
|
||||
_windSpeed = GVAR(mean_wind_speed) + _windMaxDiff * _ratioMax + _windMinDiff * _ratioMin;
|
||||
_windSpeedChange = _windSpeed - GVAR(current_wind_speed);
|
||||
};
|
||||
|
||||
_transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval);
|
||||
|
||||
|
||||
private _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval);
|
||||
|
||||
TRACE_5("dirCur/dirNew/spdCur/spdNew/period",GVAR(current_wind_direction),_windDirection,GVAR(current_wind_speed),_windSpeed,_transitionTime);
|
||||
|
||||
|
||||
ACE_WIND_PARAMS = [GVAR(current_wind_direction),
|
||||
_windDirectionChange,
|
||||
GVAR(current_wind_speed),
|
||||
_windSpeedChange,
|
||||
_transitionTime];
|
||||
|
||||
_windDirectionChange,
|
||||
GVAR(current_wind_speed),
|
||||
_windSpeedChange,
|
||||
_transitionTime];
|
||||
|
||||
GVAR(current_wind_direction) = _windDirection;
|
||||
GVAR(current_wind_speed) = _windSpeed;
|
||||
|
||||
|
||||
GVAR(wind_period_start_time) = ACE_time;
|
||||
publicVariable "ACE_WIND_PARAMS";
|
||||
};
|
||||
@ -102,4 +105,4 @@ if (GVAR(syncMisc)) then {
|
||||
};
|
||||
|
||||
GVAR(rain_period_count) = GVAR(rain_period_count) + 1;
|
||||
GVAR(wind_period_count) = GVAR(wind_period_count) + 1;
|
||||
GVAR(wind_period_count) = GVAR(wind_period_count) + 1;
|
||||
|
@ -1,27 +1,30 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates GVAR(currentHumidity) based on
|
||||
* Updates GVAR(currentHumidity)
|
||||
*
|
||||
* Argument:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_updateHumidity
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_month", "_avgTemperature", "_pS1", "_pS2"];
|
||||
_month = date select 1;
|
||||
private _month = date select 1;
|
||||
|
||||
GVAR(currentHumidity) = (GVAR(Humidity) select (_month - 1)) / 100;
|
||||
|
||||
if (rain > 0 && overcast > 0.7) then {
|
||||
if ((rain > 0) && {overcast > 0.7}) then {
|
||||
GVAR(currentHumidity) = 1;
|
||||
} else {
|
||||
_avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;
|
||||
_pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
|
||||
_PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature)));
|
||||
private _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;
|
||||
private _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
|
||||
private _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature)));
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2;
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity) + GVAR(humidityShift);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: ACE2 Team, Ruthberg
|
||||
*
|
||||
* Updates rain based on ACE_RAIN_PARAMS
|
||||
*
|
||||
* Argument:
|
||||
@ -8,17 +7,21 @@
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_updateRain
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!GVAR(syncRain)) exitWith {};
|
||||
|
||||
if (!isNil "ACE_RAIN_PARAMS") then {
|
||||
ACE_RAIN_PARAMS params ["_oldRain", "_newRain", "_period"];
|
||||
|
||||
private ["_periodPosition", "_periodPercent"];
|
||||
_periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period;
|
||||
_periodPercent = (_periodPosition / _period) min 1;
|
||||
private _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period;
|
||||
private _periodPercent = (_periodPosition / _period) min 1;
|
||||
|
||||
GVAR(ACE_Rain) = (_oldRain + (_newRain - _oldRain) * _periodPercent);
|
||||
GVAR(ACE_Rain) = linearConversion [GVAR(rain_period_start_time), (GVAR(rain_period_start_time) + _period), ACE_time, _oldRain, _newRain];
|
||||
|
||||
TRACE_3("Update Rain",rain,ACE_RAIN_PARAMS,GVAR(ACE_Rain));
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates GVAR(currentTemperature) based on the map data
|
||||
*
|
||||
* Argument:
|
||||
@ -8,14 +7,18 @@
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_updateTemperature
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_time", "_month", "_timeRatio"];
|
||||
_time = daytime;
|
||||
_month = date select 1;
|
||||
private _time = daytime;
|
||||
private _month = date select 1;
|
||||
|
||||
_timeRatio = abs(_time - 12) / 12;
|
||||
private _timeRatio = abs(_time - 12) / 12;
|
||||
|
||||
GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _timeRatio) + (GVAR(TempNight) select (_month - 1)) * _timeRatio;
|
||||
GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast;
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: ACE2 Team, Ruthberg
|
||||
*
|
||||
* Updates wind, gusts and waves based on ACE_wind
|
||||
*
|
||||
* Argument:
|
||||
@ -8,19 +7,22 @@
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_weather_fnc_updateWind
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!GVAR(syncWind)) exitWith { ACE_wind = wind };
|
||||
|
||||
private ["_newWaves"];
|
||||
|
||||
ACE_wind = [] call FUNC(getWind);
|
||||
setWind [ACE_wind select 0, ACE_wind select 1, true];
|
||||
2 setGusts 0;
|
||||
|
||||
// Set waves: 0 when no wind, 1 when wind >= 16 m/s
|
||||
_newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0;
|
||||
private _newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0;
|
||||
if (abs(_newWaves - waves) > 0.1) then {
|
||||
1 setWaves _newWaves;
|
||||
};
|
||||
|
@ -1,6 +1,9 @@
|
||||
#define COMPONENT weather
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
//#define DEBUG_ENABLED_WEATHER
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_WEATHER
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user