Moved the global weather controls into preInit

This commit is contained in:
ulteq 2015-04-24 10:46:33 +02:00
parent 66e4c742b4
commit b3f4bf306d
3 changed files with 11 additions and 5 deletions

View File

@ -1,9 +1,5 @@
#include "script_component.hpp"
GVAR(syncRain) = true;
GVAR(syncWind) = true; // Wind, Gusts, Waves
GVAR(syncMisc) = true; // Lightnings, Rainbow, Fog
GVAR(wind_period_start_time) = time;
GVAR(rain_period_start_time) = time;

View File

@ -15,6 +15,14 @@ PREP(updateRain);
PREP(updateTemperature);
PREP(updateWind);
// Control server side weather propagation
GVAR(enableServerController) = true;
// Control client side weather effects
GVAR(syncRain) = true;
GVAR(syncWind) = true; // Wind, Gusts, Waves
GVAR(syncMisc) = true; // Lightnings, Rainbow, Fog
// Make sure this data is read before client/server postInit
call FUNC(getMapData);

View File

@ -11,6 +11,8 @@
*/
#include "script_component.hpp"
if (!GVAR(enableServerController)) exitWith {};
private ["_lastRain", "_rainOverCast", "_transitionTime", "_windDirectionVariance", "_windSpeed", "_windSpeedChange", "_windMaxDiff", "_windMinDiff", "_windDirection", "_windDirectionChange", "_ratioMin", "_ratioMax"];
// Rain simulation
@ -27,7 +29,7 @@ if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then {
// Initialize rain with a random strength depending on the current overcast value
GVAR(current_rain) = 0.25 + (random 0.25) + (random 0.5) * _rainOverCast;
};
hintSilent format["%1, %2", ((_rainOverCast * GVAR(overcast_multiplier)) / 8), GVAR(rain_current_range)];
GVAR(current_rain) = GVAR(current_rain) + GVAR(current_rain) * ((_rainOverCast * GVAR(overcast_multiplier)) / 8) * GVAR(rain_current_range);
GVAR(current_rain) = 0.01 max GVAR(current_rain) min 1;