diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 59a83b2a85..6c287c3a8a 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -2,6 +2,11 @@ call FUNC(getMapData); +// Randomization +GVAR(temperatureShift) = 3 - random 6; +GVAR(badWeatherShift) = (random 1) ^ 2 * 10; +GVAR(humidityShift) = (5 - random 10) / 100; + // Rain variables GVAR(enableRain) = true; GVAR(rain_next_period) = -1; @@ -24,6 +29,11 @@ call FUNC(initWind); 30 setLightnings (ACE_MISC_PARAMS select 0); 30 setRainbow (ACE_MISC_PARAMS select 1); 30 setFog (ACE_MISC_PARAMS select 2); + 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); }; }; diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 878f0bc241..cc96ccdf41 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -73,7 +73,7 @@ if(GVAR(wind_period_count) > GVAR(wind_next_period)) then { }; // Sync misc. parameters -ACE_MISC_PARAMS = [lightnings, rainbow, fogParams]; +ACE_MISC_PARAMS = [lightnings, rainbow, fogParams, GVAR(temperatureShift), GVAR(badWeatherShift), GVAR(humidityShift)]; publicVariable "ACE_MISC_PARAMS"; GVAR(rain_period_count) = GVAR(rain_period_count) + 1; diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf index e3ba7a0224..07edec1854 100644 --- a/addons/weather/functions/fnc_updateHumidity.sqf +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -23,6 +23,7 @@ if (rain > 0 && overcast > 0.7) then { _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; + GVAR(currentHumidity) = GVAR(currentHumidity) + GVAR(humidityShift); }; GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 3a25a7bc52..d66a9b28f4 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -18,5 +18,5 @@ _month = date select 1; _hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440)); GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef; -GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * GVAR(currentHumidity) - 4 * overcast; +GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast; GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;