DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CalculateWind()

override void NasdaraData::CalculateWind ( int newWeather,
bool suddenChange,
out float magnitude,
out float direction )
inlineprotected

См. определение в файле Nasdara.c строка 522

523 {
524 magnitude = 5;
525 direction = 0;
526
527 float windChance = Math.RandomIntInclusive( 0, 99 );
528 m_IsSandstorm = false;
529
530 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
531 {
532 if ( windChance < 40 )
533 {
534 magnitude = Math.RandomFloatInclusive( 8 , 15 );
535 direction = Math.RandomFloatInclusive( 2.10 , 2.70);
536 }
537 else if ( windChance < 80 )
538 {
539 magnitude = Math.RandomFloatInclusive( 3 , 6 );
540 direction = Math.RandomFloatInclusive( 0.60 , 1.90);
541 }
542 else
543 {
544 magnitude = Math.RandomFloatInclusive( 4 , 12 );
545 direction = Math.RandomFloatInclusive( 0.30 , 0.80);
546 }
547 }
548 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
549 {
550 if ( windChance < 45 )
551 {
552 magnitude = Math.RandomFloatInclusive( 5 , 10 );
553 direction = Math.RandomFloatInclusive( 0 , 0.4);
554 }
555 else
556 {
557 magnitude = Math.RandomFloatInclusive( 2 , 8 );
558 direction = Math.RandomFloatInclusive( -1.40, 0);
559 }
560 }
561 else //bad weather
562 {
563 float sandstormChance = 8;
564 float windRatio = 0.4;
565
566 sandstormChance = Math.Clamp( sandstormChance * m_WeatherDefaultSettings.m_sandstormFrequency, 0, 100 );
567
568 float highWindChance = ( 100 - sandstormChance ) * windRatio;
569
570 if ( !previousWeatherHadSandstorm && windChance < sandstormChance )
571 {
572 magnitude = Math.RandomFloatInclusive( m_WeatherDefaultSettings.m_SandstormMinWindMagnitude, m_Weather.GetWindMaximumSpeed() );
573 direction = Math.RandomFloatInclusive( m_WeatherDefaultSettings.m_SandstormMinWindDirection, m_WeatherDefaultSettings.m_SandstormMaxWindDirection);
574 m_IsSandstorm = true;
575
576 #ifdef WEATHER_DATA_LOGGING
577 sandstormCount++;
578 #endif
579 }
580 else if ( windChance < sandstormChance + highWindChance )
581 {
582 magnitude = Math.RandomFloatInclusive( 7 , 15 );
583 direction = Math.RandomFloatInclusive( -1.18 , -0.7);
584 }
585 else
586 {
587 magnitude = Math.RandomFloatInclusive( 3, 7 );
588 direction = Math.RandomFloatInclusive( -2.5 , -2.0);
589 }
590 }
591 }
bool previousWeatherHadSandstorm
Определения Nasdara.c:4
bool m_IsSandstorm
Определения WorldData.c:46
ref WorldDataWeatherSettings m_WeatherDefaultSettings
Определения WorldData.c:36
Weather m_Weather
Определения WorldData.c:19

Перекрестные ссылки Math::Clamp(), WorldData::m_IsSandstorm, WorldData::m_Weather, WorldData::m_WeatherDefaultSettings, previousWeatherHadSandstorm, Math::RandomFloatInclusive() и Math::RandomIntInclusive().

Используется в WeatherOnBeforeChange().