139 {
140 #ifdef WEATHER_DATA_LOGGING
141 if ( !dayInit )
142 {
144 dayInit = true;
145 }
146 #endif
147
148 float phmnTime = 5;
149 float phmnLength = 10;
150 float phmnValue = 0;
151
152 int year, month, day, hour, minute;
154
156
159
160 switch (type)
161 {
162
164 {
165 #ifdef WEATHER_DATA_LOGGING
166 overcastChangeCount++;
167 #endif
168
169 float windDirection, windMag;
170
171
172 phmnValue = Math.RandomFloatInclusive( 0.1, 0.4 );
175
176
177
178 m_Chance = Math.RandomIntInclusive( 0, 100 );
179
180
181 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
182 {
184 }
185
186 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
187 {
190 }
191
192 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
193 {
196 }
197
198
200 {
203 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
205 }
207 {
210 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
212 }
214 {
217 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
219 }
220 else
221 {
224 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
226 }
227
230
233
234
235
237 {
239 #ifdef WEATHER_DATA_LOGGING
240 clearWeatherCount++;
241 #endif
242
243 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
246 }
247
249 {
251 #ifdef WEATHER_DATA_LOGGING
252 cloudyWeatherCount++;
253 #endif
254
255 phmnValue = Math.RandomFloatInclusive( 0.3, 0.7 );
258 }
259
261 {
263
264 phmnValue = Math.RandomFloatInclusive( 0.7, 1.0 );
267
268 #ifdef WEATHER_DATA_LOGGING
269 badWeatherCount++;
270 #endif
271
273 {
274 #ifdef WEATHER_DATA_LOGGING
275 suddenChangeCount++;
276 badWeatherCount--;
277 #endif
278
281 }
282
283 #ifdef WEATHER_DATA_LOGGING
285 {
287 {
288 suddenChangeCount--;
289 suddenStormCount++;
290 }
291 else
292 { stormCount++;
293 badWeatherCount--;
294 }
295 }
296 #endif
297 }
298
299 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
300
301
305
307
309 {
310 m_Weather.GetRain().Set(Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0);
311 }
312
313 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
314 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
315
316 #ifdef WEATHER_DATA_LOGGING
317 int testYear = 0;
318 int testMonth = 0;
319 int testDay = 0;
320 int testHour = 0;
321 int testMinute = 0;
323
324 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
325 {
327 FPrintln(file,
"================================================================");
328 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
329 FPrintln(file,
"================================================================");
330 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
331 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
332 FPrintln(file,
"Sudden Change Count: " + suddenChangeCount);
333 FPrintln(file,
"Storm Count: " + stormCount);
334 FPrintln(file,
"Sudden Storm Count: " + suddenStormCount);
335 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
336 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
337
338 currentDay++;
340 if ( currentDay == daysToRun )
341 {
343 }
344
345 overcastChangeCount = 0;
346 suddenChangeCount = 0;
347 stormCount = 0;
348 suddenStormCount = 0;
349 badWeatherCount = 0;
350 cloudyWeatherCount = 0;
351 clearWeatherCount = 0;
352 }
353 #endif
354
355 return true;
356 }
357
359 {
360 float actualOvercast =
m_Weather.GetOvercast().GetActual();
361
362 m_Chance = Math.RandomIntInclusive( 0, 100 );
363 phmnValue = 0.2;
364 phmnTime = 90;
365 phmnLength = 30;
366
368 {
370 Debug.WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
371 return true;
372 }
373
375 {
377 {
378 phmnValue = 0;
381 }
382 else
383 {
384 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
386 phmnLength = 0;
387 }
388
389 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
390 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
391 return true;
392 }
393
394
395 if ( actualOvercast < 0.75 )
396 {
398 {
399 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
402 }
404 {
405 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
408 }
410 {
411 phmnValue = Math.RandomFloatInclusive( 0.05, 0.2 );
414 }
415 else
416 {
417 phmnValue = 0;
420 }
421 }
422 else
423 {
425 {
426 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
428 phmnLength = 0;
429 }
431 {
432 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
434 phmnLength = 0;
435 }
437 {
438 phmnValue = Math.RandomFloatInclusive( 0.6, 0.8 );
440 phmnLength = 0;
441 }
442 else
443 {
444 phmnValue = 0;
447 }
448 }
449
450 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
451
452 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
453 return true;
454 }
455
457 {
458 if (( hour >= 2 ) && ( hour <= 5 ))
459 {
461 }
462 else
463 {
465 }
466
467 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
468
469 return true;
470 }
471
473 {
476
477 return true;
478 }
479 }
480 return false;
481 }
proto native World GetWorld()
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
proto void GetDate(out int year, out int month, out int day, out int hour, out int minute)
Get actual ingame world time.
float SUDDENCHANGE_TIME_MULTIPLIER
float SUDDENCHANGE_LENGTH_MULTIPLIER
float WIND_DIRECTION_TIME_MULTIPLIER
ref WorldDataWeatherSettings m_WeatherDefaultSettings
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.