4 const float SPAWN_CHANCE_CHOLERA = 20;
5 const float COLD_AREA_TOOL_DMG_MODIF = 1.2;
8 #ifdef WEATHER_DATA_LOGGING
9 int overcastChangeCount = 0;
10 int directSuddenChangeCount = 0;
11 int badWeatherSuddenChangeCount = 0;
12 int thundersnowCount = 0;
13 int suddenThundersnowCount = 0;
14 int badWeatherCount = 0;
15 int cloudyWeatherCount = 0;
16 int clearWeatherCount = 0;
39 m_MinTemps = {-6.5, -9.5, -6.5, -9.5, 2, 6, 9, 10, 6, 1, -5, -10};
48 m_MaxTemps = {-3, -5, -3, -5, 9, 14, 16, 17, 14, 8, 1, -3};
58 m_TemperatureInsideBuildingsModifier = -1.0;
67 m_Weather.SetDynVolFogHeightDensity( 1, 0 );
71 m_Weather.GetOvercast().SetLimits(0.07, 1);
85 override void InitYieldBank()
87 super.InitYieldBank();
110 override void SetupWeatherSettings()
112 super.SetupWeatherSettings();
120 override void SetupLiquidTemperatures()
135 override bool WeatherOnBeforeChange(
EWeatherPhenomenon type,
float actual,
float change,
float time )
137 #ifdef WEATHER_DATA_LOGGING
140 GetGame().GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
145 float phmnTime = 120;
146 float phmnLength = 10;
151 m_Weather.GetOvercast().SetLimits(0.07, 1);
154 m_Weather.GetSnowfall().SetForecastChangeLimits(0, 1);
159 m_Weather.GetWindMagnitude().SetForecastChangeLimits( 0, 20 );
168 float windDirection, windMag;
170 #ifdef WEATHER_DATA_LOGGING
171 overcastChangeCount++;
174 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.7 );
180 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
185 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
190 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
202 #ifdef WEATHER_DATA_LOGGING
203 directSuddenChangeCount++;
208 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
216 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
223 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
230 #ifdef WEATHER_DATA_LOGGING
240 #ifdef WEATHER_DATA_LOGGING
241 badWeatherSuddenChangeCount++;
246 #ifdef WEATHER_DATA_LOGGING
256 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
271 #ifdef WEATHER_DATA_LOGGING
274 phmnValue =
Math.RandomFloatInclusive( 0.07, 0.3 );
281 #ifdef WEATHER_DATA_LOGGING
282 cloudyWeatherCount++;
286 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.6 );
295 phmnValue =
Math.RandomFloatInclusive( 0.6, 1.0 );
305 #ifdef WEATHER_DATA_LOGGING
310 suddenThundersnowCount++;
313 directSuddenChangeCount--;
317 badWeatherSuddenChangeCount--;
330 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
339 m_Weather.GetSnowfall().Set(
Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0);
342 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
343 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Overcast::Snow:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
345 #ifdef WEATHER_DATA_LOGGING
351 GetGame().GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
353 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
356 FPrintln(file,
"================================================================");
357 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
358 FPrintln(file,
"================================================================");
359 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
360 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
361 FPrintln(file,
"Bad Weather Sudden Change Count: " + badWeatherSuddenChangeCount);
362 FPrintln(file,
"Global Sudden Change Count: " + directSuddenChangeCount);
363 FPrintln(file,
"Thunder Snow Count: " + thundersnowCount);
364 FPrintln(file,
"Sudden Thundersnow Count: " + suddenThundersnowCount);
365 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
366 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
370 if ( currentDay == daysToRun )
375 overcastChangeCount = 0;
376 directSuddenChangeCount = 0;
377 badWeatherSuddenChangeCount = 0;
378 thundersnowCount = 0;
379 suddenThundersnowCount = 0;
381 cloudyWeatherCount = 0;
382 clearWeatherCount = 0;
392 float actualOvercast =
m_Weather.GetOvercast().GetActual();
404 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Snow::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
410 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
414 m_Weather.GetSnowfall().Set( phmnValue, phmnTime, phmnLength );
417 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Snow::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
421 if ( actualOvercast ==
m_Weather.GetOvercast().GetForecast() &&
m_Weather.GetSnowfall().GetActual() >= 0.8 &&
m_Weather.GetWindSpeed() >= 10 )
423 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
427 m_Weather.GetWindMagnitude().Set(
m_Weather.GetWindMagnitude().GetActual() * 0.2, phmnTime , phmnLength);
428 m_Weather.GetSnowfall().Set( phmnValue, phmnTime, phmnLength );
431 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Snow::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
435 if ( actualOvercast < 0.6 )
439 phmnValue =
Math.RandomFloatInclusive( 0.02, 0.4 );
450 else if ( actualOvercast < 0.75 )
454 phmnValue =
Math.RandomFloatInclusive( 0.5, 0.8 );
460 phmnValue =
Math.RandomFloat( 0.3, 0.5 );
466 phmnValue =
Math.RandomFloatInclusive( 0.02, 0.3 );
474 phmnValue =
Math.RandomFloat( 0.3, 0.5 );
490 phmnValue =
Math.RandomFloatInclusive( 0.7, 1.0 );
496 phmnValue =
Math.RandomFloatInclusive( 0.5, 0.7 );
502 phmnValue =
Math.RandomFloat( 0.2, 0.5 );
510 phmnValue =
Math.RandomFloat( 0.5, 0.7 );
516 phmnValue =
Math.RandomFloat( 0.02, 0.1 );
523 m_Weather.GetSnowfall().Set( phmnValue, phmnTime, phmnLength );
526 Debug.WeatherLog(
string.Format(
"Sakhal::Weather::Snow:: (%1) %2",
g_Game.GetDayTime(), actual));
587 protected override void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction)
592 float windChance =
Math.RandomIntInclusive( 0, 100 );
594 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
596 if ( windChance < 15 )
598 magnitude =
Math.RandomFloatInclusive( 2 , 4 );
599 direction =
Math.RandomFloatInclusive( -0.35 , 0.35);
601 else if ( windChance < 90 )
603 magnitude =
Math.RandomFloatInclusive( 3 , 6 );
604 direction =
Math.RandomFloatInclusive( 0 , 2.2);
608 magnitude =
Math.RandomFloatInclusive( 8 , 15 );
609 direction =
Math.RandomFloatInclusive( -3.0 , -2.25);
612 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
614 if ( windChance < 45 )
616 magnitude =
Math.RandomFloatInclusive( 5 , 10 );
617 direction =
Math.RandomFloatInclusive( 1.0 , 1.25);
619 else if ( windChance < 90 )
621 magnitude =
Math.RandomFloatInclusive( 8 , 14 );
622 direction =
Math.RandomFloatInclusive( -1.8, -1.4);
626 magnitude =
Math.RandomFloatInclusive( 2 , 4 );
627 direction =
Math.RandomFloatInclusive( -1.0 , -0.4);
632 if ( suddenChange ||
m_Weather.GetOvercast().GetForecast() > 0.85 )
634 magnitude =
Math.RandomFloatInclusive( 18 , 20 );
635 direction =
Math.RandomFloatInclusive( 2.25 , 3.14);
637 else if ( windChance < 45 )
639 magnitude =
Math.RandomFloatInclusive( 6 , 12 );
640 direction =
Math.RandomFloatInclusive( -1.8 , -1.4);
642 else if ( windChance < 90 )
644 magnitude =
Math.RandomFloatInclusive( 8 , 20 );
645 direction =
Math.RandomFloatInclusive( 1.6 , 2.0);
649 magnitude =
Math.RandomFloatInclusive( 4 , 10 );
650 direction =
Math.RandomFloatInclusive( 1.5, 1.75 );
657 protected override void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime)
659 float maxVolFogDistanceDensity =
Math.Lerp( 0, 0.35,
Easing.EaseInQuart(lerpValue) );
660 float minVolFogDistanceDensity =
Math.Lerp(0.001, 0.01,
m_Weather.GetOvercast().GetActual());
662 if (minVolFogDistanceDensity > maxVolFogDistanceDensity)
663 maxVolFogDistanceDensity = minVolFogDistanceDensity;
665 float volFogDistanceDensity =
Math.Lerp( minVolFogDistanceDensity, maxVolFogDistanceDensity, windMagnitude/
m_Weather.GetWindMaximumSpeed() );
666 m_Weather.SetDynVolFogDistanceDensity(volFogDistanceDensity, changeTime);
672 return SPAWN_CHANCE_CHOLERA;
679 return COLD_AREA_TOOL_DMG_MODIF;
684 #ifdef WEATHER_DATA_LOGGING