Added random temperatureShift, badWeatherShift, humidityShift

This commit is contained in:
ulteq 2015-04-21 20:41:50 +02:00
parent 30d1b1b5e5
commit 428baefc2c
4 changed files with 13 additions and 2 deletions

View File

@ -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);
};
};

View File

@ -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;

View File

@ -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;

View File

@ -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;