Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
enoch.c
Go to the documentation of this file.
1//#define WEATHER_DATA_LOGGING
3{
4 //-------test variables & methods ------
5 #ifdef WEATHER_DATA_LOGGING
6 int overcastChangeCount = 0;
7 int suddenChangeCount = 0;
8 int stormCount = 0;
9 int suddenStormCount = 0;
10 int badWeatherCount = 0;
11 int cloudyWeatherCount = 0;
12 int clearWeatherCount = 0;
13 int startYear = 0;
14 int startMonth = 0;
15 int startDay = 0;
16 int startHour = 0;
17 int startMinute = 0;
18 int currentDay = 0;
19 int daysToRun = 10;
20 bool dayInit = false;
21 #endif
22 //------------------------
23
24 protected static const ref array<vector> LIVONIA_ARTY_STRIKE_POS =
25 {
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"
34 };
35
36 override void Init()
37 {
38 super.Init();
39
40 // new temperature curve settings
41 m_Sunrise_Jan = 8.4;
42 m_Sunset_Jan = 15.63;
43 m_Sunrise_Jul = 3.65;
44 m_Sunset_Jul = 20.35;
45
46 int tempIdx;
47 m_MinTemps = {-7,-7.4,-4.1,1.5,7,11.3,20.4,19.1,18,5.3,0.8,-3.6}; //{-7,-7.4,-4.1,1.5,7,11.3,13.4,13.1,9.3,5.3,0.8,-3.6} original values, due to altitude of the map, changed the values drastically
48 if (CfgGameplayHandler.GetEnvironmentMinTemps() && CfgGameplayHandler.GetEnvironmentMinTemps().Count() == 12)
49 {
50 for (tempIdx = 0; tempIdx < CfgGameplayHandler.GetEnvironmentMinTemps().Count(); tempIdx++)
51 {
52 m_MinTemps[tempIdx] = CfgGameplayHandler.GetEnvironmentMinTemps().Get(tempIdx);
53 }
54 }
55
56 m_MaxTemps = {-2.5,-2.1,2.3,9,15.5,19.4,25,22,21,10.5,4.2,0.1}; //{-2.5,-2.1,2.3,9,15.5,19.4,20.9,20.4,16,10.5,4.2,0.1} original values
57 if (CfgGameplayHandler.GetEnvironmentMaxTemps() && CfgGameplayHandler.GetEnvironmentMaxTemps().Count() == 12)
58 {
59 for (tempIdx = 0; tempIdx < CfgGameplayHandler.GetEnvironmentMaxTemps().Count(); tempIdx++)
60 {
61 m_MaxTemps[tempIdx] = CfgGameplayHandler.GetEnvironmentMaxTemps().Get(tempIdx);
62 }
63 }
64
66
67 m_CloudsTemperatureEffectModifier = -5.0;
68 m_WorldWindCoef = 0.3;
69 m_TemperaturePerHeightReductionModifier = 0.01;
70
72
73 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
74 {
75 m_Weather.SetDynVolFogHeightBias(m_WeatherDefaultSettings.m_DefaultHeigthBias);
76
77 if (GetGame().IsMultiplayer())
78
79 {
80 float startingOvercast = Math.RandomFloat(0.2,0.75);
81 m_Weather.GetOvercast().Set(startingOvercast,0,5); //forcing a random weather at a clean server start and an instant change for overcast
82 CalculateVolFog(startingOvercast, m_Weather.GetWindSpeed(), 0);
83 }
84 }
85
86
87 }
88
89 override void InitYieldBank()
90 {
91 super.InitYieldBank();
92
94
95 //fishies
96 m_YieldBank.RegisterYieldItem(new YieldItemCarp(42));
99 m_YieldBank.RegisterYieldItem(new YieldItemBitterlings(15));
100
101 //fishy junk
102 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Brown"));
103 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Grey"));
104 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Green"));
105 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Black"));
106 m_YieldBank.RegisterYieldItem(new YieldItemJunkEmpty(1,"Pot"));
107
108 //non-fishies
110 m_YieldBank.RegisterYieldItem(new YieldItemDeadRooster(1));
112 m_YieldBank.RegisterYieldItem(new YieldItemDeadChicken_Spotted(1));
114 m_YieldBank.RegisterYieldItem(new YieldItemDeadFox(2));
115 }
116
117 override void SetupWeatherSettings()
118 {
119 super.SetupWeatherSettings();
120
121 m_WeatherDefaultSettings.m_ClearWeatherChance = 50;
122 m_WeatherDefaultSettings.m_BadWeatherChance = 75;
123 m_WeatherDefaultSettings.m_BadWeatherSuddenChance = 0;
124 }
125
127 {
128 m_LiquidSettings = new WorldDataLiquidSettings();
129
130 m_LiquidSettings.m_Temperatures[LIQUID_SALTWATER] = 25;
131 m_LiquidSettings.m_Temperatures[LIQUID_WATER] = 25.0;
132 m_LiquidSettings.m_Temperatures[LIQUID_STILLWATER] = 25.0;
133 m_LiquidSettings.m_Temperatures[LIQUID_RIVERWATER] = 20.0;
134 m_LiquidSettings.m_Temperatures[LIQUID_FRESHWATER] = 20.0;
135 m_LiquidSettings.m_Temperatures[LIQUID_CLEANWATER] = 15.0;
136 }
137
138 override bool WeatherOnBeforeChange( EWeatherPhenomenon type, float actual, float change, float time )
139 {
140 #ifdef WEATHER_DATA_LOGGING
141 if ( !dayInit )
142 {
143 GetGame().GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
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;
153 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
154
155 m_Weather.SetStorm( 1.0, m_WeatherDefaultSettings.m_StormThreshold, 20 );
156
157 m_Weather.SetRainThresholds( m_WeatherDefaultSettings.m_RainThreshold, 1.0, 60 );
158 m_Weather.SetWindMaximumSpeed( 20 );
159
160 switch (type)
161 {
162 //-----------------------------------------------------------------------------------------------------------------------------
163 case EWeatherPhenomenon.OVERCAST:
164 {
165 #ifdef WEATHER_DATA_LOGGING
166 overcastChangeCount++;
167 #endif
168
169 float windDirection, windMag;
170
171 //went something goes wrong choose some default random weather
172 phmnValue = Math.RandomFloatInclusive( 0.1, 0.4 );
173 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
174 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
175
176 //----
177 //calculate next weather
178 m_Chance = Math.RandomIntInclusive( 0, 100 );
179
180 //--
181 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
182 {
183 m_ClearWeatherChance -= ( m_StepValue * m_SameWeatherCnt); //decrease the chance of the same weather
184 }
185
186 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
187 {
188 m_ClearWeatherChance += ( m_StepValue * m_SameWeatherCnt); //increase the chance of the better weather
190 }
191
192 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
193 {
194 m_ClearWeatherChance += m_StepValue; //increase the chance of the better weather slightly
195 m_BadWeatherChance += ( m_StepValue * m_SameWeatherCnt ); //decrease the chance of the same weather
196 }
197
198 //----
199 if ( m_Chance > m_WeatherDefaultSettings.m_GlobalSuddenChance && !m_IsSuddenChange) //checks if previous weather was a sudden change
200 {
201 m_IsSuddenChange = true;
202 m_ChoosenWeather = WorldDataWeatherConstants.BAD_WEATHER;
203 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
205 }
206 else if ( m_Chance < m_ClearWeatherChance )
207 {
208 m_ChoosenWeather = WorldDataWeatherConstants.CLEAR_WEATHER;
209 m_IsSuddenChange = false;
210 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
212 }
213 else if ( m_Chance > m_BadWeatherChance )
214 {
215 m_ChoosenWeather = WorldDataWeatherConstants.BAD_WEATHER;
216 m_IsSuddenChange = false;
217 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
219 }
220 else
221 {
222 m_ChoosenWeather = WorldDataWeatherConstants.CLOUDY_WEATHER;
223 m_IsSuddenChange = false;
224 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
226 }
227
230
231 m_ClearWeatherChance = m_WeatherDefaultSettings.m_ClearWeatherChance;
232 m_BadWeatherChance = m_WeatherDefaultSettings.m_BadWeatherChance;
233
234 //----
235 //set choosen weather
236 if ( m_ChoosenWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
237 {
238 m_LastWeather = WorldDataWeatherConstants.CLEAR_WEATHER;
239 #ifdef WEATHER_DATA_LOGGING
240 clearWeatherCount++;
241 #endif
242
243 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
244 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
245 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
246 }
247
248 if ( m_ChoosenWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
249 {
250 m_LastWeather = WorldDataWeatherConstants.CLOUDY_WEATHER;
251 #ifdef WEATHER_DATA_LOGGING
252 cloudyWeatherCount++;
253 #endif
254
255 phmnValue = Math.RandomFloatInclusive( 0.3, 0.7 );
256 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
257 phmnLength = Math.RandomIntInclusive( 0, m_WeatherDefaultSettings.m_OvercastMinLength );
258 }
259
260 if ( m_ChoosenWeather == WorldDataWeatherConstants.BAD_WEATHER )
261 {
262 m_LastWeather = WorldDataWeatherConstants.BAD_WEATHER;
263
264 phmnValue = Math.RandomFloatInclusive( 0.7, 1.0 );
265 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
266 phmnLength = Math.RandomIntInclusive( 0, m_WeatherDefaultSettings.m_OvercastMinLength );
267
268 #ifdef WEATHER_DATA_LOGGING
269 badWeatherCount++;
270 #endif
271
272 if ( m_IsSuddenChange )
273 {
274 #ifdef WEATHER_DATA_LOGGING
275 suddenChangeCount++;
276 badWeatherCount--;
277 #endif
278
280 phmnLength *= SUDDENCHANGE_LENGTH_MULTIPLIER;
281 }
282
283 #ifdef WEATHER_DATA_LOGGING
284 if ( phmnValue > m_WeatherDefaultSettings.m_StormThreshold )
285 {
286 if ( m_IsSuddenChange )
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 //we want to control wind with the overcast calculation and change with it.
302 CalculateWind( m_ChoosenWeather, m_IsSuddenChange, windMag, windDirection );
303 m_Weather.GetWindMagnitude().Set( windMag, phmnTime * WIND_MAGNITUDE_TIME_MULTIPLIER , phmnTime * (1 - WIND_MAGNITUDE_TIME_MULTIPLIER) ); // magnitude change happens during the overcast change, after overcast change finishes wind will decrease a bit
304 m_Weather.GetWindDirection().Set( windDirection, phmnTime * WIND_DIRECTION_TIME_MULTIPLIER , phmnTime - (phmnTime * WIND_DIRECTION_TIME_MULTIPLIER) + phmnLength + 1000 );
305
306 CalculateVolFog(phmnValue, windMag, phmnTime);
307
308 if( m_IsSuddenChange )
309 {
310 m_Weather.GetRain().Set(Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0); //forces to rain in the suddenchange.
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;
322 GetGame().GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
323
324 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
325 {
326 FileHandle file = OpenFile("$profile:OvercastCountsLivonia" + (currentDay + 1) + ".log", FileMode.WRITE);
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++;
339 CloseFile(file);
340 if ( currentDay == daysToRun )
341 {
342 g_Game.RequestExit(IDC_MAIN_QUIT);
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 //-----------------------------------------------------------------------------------------------------------------------------
358 case EWeatherPhenomenon.RAIN:
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
367 if ( actualOvercast <= m_WeatherDefaultSettings.m_RainThreshold)
368 {
369 m_Weather.GetRain().Set( 0.0, m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
370 Debug.WeatherLog (string.Format("Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0", g_Game.GetDayTime(), actual));
371 return true;
372 }
373
374 if ( actualOvercast > m_WeatherDefaultSettings.m_StormThreshold )
375 {
376 if( m_Weather.GetOvercast().GetActual() > m_Weather.GetOvercast().GetForecast() ) //ensure to have a pause to rain after the storm
377 {
378 phmnValue = 0;
379 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax ) * 2;
380 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_CalmAfterStormTimeMin, m_WeatherDefaultSettings.m_CalmAfterStormTimeMax );
381 }
382 else
383 {
384 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
385 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
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 //make a differnce in "normal rain"
395 if ( actualOvercast < 0.75 )
396 {
397 if ( m_Chance < 30 )
398 {
399 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
400 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
401 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
402 }
403 else if ( m_Chance < 60 )
404 {
405 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
406 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
407 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
408 }
409 else if ( m_Chance < 85 )
410 {
411 phmnValue = Math.RandomFloatInclusive( 0.05, 0.2 );
412 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
413 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
414 }
415 else //also have the chance to not have rain at all
416 {
417 phmnValue = 0;
418 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
419 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax ) * 4;
420 }
421 }
422 else //overcast between storm threshold and 0.75
423 {
424 if ( m_Chance < 15 )
425 {
426 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
427 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
428 phmnLength = 0;
429 }
430 else if ( m_Chance < 50 )
431 {
432 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
433 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
434 phmnLength = 0;
435 }
436 else if ( m_Chance < 90 )
437 {
438 phmnValue = Math.RandomFloatInclusive( 0.6, 0.8 );
439 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
440 phmnLength = 0;
441 }
442 else //also have the chance to not have rain at all
443 {
444 phmnValue = 0;
445 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
446 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax ) * 4;
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 //-----------------------------------------------------------------------------------------------------------------------------
456 case EWeatherPhenomenon.FOG:
457 {
458 if (( hour >= 2 ) && ( hour <= 5 ))
459 {
460 m_Weather.GetFog().Set( 0.13, 900, 0 );
461 }
462 else
463 {
464 m_Weather.GetFog().Set( 0.01, 900, 0 );
465 }
466
467 Debug.WeatherLog(string.Format("Enoch::Weather::Fog:: (%1) %2", g_Game.GetDayTime(), actual));
468
469 return true;
470 }
471 //-----------------------------------------------------------------------------------------------------------------------------
472 case EWeatherPhenomenon.WIND_MAGNITUDE:
473 {
474 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
475 m_Weather.GetWindMagnitude().Set(m_Weather.GetWindMagnitude().GetActual() * 0.75, phmnTime , m_WeatherDefaultSettings.m_OvercastMaxLength); // next change will be happen with the overcast change
476
477 return true;
478 }
479 }
480 return false;
481 }
482
483 protected override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
484 {
485 magnitude = 5;
486 direction = 0;
487
488 float windChance = Math.RandomIntInclusive( 0, 100 );
489
490 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
491 {
492 if ( windChance < 10 )
493 {
494 magnitude = Math.RandomFloatInclusive( 2 , 4 );
495 direction = Math.RandomFloatInclusive( -2.3 , -1.8);
496 }
497 else if ( windChance < 50 )
498 {
499 magnitude = Math.RandomFloatInclusive( 4 , 8 );
500 direction = Math.RandomFloatInclusive( -3.14 , -2.3);
501 }
502 else
503 {
504 magnitude = Math.RandomFloatInclusive( 6 , 12 );
505 direction = Math.RandomFloatInclusive( 2.3 , 3.14);
506 }
507
508 }
509 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
510 {
511 if ( windChance < 45 )
512 {
513 magnitude = Math.RandomFloatInclusive( 5 , 10 );
514 direction = Math.RandomFloatInclusive( -1.8 , -1.0);
515 }
516 else if ( windChance < 90 )
517 {
518 magnitude = Math.RandomFloatInclusive( 8 , 12 );
519 direction = Math.RandomFloatInclusive( -1.0, -0.7);
520 }
521 else
522 {
523 magnitude = Math.RandomFloatInclusive( 10 , 14 );
524 direction = Math.RandomFloatInclusive( -2.4 , -1.8);
525 }
526 }
527 else
528 {
529 if ( suddenChange || m_Weather.GetOvercast().GetActual() > m_WeatherDefaultSettings.m_StormThreshold || m_Weather.GetOvercast().GetForecast() - m_Weather.GetOvercast().GetActual() >= 0.4 )
530 {
531 magnitude = Math.RandomFloatInclusive( 17 , 20 );
532 direction = Math.RandomFloatInclusive( -0.2 , 1.0);
533 }
534 else if ( windChance < 45 )
535 {
536 magnitude = Math.RandomFloatInclusive( 6 , 12 );
537 direction = Math.RandomFloatInclusive( -0.6, 0);
538 }
539 else if ( windChance < 90 )
540 {
541 magnitude = Math.RandomFloatInclusive( 7 , 10 );
542 direction = Math.RandomFloatInclusive( 1.3 , 1.9);
543 }
544 else
545 {
546 magnitude = Math.RandomFloatInclusive( 4 , 8 );
547 direction = Math.RandomFloatInclusive( -1.8, -1.3 );
548 }
549 }
550 }
551
552 protected override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
553 {
554 float distanceDensity, heigthDensity, heightBias;
555 int year, month, day, hour, minute;
556 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
557
558 if ( hour < 6 && hour >= 3 )
559 {
560 heightBias = m_Weather.GetDynVolFogHeightBias();
561
562 if ( heightBias == m_WeatherDefaultSettings.m_DefaultHeigthBias ) //verify if the foggy morning check has been done
563 {
564 bool foggyMorning = Math.RandomIntInclusive(0,1);
565
566 if (foggyMorning)
567 {
568 heightBias = Math.RandomInt(m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit, m_WeatherDefaultSettings.m_DefaultHeigthBias);
569 }
570 else
571 {
572 heightBias = m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit - 1;
573 }
574 }
575
576 if (heightBias == m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit - 1) //not foggy morning
577 {
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);
580 }
581 else //foggy morning
582 {
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);
585 }
586 }
587 else if ( hour < 18 && hour >= 6 )
588 {
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);
591 heightBias = m_WeatherDefaultSettings.m_DefaultHeigthBias;
592 }
593 else
594 {
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);
597 heightBias = m_WeatherDefaultSettings.m_DefaultHeigthBias;
598 }
599
600 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
601 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
602 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);
603 }
604
605 bool LogWeatherData() //called from mission file to check if the logging should start
606 {
607 #ifdef WEATHER_DATA_LOGGING
608 return true;
609 #endif
610 return false;
611 }
612
614 const int CLEAR_WEATHER = 1;
615 const int CLOUDY_WEATHER = 2;
616 const int BAD_WEATHER = 3;
617
619 const int OVERCAST_MIN_TIME = 600;
620 const int OVERCAST_MAX_TIME = 900;
621
622 const float RAIN_THRESHOLD = 0.6;
623 const int RAIN_TIME_MIN = 60;
624 const int RAIN_TIME_MAX = 120;
625 const float STORM_THRESHOLD = 0.85;
626
629
631 protected int m_stepValue = m_StepValue;
632 protected int m_chance = m_Chance;
633
636}
#define LIQUID_RIVERWATER
#define LIQUID_FRESHWATER
#define LIQUID_WATER
#define LIQUID_SALTWATER
#define LIQUID_CLEANWATER
#define LIQUID_STILLWATER
void ClearAllRegisteredItems()
nucular option
void RegisterYieldItem(YieldItemBase data)
Definition debug.c:2
override void SetupLiquidTemperatures()
Definition enoch.c:126
override bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
Definition enoch.c:138
override void SetupWeatherSettings()
Definition enoch.c:117
int m_clearWeatherChance
Definition enoch.c:627
const int CLOUDY_WEATHER
Definition enoch.c:615
const float RAIN_THRESHOLD
Definition enoch.c:622
int m_choosenWeather
Definition enoch.c:634
int m_stepValue
Definition enoch.c:631
const int BAD_WEATHER
Definition enoch.c:616
bool LogWeatherData()
Definition enoch.c:605
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
Definition enoch.c:483
int m_chance
Definition enoch.c:632
int m_lastWeather
Definition enoch.c:635
const int CLEAR_WEATHER
DEPRECATED (see WorldDataWeatherConstants)
Definition enoch.c:614
const int RAIN_TIME_MIN
Definition enoch.c:623
const int RAIN_TIME_MAX
Definition enoch.c:624
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
Definition enoch.c:552
override void Init()
Definition enoch.c:36
const int OVERCAST_MAX_TIME
Definition enoch.c:620
int m_badWeatherChance
Definition enoch.c:628
const float STORM_THRESHOLD
Definition enoch.c:625
int m_sameWeatherCnt
Definition enoch.c:630
override void InitYieldBank()
Definition enoch.c:89
static const ref array< vector > LIVONIA_ARTY_STRIKE_POS
Definition enoch.c:24
const int OVERCAST_MIN_TIME
DEPRECATED (see WorldDataWeatherSettings)
Definition enoch.c:619
Definition enmath.c:7
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
float SUDDENCHANGE_TIME_MULTIPLIER
Definition worlddata.c:13
float SUDDENCHANGE_LENGTH_MULTIPLIER
Definition worlddata.c:14
ref WorldDataLiquidSettings m_LiquidSettings
Definition worlddata.c:32
float WIND_DIRECTION_TIME_MULTIPLIER
Definition worlddata.c:16
float m_Sunset_Jan
Definition worlddata.c:25
float m_WorldWindCoef
Definition worlddata.c:39
float m_Sunrise_Jan
Definition worlddata.c:24
int m_ClearWeatherChance
Definition worlddata.c:37
ref WorldDataWeatherSettings m_WeatherDefaultSettings
Definition worlddata.c:31
ref array< vector > m_FiringPos
Definition worlddata.c:28
ref CatchYieldBank m_YieldBank
Definition worlddata.c:30
int m_Chance
Definition worlddata.c:46
int m_LastWeather
Definition worlddata.c:48
float m_MaxTemps[12]
Definition worlddata.c:22
int m_SameWeatherCnt
Definition worlddata.c:44
float m_MinTemps[12]
Definition worlddata.c:23
int m_BadWeatherChance
weather related
Definition worlddata.c:36
int m_StepValue
Definition worlddata.c:45
float WIND_MAGNITUDE_TIME_MULTIPLIER
Definition worlddata.c:15
bool m_IsSuddenChange
Definition worlddata.c:38
float m_UniversalTemperatureSourceCapModifier
Definition worlddata.c:41
Weather m_Weather
Definition worlddata.c:18
float m_Sunset_Jul
Definition worlddata.c:27
int m_ChoosenWeather
Definition worlddata.c:47
float m_Sunrise_Jul
Definition worlddata.c:26
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
proto native CGame GetGame()
FileMode
Definition ensystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Definition ensystem.c:390
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.
const int IDC_MAIN_QUIT
Definition constants.c:144
EWeatherPhenomenon
Definition weather.c:11
void YieldItemJunk(int baseWeight, string type)