DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Enoch.c
См. документацию.
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
49 {
50 for (tempIdx = 0; tempIdx < CfgGameplayHandler.GetEnvironmentMinTemps().Count(); tempIdx++)
51 {
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
58 {
59 for (tempIdx = 0; tempIdx < CfgGameplayHandler.GetEnvironmentMaxTemps().Count(); tempIdx++)
60 {
62 }
63 }
64
66
68 m_WorldWindCoef = 0.3;
70
72
73 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
74 {
75 m_Weather.GetSnowfall().SetLimits(0, 0);
76 m_Weather.SetDynVolFogHeightBias(m_WeatherDefaultSettings.m_DefaultHeigthBias);
77
78 if (g_Game.IsMultiplayer())
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
93 m_YieldBank.ClearAllRegisteredItems();
94
95 //fishies
96 m_YieldBank.RegisterYieldItem(new YieldItemCarp(42));
97 m_YieldBank.RegisterYieldItem(new YieldItemMackerel(42));
98 m_YieldBank.RegisterYieldItem(new YieldItemSardines(15));
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
109 m_YieldBank.RegisterYieldItem(new YieldItemDeadRabbit(4));
110 m_YieldBank.RegisterYieldItem(new YieldItemDeadRooster(1));
111 m_YieldBank.RegisterYieldItem(new YieldItemDeadChicken_White(1));
112 m_YieldBank.RegisterYieldItem(new YieldItemDeadChicken_Spotted(1));
113 m_YieldBank.RegisterYieldItem(new YieldItemDeadChicken_Brown(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 g_Game.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 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
154
155 m_Weather.SetStorm( 1.0, m_WeatherDefaultSettings.m_StormThreshold, 20 );
156 m_Weather.GetSnowfall().SetLimits(0, 0);
157
158 m_Weather.SetRainThresholds( m_WeatherDefaultSettings.m_RainThreshold, 1.0, 60 );
159 m_Weather.SetWindMaximumSpeed( 20 );
160
161 switch (type)
162 {
163 //-----------------------------------------------------------------------------------------------------------------------------
164 case EWeatherPhenomenon.OVERCAST:
165 {
166 #ifdef WEATHER_DATA_LOGGING
167 overcastChangeCount++;
168 #endif
169
170 float windDirection, windMag;
171
172 //went something goes wrong choose some default random weather
173 phmnValue = Math.RandomFloatInclusive( 0.1, 0.4 );
174 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
175 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
176
177 //----
178 //calculate next weather
179 m_Chance = Math.RandomIntInclusive( 0, 100 );
180
181 //--
182 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
183 {
184 m_ClearWeatherChance -= ( m_StepValue * m_SameWeatherCnt); //decrease the chance of the same weather
185 }
186
187 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
188 {
189 m_ClearWeatherChance += ( m_StepValue * m_SameWeatherCnt); //increase the chance of the better weather
191 }
192
193 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
194 {
195 m_ClearWeatherChance += m_StepValue; //increase the chance of the better weather slightly
196 m_BadWeatherChance += ( m_StepValue * m_SameWeatherCnt ); //decrease the chance of the same weather
197 }
198
199 //----
200 if ( m_Chance > m_WeatherDefaultSettings.m_GlobalSuddenChance && !m_IsSuddenChange) //checks if previous weather was a sudden change
201 {
202 m_IsSuddenChange = true;
203 m_ChoosenWeather = WorldDataWeatherConstants.BAD_WEATHER;
204 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
206 }
207 else if ( m_Chance < m_ClearWeatherChance )
208 {
209 m_ChoosenWeather = WorldDataWeatherConstants.CLEAR_WEATHER;
210 m_IsSuddenChange = false;
211 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
213 }
214 else if ( m_Chance > m_BadWeatherChance )
215 {
216 m_ChoosenWeather = WorldDataWeatherConstants.BAD_WEATHER;
217 m_IsSuddenChange = false;
218 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
220 }
221 else
222 {
223 m_ChoosenWeather = WorldDataWeatherConstants.CLOUDY_WEATHER;
224 m_IsSuddenChange = false;
225 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
227 }
228
231
232 m_ClearWeatherChance = m_WeatherDefaultSettings.m_ClearWeatherChance;
233 m_BadWeatherChance = m_WeatherDefaultSettings.m_BadWeatherChance;
234
235 //----
236 //set choosen weather
237 if ( m_ChoosenWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
238 {
239 m_LastWeather = WorldDataWeatherConstants.CLEAR_WEATHER;
240 #ifdef WEATHER_DATA_LOGGING
241 clearWeatherCount++;
242 #endif
243
244 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
245 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
246 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
247 }
248
249 if ( m_ChoosenWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
250 {
251 m_LastWeather = WorldDataWeatherConstants.CLOUDY_WEATHER;
252 #ifdef WEATHER_DATA_LOGGING
253 cloudyWeatherCount++;
254 #endif
255
256 phmnValue = Math.RandomFloatInclusive( 0.3, 0.7 );
257 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
258 phmnLength = Math.RandomIntInclusive( 0, m_WeatherDefaultSettings.m_OvercastMinLength );
259 }
260
261 if ( m_ChoosenWeather == WorldDataWeatherConstants.BAD_WEATHER )
262 {
263 m_LastWeather = WorldDataWeatherConstants.BAD_WEATHER;
264
265 phmnValue = Math.RandomFloatInclusive( 0.7, 1.0 );
266 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
267 phmnLength = Math.RandomIntInclusive( 0, m_WeatherDefaultSettings.m_OvercastMinLength );
268
269 #ifdef WEATHER_DATA_LOGGING
270 badWeatherCount++;
271 #endif
272
273 if ( m_IsSuddenChange )
274 {
275 #ifdef WEATHER_DATA_LOGGING
276 suddenChangeCount++;
277 badWeatherCount--;
278 #endif
279
281 phmnLength *= SUDDENCHANGE_LENGTH_MULTIPLIER;
282 }
283
284 #ifdef WEATHER_DATA_LOGGING
285 if ( phmnValue > m_WeatherDefaultSettings.m_StormThreshold )
286 {
287 if ( m_IsSuddenChange )
288 {
289 suddenChangeCount--;
290 suddenStormCount++;
291 }
292 else
293 { stormCount++;
294 badWeatherCount--;
295 }
296 }
297 #endif
298 }
299
300 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
301
302 //we want to control wind with the overcast calculation and change with it.
303 CalculateWind( m_ChoosenWeather, m_IsSuddenChange, windMag, windDirection );
304 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
305 m_Weather.GetWindDirection().Set( windDirection, phmnTime * WIND_DIRECTION_TIME_MULTIPLIER , phmnTime - (phmnTime * WIND_DIRECTION_TIME_MULTIPLIER) + phmnLength + 1000 );
306
307 CalculateVolFog(phmnValue, windMag, phmnTime);
308
309 if( m_IsSuddenChange )
310 {
311 m_Weather.GetRain().Set(Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0); //forces to rain in the suddenchange.
312 }
313
314 Debug.WeatherLog(string.Format("Enoch::Weather::Overcast:: (%1) overcast: %2", g_Game.GetDayTime(), actual));
315 Debug.WeatherLog(string.Format("Enoch::Weather::Overcast::Rain:: (%1) %2", g_Game.GetDayTime(), m_Weather.GetRain().GetActual()));
316
317 #ifdef WEATHER_DATA_LOGGING
318 int testYear = 0;
319 int testMonth = 0;
320 int testDay = 0;
321 int testHour = 0;
322 int testMinute = 0;
323 g_Game.GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
324
325 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
326 {
327 FileHandle file = OpenFile("$profile:OvercastCountsLivonia" + (currentDay + 1) + ".log", FileMode.WRITE);
328 FPrintln(file, "================================================================");
329 FPrintln(file," ================== Day " + (currentDay + 1) + " ================== ");
330 FPrintln(file, "================================================================");
331 FPrintln(file, "Overcast Change Count: " + overcastChangeCount);
332 FPrintln(file, "Bad Weather Change Count: " + badWeatherCount);
333 FPrintln(file, "Sudden Change Count: " + suddenChangeCount);
334 FPrintln(file, "Storm Count: " + stormCount);
335 FPrintln(file, "Sudden Storm Count: " + suddenStormCount);
336 FPrintln(file, "Cloudy Weather Count: " + cloudyWeatherCount);
337 FPrintln(file, "Clear Weather Count: " + clearWeatherCount);
338
339 currentDay++;
340 CloseFile(file);
341 if ( currentDay == daysToRun )
342 {
343 g_Game.RequestExit(IDC_MAIN_QUIT);
344 }
345
346 overcastChangeCount = 0;
347 suddenChangeCount = 0;
348 stormCount = 0;
349 suddenStormCount = 0;
350 badWeatherCount = 0;
351 cloudyWeatherCount = 0;
352 clearWeatherCount = 0;
353 }
354 #endif
355
356 return true;
357 }
358 //-----------------------------------------------------------------------------------------------------------------------------
359 case EWeatherPhenomenon.RAIN:
360 {
361 float actualOvercast = m_Weather.GetOvercast().GetActual();
362
363 m_Chance = Math.RandomIntInclusive( 0, 100 );
364 phmnValue = 0.2;
365 phmnTime = 90;
366 phmnLength = 30;
367
368 if ( actualOvercast <= m_WeatherDefaultSettings.m_RainThreshold)
369 {
370 m_Weather.GetRain().Set( 0.0, m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
371 Debug.WeatherLog (string.Format("Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0", g_Game.GetDayTime(), actual));
372 return true;
373 }
374
375 if ( actualOvercast > m_WeatherDefaultSettings.m_StormThreshold )
376 {
377 if( m_Weather.GetOvercast().GetActual() > m_Weather.GetOvercast().GetForecast() ) //ensure to have a pause to rain after the storm
378 {
379 phmnValue = 0;
380 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax ) * 2;
381 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_CalmAfterStormTimeMin, m_WeatherDefaultSettings.m_CalmAfterStormTimeMax );
382 }
383 else
384 {
385 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
386 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
387 phmnLength = 0;
388 }
389
390 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
391 Debug.WeatherLog(string.Format("Enoch::Weather::Rain::ForceStorm:: (%1) %2 -> %3", g_Game.GetDayTime(), actual, phmnValue));
392 return true;
393 }
394
395 //make a differnce in "normal rain"
396 if ( actualOvercast < 0.75 )
397 {
398 if ( m_Chance < 30 )
399 {
400 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
401 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
402 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
403 }
404 else if ( m_Chance < 60 )
405 {
406 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
407 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
408 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
409 }
410 else if ( m_Chance < 85 )
411 {
412 phmnValue = Math.RandomFloatInclusive( 0.05, 0.2 );
413 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
414 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax );
415 }
416 else //also have the chance to not have rain at all
417 {
418 phmnValue = 0;
419 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
420 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax ) * 4;
421 }
422 }
423 else //overcast between storm threshold and 0.75
424 {
425 if ( m_Chance < 15 )
426 {
427 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
428 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
429 phmnLength = 0;
430 }
431 else if ( m_Chance < 50 )
432 {
433 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
434 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
435 phmnLength = 0;
436 }
437 else if ( m_Chance < 90 )
438 {
439 phmnValue = Math.RandomFloatInclusive( 0.6, 0.8 );
440 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
441 phmnLength = 0;
442 }
443 else //also have the chance to not have rain at all
444 {
445 phmnValue = 0;
446 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
447 phmnLength = Math.RandomInt( m_WeatherDefaultSettings.m_RainLengthMin, m_WeatherDefaultSettings.m_RainLengthMax ) * 4;
448 }
449 }
450
451 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
452
453 Debug.WeatherLog(string.Format("Enoch::Weather::Rain:: (%1) %2", g_Game.GetDayTime(), actual));
454 return true;
455 }
456 //-----------------------------------------------------------------------------------------------------------------------------
457 case EWeatherPhenomenon.FOG:
458 {
459 if (( hour >= 2 ) && ( hour <= 5 ))
460 {
461 m_Weather.GetFog().Set( 0.13, 900, 0 );
462 }
463 else
464 {
465 m_Weather.GetFog().Set( 0.01, 900, 0 );
466 }
467
468 Debug.WeatherLog(string.Format("Enoch::Weather::Fog:: (%1) %2", g_Game.GetDayTime(), actual));
469
470 return true;
471 }
472 //-----------------------------------------------------------------------------------------------------------------------------
473 case EWeatherPhenomenon.WIND_MAGNITUDE:
474 {
475 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_RainTimeMin, m_WeatherDefaultSettings.m_RainTimeMax );
476 m_Weather.GetWindMagnitude().Set(m_Weather.GetWindMagnitude().GetActual() * 0.75, phmnTime , m_WeatherDefaultSettings.m_OvercastMaxLength); // next change will be happen with the overcast change
477
478 return true;
479 }
480 }
481 return false;
482 }
483
484 protected override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
485 {
486 magnitude = 5;
487 direction = 0;
488
489 float windChance = Math.RandomIntInclusive( 0, 100 );
490
491 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
492 {
493 if ( windChance < 10 )
494 {
495 magnitude = Math.RandomFloatInclusive( 2 , 4 );
496 direction = Math.RandomFloatInclusive( -2.3 , -1.8);
497 }
498 else if ( windChance < 50 )
499 {
500 magnitude = Math.RandomFloatInclusive( 4 , 8 );
501 direction = Math.RandomFloatInclusive( -3.14 , -2.3);
502 }
503 else
504 {
505 magnitude = Math.RandomFloatInclusive( 6 , 12 );
506 direction = Math.RandomFloatInclusive( 2.3 , 3.14);
507 }
508
509 }
510 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
511 {
512 if ( windChance < 45 )
513 {
514 magnitude = Math.RandomFloatInclusive( 5 , 10 );
515 direction = Math.RandomFloatInclusive( -1.8 , -1.0);
516 }
517 else if ( windChance < 90 )
518 {
519 magnitude = Math.RandomFloatInclusive( 8 , 12 );
520 direction = Math.RandomFloatInclusive( -1.0, -0.7);
521 }
522 else
523 {
524 magnitude = Math.RandomFloatInclusive( 10 , 14 );
525 direction = Math.RandomFloatInclusive( -2.4 , -1.8);
526 }
527 }
528 else
529 {
530 if ( suddenChange || m_Weather.GetOvercast().GetActual() > m_WeatherDefaultSettings.m_StormThreshold || m_Weather.GetOvercast().GetForecast() - m_Weather.GetOvercast().GetActual() >= 0.4 )
531 {
532 magnitude = Math.RandomFloatInclusive( 17 , 20 );
533 direction = Math.RandomFloatInclusive( -0.2 , 1.0);
534 }
535 else if ( windChance < 45 )
536 {
537 magnitude = Math.RandomFloatInclusive( 6 , 12 );
538 direction = Math.RandomFloatInclusive( -0.6, 0);
539 }
540 else if ( windChance < 90 )
541 {
542 magnitude = Math.RandomFloatInclusive( 7 , 10 );
543 direction = Math.RandomFloatInclusive( 1.3 , 1.9);
544 }
545 else
546 {
547 magnitude = Math.RandomFloatInclusive( 4 , 8 );
548 direction = Math.RandomFloatInclusive( -1.8, -1.3 );
549 }
550 }
551 }
552
553 protected override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
554 {
555 float distanceDensity, heigthDensity, heightBias;
556 int year, month, day, hour, minute;
557 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
558
559 if ( hour < 6 && hour >= 3 )
560 {
561 heightBias = m_Weather.GetDynVolFogHeightBias();
562
563 if ( heightBias == m_WeatherDefaultSettings.m_DefaultHeigthBias ) //verify if the foggy morning check has been done
564 {
565 bool foggyMorning = Math.RandomIntInclusive(0,1);
566
567 if (foggyMorning)
568 {
569 heightBias = Math.RandomInt(m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit, m_WeatherDefaultSettings.m_DefaultHeigthBias);
570 }
571 else
572 {
573 heightBias = m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit - 1;
574 }
575 }
576
577 if (heightBias == m_WeatherDefaultSettings.m_FoggyMorningHeigthBiasLowLimit - 1) //not foggy morning
578 {
579 distanceDensity = Math.Lerp( 0.01, 0.03, lerpValue ) * Math.Clamp(1 - (windMagnitude / m_Weather.GetWindMaximumSpeed()), 0.1, 1);
580 heigthDensity = Math.Lerp( 0.9, 1, lerpValue);
581 }
582 else //foggy morning
583 {
584 distanceDensity = Math.Lerp( 0.5, 0.1, lerpValue ) * Math.Clamp(1 - (windMagnitude / m_Weather.GetWindMaximumSpeed()), 0.1, 1);
585 heigthDensity = Math.Lerp( 0.2, 1, lerpValue);
586 }
587 }
588 else if ( hour < 18 && hour >= 6 )
589 {
590 distanceDensity = Math.Lerp( 0.01, 0.05, lerpValue ) * Math.Clamp(1 - (windMagnitude / m_Weather.GetWindMaximumSpeed()), 0.1, 1);
591 heigthDensity = Math.Lerp( 0.9, 1, lerpValue);
592 heightBias = m_WeatherDefaultSettings.m_DefaultHeigthBias;
593 }
594 else
595 {
596 distanceDensity = Math.Lerp( 0.01, 0.03, lerpValue ) * Math.Clamp(1 - (windMagnitude / m_Weather.GetWindMaximumSpeed()), 0.1, 1);
597 heigthDensity = Math.Lerp( 0.9, 1, lerpValue);
598 heightBias = m_WeatherDefaultSettings.m_DefaultHeigthBias;
599 }
600
601 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
602 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
603 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);
604 }
605
606 bool LogWeatherData() //called from mission file to check if the logging should start
607 {
608 #ifdef WEATHER_DATA_LOGGING
609 return true;
610 #endif
611 return false;
612 }
613
615 const int CLEAR_WEATHER = 1;
616 const int CLOUDY_WEATHER = 2;
617 const int BAD_WEATHER = 3;
618
620 const int OVERCAST_MIN_TIME = 600;
621 const int OVERCAST_MAX_TIME = 900;
622
623 const float RAIN_THRESHOLD = 0.6;
624 const int RAIN_TIME_MIN = 60;
625 const int RAIN_TIME_MAX = 120;
626 const float STORM_THRESHOLD = 0.85;
627
630
632 protected int m_stepValue = m_StepValue;
633 protected int m_chance = m_Chance;
634
637}
DayZGame g_Game
Определения DayZGame.c:3942
@ Count
Определения RandomGeneratorSyncManager.c:8
EWeatherPhenomenon
Определения Weather.c:11
void YieldItemJunk(int baseWeight, string type)
Определения YieldsFishingJunk.c:44
static array< float > GetEnvironmentMaxTemps()
Определения CfgGameplayHandler.c:151
static array< float > GetEnvironmentMinTemps()
Определения CfgGameplayHandler.c:146
static void WeatherLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения 3_Game/DayZ/tools/Debug.c:255
Определения 3_Game/DayZ/tools/Debug.c:2
override void SetupLiquidTemperatures()
Определения Enoch.c:126
override bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
Определения Enoch.c:138
override void SetupWeatherSettings()
Определения Enoch.c:117
int m_clearWeatherChance
Определения Enoch.c:628
const int CLOUDY_WEATHER
Определения Enoch.c:616
const float RAIN_THRESHOLD
Определения Enoch.c:623
int m_choosenWeather
Определения Enoch.c:635
int m_stepValue
Определения Enoch.c:632
const int BAD_WEATHER
Определения Enoch.c:617
bool LogWeatherData()
Определения Enoch.c:606
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
Определения Enoch.c:484
int m_chance
Определения Enoch.c:633
int m_lastWeather
Определения Enoch.c:636
const int CLEAR_WEATHER
DEPRECATED (see WorldDataWeatherConstants)
Определения Enoch.c:615
const int RAIN_TIME_MIN
Определения Enoch.c:624
const int RAIN_TIME_MAX
Определения Enoch.c:625
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
Определения Enoch.c:553
override void Init()
Определения Enoch.c:36
const int OVERCAST_MAX_TIME
Определения Enoch.c:621
int m_badWeatherChance
Определения Enoch.c:629
const float STORM_THRESHOLD
Определения Enoch.c:626
int m_sameWeatherCnt
Определения Enoch.c:631
override void InitYieldBank()
Определения Enoch.c:89
static const ref array< vector > LIVONIA_ARTY_STRIKE_POS
Определения Enoch.c:24
const int OVERCAST_MIN_TIME
DEPRECATED (see WorldDataWeatherSettings)
Определения Enoch.c:620
Определения Enoch.c:3
Определения EnMath.c:7
float SUDDENCHANGE_TIME_MULTIPLIER
Определения WorldData.c:13
float SUDDENCHANGE_LENGTH_MULTIPLIER
Определения WorldData.c:14
ref WorldDataLiquidSettings m_LiquidSettings
Определения WorldData.c:32
float WIND_DIRECTION_TIME_MULTIPLIER
Определения WorldData.c:16
float m_Sunset_Jan
Определения WorldData.c:25
float m_WorldWindCoef
Определения WorldData.c:39
float m_Sunrise_Jan
Определения WorldData.c:24
int m_ClearWeatherChance
Определения WorldData.c:37
ref WorldDataWeatherSettings m_WeatherDefaultSettings
Определения WorldData.c:31
void WorldData()
Определения WorldData.c:50
ref array< vector > m_FiringPos
Определения WorldData.c:28
float m_TemperaturePerHeightReductionModifier
directly accesible (defined/overriden in Init())
Определения WorldData.c:8
float m_CloudsTemperatureEffectModifier
amount of °C reduced for each 100 meteres of height above water level
Определения WorldData.c:9
ref CatchYieldBank m_YieldBank
Определения WorldData.c:30
int m_Chance
Определения WorldData.c:46
int m_LastWeather
Определения WorldData.c:48
float m_MaxTemps[12]
Определения WorldData.c:22
int m_SameWeatherCnt
Определения WorldData.c:44
float m_MinTemps[12]
Определения WorldData.c:23
int m_BadWeatherChance
weather related
Определения WorldData.c:36
int m_StepValue
Определения WorldData.c:45
float WIND_MAGNITUDE_TIME_MULTIPLIER
Определения WorldData.c:15
bool m_IsSuddenChange
Определения WorldData.c:38
float m_UniversalTemperatureSourceCapModifier
Определения WorldData.c:41
Weather m_Weather
Определения WorldData.c:18
float m_Sunset_Jul
Определения WorldData.c:27
int m_ChoosenWeather
Определения WorldData.c:47
float m_Sunrise_Jul
Определения WorldData.c:26
Определения YieldsFish.c:69
Определения YieldsFish.c:97
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
FileMode
Определения EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Определения EnSystem.c:390
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.
const int LIQUID_STILLWATER
Определения 3_Game/DayZ/constants.c:555
const int LIQUID_FRESHWATER
Определения 3_Game/DayZ/constants.c:554
const int LIQUID_CLEANWATER
Определения 3_Game/DayZ/constants.c:557
const int LIQUID_WATER
Определения 3_Game/DayZ/constants.c:544
const int LIQUID_RIVERWATER
Определения 3_Game/DayZ/constants.c:545
const int LIQUID_SALTWATER
Определения 3_Game/DayZ/constants.c:553
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].
Определения EnMath.c:106
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].
Определения EnMath.c:54
const int IDC_MAIN_QUIT
Определения 3_Game/DayZ/constants.c:144