5 #ifdef WEATHER_DATA_LOGGING
6 int overcastChangeCount = 0;
7 int suddenChangeCount = 0;
9 int suddenStormCount = 0;
10 int badWeatherCount = 0;
11 int cloudyWeatherCount = 0;
12 int clearWeatherCount = 0;
26 "7440.00 417.00 -500.00",
27 "-500.00 276.00 5473.00",
28 "-500.00 265.00 9852.00",
29 "4953.00 240.00 13300.00",
30 "9620.00 188.00 13300.00",
31 "13300.00 204.00 10322.00",
32 "13300.00 288.00 6204.00",
33 "13300.00 296.00 -500.00"
47 m_MinTemps = {-7,-7.4,-4.1,1.5,7,11.3,20.4,19.1,18,5.3,0.8,-3.6};
56 m_MaxTemps = {-2.5,-2.1,2.3,9,15.5,19.4,25,22,21,10.5,4.2,0.1};
81 m_Weather.GetOvercast().Set(startingOvercast,0,5);
91 super.InitYieldBank();
96 m_YieldBank.RegisterYieldItem(
new YieldItemCarp(42));
99 m_YieldBank.RegisterYieldItem(
new YieldItemBitterlings(15));
106 m_YieldBank.RegisterYieldItem(
new YieldItemJunkEmpty(1,
"Pot"));
110 m_YieldBank.RegisterYieldItem(
new YieldItemDeadRooster(1));
112 m_YieldBank.RegisterYieldItem(
new YieldItemDeadChicken_Spotted(1));
114 m_YieldBank.RegisterYieldItem(
new YieldItemDeadFox(2));
119 super.SetupWeatherSettings();
140 #ifdef WEATHER_DATA_LOGGING
149 float phmnLength = 10;
152 int year, month, day, hour, minute;
165 #ifdef WEATHER_DATA_LOGGING
166 overcastChangeCount++;
169 float windDirection, windMag;
181 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
186 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
192 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
203 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
210 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
217 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
224 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
239 #ifdef WEATHER_DATA_LOGGING
251 #ifdef WEATHER_DATA_LOGGING
252 cloudyWeatherCount++;
268 #ifdef WEATHER_DATA_LOGGING
274 #ifdef WEATHER_DATA_LOGGING
283 #ifdef WEATHER_DATA_LOGGING
299 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
313 Debug.
WeatherLog(
string.Format(
"Enoch::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
316 #ifdef WEATHER_DATA_LOGGING
324 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
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);
340 if ( currentDay == daysToRun )
345 overcastChangeCount = 0;
346 suddenChangeCount = 0;
348 suddenStormCount = 0;
350 cloudyWeatherCount = 0;
351 clearWeatherCount = 0;
360 float actualOvercast =
m_Weather.GetOvercast().GetActual();
370 Debug.
WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
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));
395 if ( actualOvercast < 0.75 )
450 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
458 if (( hour >= 2 ) && ( hour <= 5 ))
483 protected override void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction)
490 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
492 if ( windChance < 10 )
497 else if ( windChance < 50 )
509 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
511 if ( windChance < 45 )
516 else if ( windChance < 90 )
534 else if ( windChance < 45 )
539 else if ( windChance < 90 )
552 protected override void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime)
554 float distanceDensity, heigthDensity, heightBias;
555 int year, month, day, hour, minute;
558 if ( hour < 6 && hour >= 3 )
560 heightBias =
m_Weather.GetDynVolFogHeightBias();
578 distanceDensity =
Math.
Lerp( 0.01, 0.03, lerpValue ) *
Math.
Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
579 heigthDensity =
Math.
Lerp( 0.9, 1, lerpValue);
583 distanceDensity =
Math.
Lerp( 0.5, 0.1, lerpValue ) *
Math.
Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
584 heigthDensity =
Math.
Lerp( 0.2, 1, lerpValue);
587 else if ( hour < 18 && hour >= 6 )
589 distanceDensity =
Math.
Lerp( 0.01, 0.05, lerpValue ) *
Math.
Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
590 heigthDensity =
Math.
Lerp( 0.9, 1, lerpValue);
595 distanceDensity =
Math.
Lerp( 0.01, 0.03, lerpValue ) *
Math.
Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
596 heigthDensity =
Math.
Lerp( 0.9, 1, lerpValue);
600 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
601 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
602 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);
607 #ifdef WEATHER_DATA_LOGGING
void YieldItemJunk(int baseWeight, string type)
proto native World GetWorld()
static array< float > GetEnvironmentMaxTemps()
static array< float > GetEnvironmentMinTemps()
static void WeatherLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
override void SetupLiquidTemperatures()
override bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
override void SetupWeatherSettings()
const float RAIN_THRESHOLD
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
const int CLEAR_WEATHER
DEPRECATED (see WorldDataWeatherConstants)
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
const int OVERCAST_MAX_TIME
const float STORM_THRESHOLD
override void InitYieldBank()
static const ref array< vector > LIVONIA_ARTY_STRIKE_POS
const int OVERCAST_MIN_TIME
DEPRECATED (see WorldDataWeatherSettings)
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
ref WorldDataLiquidSettings m_LiquidSettings
float WIND_DIRECTION_TIME_MULTIPLIER
ref WorldDataWeatherSettings m_WeatherDefaultSettings
ref array< vector > m_FiringPos
float m_TemperaturePerHeightReductionModifier
directly accesible (defined/overriden in Init())
float m_CloudsTemperatureEffectModifier
amount of °C reduced for each 100 meteres of height above water level
ref CatchYieldBank m_YieldBank
int m_BadWeatherChance
weather related
float WIND_MAGNITUDE_TIME_MULTIPLIER
float m_UniversalTemperatureSourceCapModifier
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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.
const int LIQUID_STILLWATER
const int LIQUID_FRESHWATER
const int LIQUID_CLEANWATER
const int LIQUID_RIVERWATER
const int LIQUID_SALTWATER
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].