4 const float RAIN_THRESHOLD = 0.6;
5 const float STORM_THRESHOLD = 0.9;
7 const int OVERCAST_MIN_TIME = 600;
8 const int OVERCAST_MAX_TIME = 900;
10 const int RAIN_TIME_MIN = 60;
11 const int RAIN_TIME_MAX = 120;
13 const int CLEAR_WEATHER = 1;
14 const int CLOUDY_WEATHER = 2;
15 const int BAD_WEATHER = 3;
17 const int CLEAR_WEATHER_CHANCE = 30;
18 const int BAD_WEATHER_CHANCE = 80;
20 protected int m_clearWeatherChance = CLEAR_WEATHER_CHANCE;
22 protected int m_badWeatherChance = BAD_WEATHER_CHANCE;
24 protected int m_sameWeatherCnt = 0;
25 protected int m_stepValue = 5;
26 protected int m_chance = 50;
28 protected int m_choosenWeather = 1;
29 protected int m_lastWeather = 0;
32 protected static const ref
array<vector> CHERNARUS_ARTY_STRIKE_POS =
34 "-500.00 165.00 5231.69",
35 "-500.00 300.00 9934.41",
36 "10406.86 192.00 15860.00",
37 "4811.75 370.00 15860.00",
38 "-500.00 453.00 15860.00"
52 m_MinTemps = {-3,-2,0,4,9,14,18,17,12,7,4,0};
61 m_MaxTemps = {3,5,7,14,19,24,26,25,21,16,10,5};
70 m_FiringPos = CHERNARUS_ARTY_STRIKE_POS;
73 override bool WeatherOnBeforeChange(
EWeatherPhenomenon type,
float actual,
float change,
float time )
79 m_Weather.SetStorm( 1.0, STORM_THRESHOLD, 45 );
81 m_Weather.SetRainThresholds( 0.0, 1.0, 60 );
82 m_Weather.SetWindMaximumSpeed( 20 );
83 m_Weather.SetWindFunctionParams( 0.1, 1.0, 20 );
91 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.7 );
92 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
93 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
97 m_chance =
Math.RandomIntInclusive( 0, 100 );
100 if ( m_lastWeather == CLEAR_WEATHER )
102 m_clearWeatherChance -= ( m_stepValue * m_sameWeatherCnt);
105 if ( m_lastWeather == CLOUDY_WEATHER )
107 m_clearWeatherChance += ( m_stepValue * m_sameWeatherCnt);
111 if ( m_lastWeather == BAD_WEATHER )
113 m_clearWeatherChance += m_stepValue;
114 m_badWeatherChance += (( m_stepValue * m_sameWeatherCnt ) + m_stepValue );
118 if ( m_chance < m_clearWeatherChance )
120 m_choosenWeather = CLEAR_WEATHER;
121 if ( m_lastWeather == CLEAR_WEATHER )
124 else if ( m_chance > m_badWeatherChance )
126 m_choosenWeather = BAD_WEATHER;
127 if ( m_lastWeather == BAD_WEATHER )
132 m_choosenWeather = CLOUDY_WEATHER;
133 if ( m_lastWeather == CLOUDY_WEATHER )
137 if ( m_choosenWeather != m_lastWeather )
138 m_sameWeatherCnt = 0;
140 m_clearWeatherChance = CLEAR_WEATHER_CHANCE;
141 m_badWeatherChance = BAD_WEATHER_CHANCE;
145 if ( m_choosenWeather == CLEAR_WEATHER )
147 m_lastWeather = CLEAR_WEATHER;
149 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.3 );
150 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
151 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
154 if ( m_choosenWeather == CLOUDY_WEATHER )
156 m_lastWeather = CLOUDY_WEATHER;
158 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.6 );
159 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
160 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
163 if ( m_choosenWeather == BAD_WEATHER )
165 m_lastWeather = BAD_WEATHER;
167 phmnValue =
Math.RandomFloatInclusive( 0.6, 1.0 );
168 phmnTime =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
169 phmnLength =
Math.RandomIntInclusive( OVERCAST_MIN_TIME, OVERCAST_MAX_TIME );
172 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
174 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
175 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(), m_Weather.GetRain().GetActual()));
182 float actualOvercast = m_Weather.GetOvercast().GetActual();
184 m_chance =
Math.RandomIntInclusive( 0, 100 );
189 if ( actualOvercast <= RAIN_THRESHOLD )
191 m_Weather.GetRain().Set( 0.0, RAIN_TIME_MIN, RAIN_TIME_MAX );
192 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
196 if ( actualOvercast > STORM_THRESHOLD )
198 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
199 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
202 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
203 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
208 if ( actualOvercast < 0.75 )
212 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.3 );
213 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
216 else if ( m_chance < 60 )
218 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.5 );
219 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
222 else if ( m_chance < 80 )
224 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.2 );
225 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
231 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
239 phmnValue =
Math.RandomFloatInclusive( 0.5, 0.7 );
240 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
243 else if ( m_chance < 50 )
245 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
246 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
249 else if ( m_chance < 75 )
251 phmnValue =
Math.RandomFloatInclusive( 0.4, 0.6 );
252 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
258 phmnTime =
Math.RandomInt( RAIN_TIME_MIN, RAIN_TIME_MAX );
263 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
265 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
274 float fogTime = 1800.0;
276 float fogyMorning =
Math.RandomFloatInclusive( 0.0, 1.0 );
278 if ( fogyMorning > 0.85 )
280 if ( (
g_Game.GetDayTime() > 4 &&
g_Game.GetDayTime() < 7 ) )
288 if ( m_Weather.GetOvercast().GetActual() < 0.3 )
295 m_Weather.GetFog().Set(
Math.RandomFloatInclusive( fogMin, fogMax ), fogTime, 0);
297 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));