Weather - Properly sync overcast value (#5688)

* Makes sure that all clients share the same (numeric) overcast value
* Only affects the barometric pressure calculation
* Does not affect the actual weather on the clients
This commit is contained in:
ulteq 2017-10-27 12:39:48 +02:00 committed by GitHub
parent 7acff1848b
commit cda060d3e0
8 changed files with 13 additions and 11 deletions

View File

@ -112,7 +112,7 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, CBA_missionTime toFixed 6];
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), EGVAR(weather,currentOvercast), CBA_missionTime toFixed 6];
GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];

View File

@ -11,13 +11,14 @@ GVAR(wind_period_start_time) = CBA_missionTime;
if (!isServer) then {
"ACE_MISC_PARAMS" addPublicVariableEventHandler {
TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS);
GVAR(currentOvercast) = (ACE_MISC_PARAMS select 0);
if (GVAR(syncMisc)) then {
30 setRainbow (ACE_MISC_PARAMS select 0);
30 setFog (ACE_MISC_PARAMS select 1);
30 setRainbow (ACE_MISC_PARAMS select 1);
30 setFog (ACE_MISC_PARAMS select 2);
};
GVAR(temperatureShift) = (ACE_MISC_PARAMS select 2);
GVAR(badWeatherShift) = (ACE_MISC_PARAMS select 3);
GVAR(humidityShift) = (ACE_MISC_PARAMS select 4);
GVAR(temperatureShift) = (ACE_MISC_PARAMS select 3);
GVAR(badWeatherShift) = (ACE_MISC_PARAMS select 4);
GVAR(humidityShift) = (ACE_MISC_PARAMS select 5);
call FUNC(updateTemperature);
call FUNC(updateHumidity);
};

View File

@ -15,4 +15,4 @@
*/
#include "script_component.hpp"
((1013.25 - 10 * overcast) * (1 - (0.0065 * (EGVAR(common,mapAltitude) + _this)) / (KELVIN(GVAR(currentTemperature)) + 0.0065 * EGVAR(common,mapAltitude))) ^ 5.255754495);
((1013.25 - 10 * GVAR(currentOvercast)) * (1 - (0.0065 * (EGVAR(common,mapAltitude) + _this)) / (KELVIN(GVAR(currentTemperature)) + 0.0065 * EGVAR(common,mapAltitude))) ^ 5.255754495);

View File

@ -45,6 +45,7 @@ GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
GVAR(currentTemperature) = 20;
GVAR(currentHumidity) = 0.5;
GVAR(currentOvercast) = 0;
// Get all non inherited arrays to filter maps that inherit from Stratis/Altis/Tanoa
private _nonInheritedArrays = configProperties [configFile >> "CfgWorlds" >> _worldName, "isArray _x", false];

View File

@ -27,7 +27,7 @@ if (GVAR(useACEWeather)) then {
publicVariable "ACE_WIND_PARAMS";
};
if (GVAR(syncMisc)) then {
ACE_MISC_PARAMS = [rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)];
ACE_MISC_PARAMS = [overcast, rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)];
publicVariable "ACE_MISC_PARAMS";
};
};

View File

@ -99,7 +99,7 @@ if (GVAR(syncWind) && {GVAR(wind_period_count) > GVAR(wind_next_period)}) then {
if (GVAR(syncMisc)) then {
ACE_MISC_PARAMS = [rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)];
ACE_MISC_PARAMS = [overcast, rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)];
publicVariable "ACE_MISC_PARAMS";
};

View File

@ -19,7 +19,7 @@ private _month = date select 1;
GVAR(currentHumidity) = (GVAR(Humidity) select (_month - 1)) / 100;
if ((rain > 0) && {overcast > 0.7}) then {
if ((rain > 0) && {GVAR(currentOvercast) > 0.7}) then {
GVAR(currentHumidity) = 1;
} else {
private _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;

View File

@ -21,7 +21,7 @@ private _month = date select 1;
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;
GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * GVAR(currentOvercast);
GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;
TRACE_2("temperatureShift/badWeatherShift",GVAR(temperatureShift),GVAR(badWeatherShift));