92 {
93 #ifdef WEATHER_DATA_LOGGING
94 if ( !dayInit )
95 {
97 dayInit = true;
98 }
99 #endif
100
101 float phmnTime = 5;
102 float phmnLength = 10;
103 float phmnValue = 0;
104
106
109
111 {
113 }
114
115 switch (type)
116 {
117
119 {
120 #ifdef WEATHER_DATA_LOGGING
121 overcastChangeCount++;
122 #endif
123
124 float windDirection, windMag;
125
126
127 phmnValue = Math.RandomFloatInclusive( 0.2, 0.7 );
130
131
132
133 m_Chance = Math.RandomIntInclusive( 0, 100 );
134
135
136 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
137 {
139 }
140
141 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
142 {
144 }
145
146 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
147 {
150 }
151
152
154 {
156 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
158 }
160 {
162 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
164 }
165 else
166 {
168 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
170 }
171
174
177
178
179
181 {
183 #ifdef WEATHER_DATA_LOGGING
184 clearWeatherCount++;
185 #endif
186
187 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
190 }
191
193 {
195 #ifdef WEATHER_DATA_LOGGING
196 cloudyWeatherCount++;
197 #endif
198
199 phmnValue = Math.RandomFloatInclusive( 0.3, 0.6 );
202 }
203
205 {
207 #ifdef WEATHER_DATA_LOGGING
208 badWeatherCount++;
209 #endif
210
211 phmnValue = Math.RandomFloatInclusive( 0.6, 1.0 );
214 }
215
216 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
217
221
223
224 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
225 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
226
227 #ifdef WEATHER_DATA_LOGGING
228 int testYear = 0;
229 int testMonth = 0;
230 int testDay = 0;
231 int testHour = 0;
232 int testMinute = 0;
234
235 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
236 {
238 FPrintln(file,
"================================================================");
239 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
240 FPrintln(file,
"================================================================");
241 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
242 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
243 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
244 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
245
246 currentDay++;
248 if ( currentDay == daysToRun )
249 {
251 }
252
253 overcastChangeCount = 0;
254 badWeatherCount = 0;
255 cloudyWeatherCount = 0;
256 clearWeatherCount = 0;
257 }
258 #endif
259
260 return true;
261 }
262
264 {
265 float actualOvercast =
m_Weather.GetOvercast().GetActual();
266
267 m_Chance = Math.RandomIntInclusive( 0, 100 );
268 phmnValue = 0.2;
269 phmnTime = 90;
270 phmnLength = 30;
271
273 {
275 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
276 return true;
277 }
278
280 {
281 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
283 phmnLength = 0;
284
285 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
286 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
287 return true;
288 }
289
290
291 if ( actualOvercast < 0.75 )
292 {
294 {
295 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
297 phmnLength = 0;
298 }
300 {
301 phmnValue = Math.RandomFloatInclusive( 0.2, 0.5 );
303 phmnLength = 0;
304 }
306 {
307 phmnValue = Math.RandomFloatInclusive( 0.0, 0.2 );
309 phmnLength = 0;
310 }
311 else
312 {
313 phmnValue = 0;
316 }
317 }
318 else
319 {
321 {
322 phmnValue = Math.RandomFloatInclusive( 0.5, 0.7 );
324 phmnLength = 0;
325 }
327 {
328 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
330 phmnLength = 0;
331 }
333 {
334 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
336 phmnLength = 0;
337 }
338 else
339 {
340 phmnValue = 0;
343 }
344 }
345
346 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
347
348 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
349
350 return true;
351 }
352
354 {
355 float fogMin = 0.0;
356 float fogMax = 0.15;
357 float fogTime = 1800.0;
358
359 float fogyMorning = Math.RandomFloatInclusive( 0.0, 1.0 );
360
361 if ( fogyMorning > 0.85 )
362 {
363 if ( (
g_Game.GetDayTime() > 4 &&
g_Game.GetDayTime() < 7 ) )
364 {
365 fogMin = 0.10;
366 fogMax = 0.35;
367 fogTime = 300;
368 }
369 }
370
371 if (
m_Weather.GetOvercast().GetActual() < 0.3 )
372 {
373 fogMin = 0.0;
374 fogMax = 0.08;
375 fogTime = 900.0;
376 }
377
378 m_Weather.GetFog().Set( Math.RandomFloatInclusive( fogMin, fogMax ), fogTime, 0);
379
380 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
381
382 return true;
383 }
384
386 {
389
390 return true;
391 }
392 }
393
394 return false;
395 }
proto native World GetWorld()
proto void GetDate(out int year, out int month, out int day, out int hour, out int minute)
Get actual ingame world time.
void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
float WIND_DIRECTION_TIME_MULTIPLIER
ref WorldDataWeatherSettings m_WeatherDefaultSettings
void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
int m_BadWeatherChance
weather related
float WIND_MAGNITUDE_TIME_MULTIPLIER
proto native CGame GetGame()
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.