DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс SakhalData
+ Граф наследования:SakhalData:

Защищенные члены

override void CalculateWind (int newWeather, bool suddenChange, out float magnitude, out float direction)
 
override void CalculateVolFog (float lerpValue, float windMagnitude, float changeTime)
 
override float GetAgentSpawnChance (eAgents agent)
 
override float GetColdAreaToolDamageModifier ()
 
bool LogWeatherData ()
 

Защищенные данные

const int CLEAR_WEATHER = 1
 DEPRECATED (see WorldDataWeatherConstants)
 
const int CLOUDY_WEATHER = 2
 
const int BAD_WEATHER = 3
 

Закрытые члены

override void Init ()
 
override void InitYieldBank ()
 
override void SetupWeatherSettings ()
 
override void SetupLiquidTemperatures ()
 
override bool WeatherOnBeforeChange (EWeatherPhenomenon type, float actual, float change, float time)
 
- Закрытые члены унаследованные от WorldData
void WorldData ()
 
void Init ()
 
float GetApproxSunriseTime (float monthday)
 
float GetApproxSunsetTime (float monthday)
 
int GetDaytime ()
 
float CalcBaseEnvironmentTemperature (float monthday, float daytime)
 
void UpdateBaseEnvTemperature (float timeslice)
 
void UpdateWeatherEffects (Weather weather, float timeslice)
 Updates local weather effects.
 
float ComputeSnowflakeScale (Weather weather)
 Returns the desired snowflake scale based on weather simulation state.
 
float GetBaseEnvTemperature ()
 
float GetBaseEnvTemperatureAtObject (notnull Object object)
 
float GetBaseEnvTemperatureAtPosition (vector pos)
 
float GetBaseEnvTemperatureExact (int month, int day, int hour, int minute)
 
float GetLiquidTypeEnviroTemperature (int liquidType)
 
bool WeatherOnBeforeChange (EWeatherPhenomenon type, float actual, float change, float time)
 
array< vectorGetArtyFiringPos ()
 
float GetAgentSpawnChance (eAgents agent)
 
float GetColdAreaToolDamageModifier ()
 
void BaseTempDebug (int month, int day)
 
int GetPollution ()
 
float GetWindCoef ()
 
float GetUniversalTemperatureSourceCapModifier ()
 
void CalculateWind (int newWeather, bool suddenChange, out float magnitude, out float direction)
 
void CalculateVolFog (float lerpValue, float windMagnitude, float changeTime)
 
void CreateYieldBank ()
 
void InitYieldBank ()
 override this to properly register world-specific yields
 
void SetupWeatherSettings ()
 
void SetupLiquidTemperatures ()
 
CatchYieldBank GetCatchYieldBank ()
 
TStringArray GetDefaultPRAPaths ()
 
float GetDayTemperature ()
 
float GetNightTemperature ()
 
override void Init ()
 
override void SetupWeatherSettings ()
 
override bool WeatherOnBeforeChange (EWeatherPhenomenon type, float actual, float change, float time)
 
override void CalculateWind (int newWeather, bool suddenChange, out float magnitude, out float direction)
 
override void CalculateVolFog (float lerpValue, float windMagnitude, float changeTime)
 
bool LogWeatherData ()
 

Закрытые данные

const float SPAWN_CHANCE_CHOLERA = 20
 
const float COLD_AREA_TOOL_DMG_MODIF = 1.2
 
- Закрытые данные унаследованные от WorldData
float SUDDENCHANGE_TIME_MULTIPLIER = 0.2
 how many % of environment temperature can be lowered by clouds
 
float SUDDENCHANGE_LENGTH_MULTIPLIER = 0.4
 
float WIND_MAGNITUDE_TIME_MULTIPLIER = 0.1
 
float WIND_DIRECTION_TIME_MULTIPLIER = 0.05
 
Weather m_Weather
 
float m_EnvironmentTemperature
 
bool m_EnTempUpdated
 
float m_Timer
 
float m_MaxTemps [12]
 
float m_MinTemps [12]
 
float m_Sunrise_Jan
 
float m_Sunset_Jan
 
float m_Sunrise_Jul
 
float m_Sunset_Jul
 
ref array< vectorm_FiringPos
 
bool m_Pollution
 
ref CatchYieldBank m_YieldBank
 
ref WorldDataWeatherSettings m_WeatherDefaultSettings
 
ref WorldDataLiquidSettings m_LiquidSettings
 
ref TStringArray m_DefaultPlayerRestrictedAreas
 
int m_BadWeatherChance
 weather related
 
int m_ClearWeatherChance
 
bool m_IsSuddenChange
 
float m_WorldWindCoef
 
float m_UniversalTemperatureSourceCapModifier
 
int m_SameWeatherCnt = 0
 
int m_StepValue = 5
 
int m_Chance = 50
 
int m_ChoosenWeather = 1
 
int m_LastWeather = 0
 
float m_DayTemperature = 10
 
float m_NightTemperature = 6
 
const int CLEAR_WEATHER = 1
 DEPRECATED (see WorldDataWeatherConstants)
 
const int CLOUDY_WEATHER = 2
 
const int BAD_WEATHER = 3
 
const int OVERCAST_MIN_TIME = 600
 DEPRECATED (see WorldDataWeatherSettings)
 
const int OVERCAST_MAX_TIME = 900
 
const float RAIN_THRESHOLD = 0.6
 
const int RAIN_TIME_MIN = 60
 
const int RAIN_TIME_MAX = 120
 
const float STORM_THRESHOLD = 0.9
 
int m_clearWeatherChance = m_ClearWeatherChance
 
int m_badWeatherChance = m_BadWeatherChance
 
int m_sameWeatherCnt = m_SameWeatherCnt
 
int m_stepValue = m_StepValue
 
int m_chance = m_Chance
 
int m_choosenWeather = m_ChoosenWeather
 
int m_lastWeather = m_LastWeather
 

Дополнительные унаследованные члены

- Закрытые статические данные унаследованные от WorldData
static const ref array< vectorCHERNARUS_ARTY_STRIKE_POS
 

Подробное описание

Методы

◆ CalculateVolFog()

override void CalculateVolFog ( float lerpValue,
float windMagnitude,
float changeTime )
inlineprotected
658 {
660 float minVolFogDistanceDensity = Math.Lerp(0.001, 0.01, m_Weather.GetOvercast().GetActual());
661
664
667 }
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Definition Easing.c:3
static float EaseInQuart(float t)
Definition Easing.c:56
Definition EnMath.c:7
Definition EntityAI.c:95
proto native void SetDynVolFogDistanceDensity(float value, float time=0)
Sets the dynamic volumetric fog distance density. Only takes effect if dynamic volumetric fog is enab...
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
Weather m_Weather
Definition WorldData.c:18
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки Easing::EaseInQuart(), Weather::GetOvercast(), Weather::GetWindMaximumSpeed(), Math::Lerp(), WorldData::m_Weather и Weather::SetDynVolFogDistanceDensity().

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

◆ CalculateWind()

override void CalculateWind ( int newWeather,
bool suddenChange,
out float magnitude,
out float direction )
inlineprotected
588 {
589 magnitude = 5;
590 direction = 0;
591
592 float windChance = Math.RandomIntInclusive( 0, 100 );
593
594 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
595 {
596 if ( windChance < 15 )
597 {
599 direction = Math.RandomFloatInclusive( -0.35 , 0.35);
600 }
601 else if ( windChance < 90 )
602 {
605 }
606 else
607 {
609 direction = Math.RandomFloatInclusive( -3.0 , -2.25);
610 }
611 }
612 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
613 {
614 if ( windChance < 45 )
615 {
617 direction = Math.RandomFloatInclusive( 1.0 , 1.25);
618 }
619 else if ( windChance < 90 )
620 {
622 direction = Math.RandomFloatInclusive( -1.8, -1.4);
623 }
624 else
625 {
627 direction = Math.RandomFloatInclusive( -1.0 , -0.4);
628 }
629 }
630 else
631 {
632 if ( suddenChange || m_Weather.GetOvercast().GetForecast() > 0.85 )
633 {
635 direction = Math.RandomFloatInclusive( 2.25 , 3.14);
636 }
637 else if ( windChance < 45 )
638 {
640 direction = Math.RandomFloatInclusive( -1.8 , -1.4);
641 }
642 else if ( windChance < 90 )
643 {
645 direction = Math.RandomFloatInclusive( 1.6 , 2.0);
646 }
647 else
648 {
650 direction = Math.RandomFloatInclusive( 1.5, 1.75 );
651 }
652 }
653
654 CalculateVolFog(m_Weather.GetSnowfall().GetForecast(), magnitude, 60);
655 }
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
Definition Sakhal.c:657
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

Перекрестные ссылки CalculateVolFog(), Weather::GetOvercast(), Weather::GetSnowfall(), WorldData::m_Weather, Math::RandomFloatInclusive() и Math::RandomIntInclusive().

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

◆ GetAgentSpawnChance()

override float GetAgentSpawnChance ( eAgents agent)
inlineprotected
670 {
671 if (agent == eAgents.CHOLERA)
673
674 return 0;
675 }
eAgents
Definition EAgents.c:3
const float SPAWN_CHANCE_CHOLERA
Definition Sakhal.c:4

Перекрестные ссылки SPAWN_CHANCE_CHOLERA.

◆ GetColdAreaToolDamageModifier()

override float GetColdAreaToolDamageModifier ( )
inlineprotected
678 {
680 }
const float COLD_AREA_TOOL_DMG_MODIF
Definition Sakhal.c:5

Перекрестные ссылки COLD_AREA_TOOL_DMG_MODIF.

◆ Init()

override void Init ( )
inlineprivate
29 {
30 super.Init();
31
32 // new temperature curve settings
33 m_Sunrise_Jan = 8.41;
34 m_Sunset_Jan = 15.58;
35 m_Sunrise_Jul = 3.75;
36 m_Sunset_Jul = 20.25;
37
38 int tempIdx;
39 m_MinTemps = {-6.5, -9.5, -6.5, -9.5, 2, 6, 9, 10, 6, 1, -5, -10}; //{-13, -11, -7, -3, 2, 6, 9, 10, 6, 1, -5, -10} original values
41 {
43 {
45 }
46 }
47
48 m_MaxTemps = {-3, -5, -3, -5, 9, 14, 16, 17, 14, 8, 1, -3}; //{-6, -4, -1, 3, 9, 14, 16, 17, 14, 8, 1, -3} original values
50 {
52 {
54 }
55 }
56 m_Pollution = m_Pollution | EPollution.HEAVYMETAL;
57
59
61
64
65 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
66 {
69 m_Weather.GetFog().Set(0,0,1000);
70 m_Weather.GetFog().SetLimits(0,0);
71 m_Weather.GetOvercast().SetLimits(0.07, 1);
72
73 if (GetGame().IsMultiplayer())
74 {
75 m_Weather.GetOvercast().Set(Math.RandomFloat(0,0.75),0,5); //forcing a random weather at a clean server start and an instant change for overcast
77 }
78
79 m_DefaultPlayerRestrictedAreas = {"pra/warheadstorage.json"};
80 }
81
82
83 }
@ Count
Definition RandomGeneratorSyncManager.c:8
Definition CfgGameplayHandler.c:2
static array< float > GetEnvironmentMinTemps()
Definition CfgGameplayHandler.c:146
static array< float > GetEnvironmentMaxTemps()
Definition CfgGameplayHandler.c:151
proto native void SetDynVolFogHeightBias(float value, float time=0)
Sets the 'dynamic' volumetric height bias. Takes effect only if enabled via world config.
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native void SetDynVolFogHeightDensity(float value, float time=0)
Sets the dynamic volumetric fog height density. Only takes effect if dynamic volumetric fog is enable...
proto native Fog GetFog()
Returns a fog phenomenon object.
float m_Sunrise_Jan
Definition WorldData.c:24
int m_ClearWeatherChance
Definition WorldData.c:37
float m_MaxTemps[12]
Definition WorldData.c:22
float m_Sunrise_Jul
Definition WorldData.c:26
float m_UniversalTemperatureSourceCapModifier
Definition WorldData.c:41
bool m_Pollution
Definition WorldData.c:29
float m_Sunset_Jul
Definition WorldData.c:27
int m_BadWeatherChance
weather related
Definition WorldData.c:36
ref WorldDataWeatherSettings m_WeatherDefaultSettings
Definition WorldData.c:31
float m_Sunset_Jan
Definition WorldData.c:25
float m_MinTemps[12]
Definition WorldData.c:23
ref TStringArray m_DefaultPlayerRestrictedAreas
Definition WorldData.c:33
proto native CGame GetGame()
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].

Перекрестные ссылки CalculateVolFog(), Count, CfgGameplayHandler::GetEnvironmentMaxTemps(), CfgGameplayHandler::GetEnvironmentMinTemps(), Weather::GetFog(), GetGame(), Weather::GetOvercast(), Weather::GetSnowfall(), Weather::GetWindSpeed(), WorldData::m_BadWeatherChance, WorldData::m_ClearWeatherChance, WorldData::m_DefaultPlayerRestrictedAreas, WorldData::m_MaxTemps, WorldData::m_MinTemps, WorldData::m_Pollution, WorldData::m_Sunrise_Jan, WorldData::m_Sunrise_Jul, WorldData::m_Sunset_Jan, WorldData::m_Sunset_Jul, WorldData::m_UniversalTemperatureSourceCapModifier, WorldData::m_Weather, WorldData::m_WeatherDefaultSettings, Math::RandomFloat(), Weather::SetDynVolFogHeightBias() и Weather::SetDynVolFogHeightDensity().

◆ InitYieldBank()

override void InitYieldBank ( )
inlineprivate
86 {
87 super.InitYieldBank();
88
89 m_YieldBank.ClearAllRegisteredItems();
90
91 //fishies
92 m_YieldBank.RegisterYieldItem(new YieldItemWalleyePollock(24));
93 m_YieldBank.RegisterYieldItem(new YieldItemSteelheadTrout(12));
94
95 m_YieldBank.RegisterYieldItem(new YieldItemShrimp(1));
96
97 //fishy junk
98 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Brown"));
99 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Grey"));
100 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Green"));
101 m_YieldBank.RegisterYieldItem(new YieldItemJunk(1,"Wellies_Black"));
102 m_YieldBank.RegisterYieldItem(new YieldItemJunkEmpty(1,"Pot"));
103
104 //non-fishies
105 m_YieldBank.RegisterYieldItem(new YieldItemDeadRabbit(1));
106 m_YieldBank.RegisterYieldItem(new YieldItemDeadFox(1));
107 //m_YieldBank.RegisterYieldItem(new YieldItemGenericSmallAnimal(1,"Animal_UrsusArctos",AnimalCatchingConstants.MASK_ENVIRO_FOREST,AnimalCatchingConstants.MASK_METHOD_LANDTRAP_MEATBAIT));
108 }
void YieldItemJunk(int baseWeight, string type)
Definition YieldsFishingJunk.c:37
ref CatchYieldBank m_YieldBank
Definition WorldData.c:30
Definition YieldsLandAnimals.c:18
Definition YieldsFish.c:159
Definition YieldsFish.c:131

Перекрестные ссылки WorldData::m_YieldBank и YieldItemJunk().

◆ LogWeatherData()

bool LogWeatherData ( )
inlineprotected
683 {
684 #ifdef WEATHER_DATA_LOGGING
685 return true;
686 #endif
687 return false;
688 }

◆ SetupLiquidTemperatures()

override void SetupLiquidTemperatures ( )
inlineprivate
121 {
122
124
125 m_LiquidSettings.m_Temperatures[LIQUID_SALTWATER] = -0.5;
126 m_LiquidSettings.m_Temperatures[LIQUID_WATER] = 2.0;
127 m_LiquidSettings.m_Temperatures[LIQUID_STILLWATER] = 2.0;
128 m_LiquidSettings.m_Temperatures[LIQUID_RIVERWATER] = 2.0;
129 m_LiquidSettings.m_Temperatures[LIQUID_FRESHWATER] = 2.0;
130 m_LiquidSettings.m_Temperatures[LIQUID_CLEANWATER] = 5.0;
131 m_LiquidSettings.m_Temperatures[LIQUID_SNOW] = -5.0;
132 m_LiquidSettings.m_Temperatures[LIQUID_HOTWATER] = 90.0;
133 }
ref WorldDataLiquidSettings m_LiquidSettings
Definition WorldData.c:32
const int LIQUID_STILLWATER
Definition constants.c:529
const int LIQUID_HOTWATER
Definition constants.c:530
const int LIQUID_FRESHWATER
Definition constants.c:528
const int LIQUID_CLEANWATER
Definition constants.c:531
const int LIQUID_WATER
Definition constants.c:518
const int LIQUID_RIVERWATER
Definition constants.c:519
const int LIQUID_SALTWATER
Definition constants.c:527
const int LIQUID_SNOW
Definition constants.c:526

Перекрестные ссылки LIQUID_CLEANWATER, LIQUID_FRESHWATER, LIQUID_HOTWATER, LIQUID_RIVERWATER, LIQUID_SALTWATER, LIQUID_SNOW, LIQUID_STILLWATER, LIQUID_WATER и WorldData::m_LiquidSettings.

◆ SetupWeatherSettings()

override void SetupWeatherSettings ( )
inlineprivate
111 {
112 super.SetupWeatherSettings();
113
114 m_WeatherDefaultSettings.m_GlobalSuddenChance = 95; // works if the randomization value is bigger than this. we do not want to decrease the clear sky chance
115 m_WeatherDefaultSettings.m_ClearWeatherChance = 20;
116 m_WeatherDefaultSettings.m_BadWeatherChance = 65;
117 m_WeatherDefaultSettings.m_BadWeatherSuddenChance = 15;
118 }

Перекрестные ссылки WorldData::m_WeatherDefaultSettings.

◆ WeatherOnBeforeChange()

override bool WeatherOnBeforeChange ( EWeatherPhenomenon type,
float actual,
float change,
float time )
inlineprivate
136 {
137 #ifdef WEATHER_DATA_LOGGING
138 if ( !dayInit )
139 {
140 GetGame().GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
141 dayInit = true;
142 }
143 #endif
144
145 float phmnTime = 120;
146 float phmnLength = 10;
147 float phmnValue = 0;
148
149 m_Weather.GetRain().SetLimits(0, 0);//since we decided that it will not rain in sakhal...
150
151 m_Weather.GetOvercast().SetLimits(0.07, 1);
152 m_Weather.GetSnowfall().SetLimits(0, 1);
153 m_Weather.SetSnowfallThresholds( m_WeatherDefaultSettings.m_SnowfallThreshold, 1.0, 60 );
154 m_Weather.GetSnowfall().SetForecastChangeLimits(0, 1);
155
156 m_Weather.SetStorm( 1.0, m_WeatherDefaultSettings.m_ThundersnowThreshold, 45 );
157
159 m_Weather.GetWindMagnitude().SetForecastChangeLimits( 0, 20 );
160
161 m_Weather.GetFog().SetLimits(0,0);
162
163 switch (type)
164 {
165 //-----------------------------------------------------------------------------------------------------------------------------
166 case EWeatherPhenomenon.OVERCAST:
167 {
168 float windDirection, windMag;
169
170 #ifdef WEATHER_DATA_LOGGING
172 #endif
173 //went something goes wrong choose some default random weather
174 phmnValue = Math.RandomFloatInclusive( 0.2, 0.7 );
175 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
176 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
177
178 //----
179 //--
180 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
181 {
182 m_ClearWeatherChance -= ( m_StepValue * m_SameWeatherCnt); //decrease the chance of the same weather
183 }
184
185 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
186 {
187 m_ClearWeatherChance += ( m_StepValue * m_SameWeatherCnt); //increase the chance of the better weather
188 }
189
190 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
191 {
192 m_ClearWeatherChance += m_StepValue; //increase the chance of the better weather slightly
193 m_BadWeatherChance += (( m_StepValue * m_SameWeatherCnt ) + m_StepValue ); //decrease the chance of the same weather rapidly
194 }
195
196 //----
197 //calculate next weather
198
199 m_Chance = Math.RandomIntInclusive( 0, 100 );
200 if ( m_Chance > m_WeatherDefaultSettings.m_GlobalSuddenChance && !m_IsSuddenChange) //checks if previous weather was a sudden change
201 {
202 #ifdef WEATHER_DATA_LOGGING
204 #endif
205
206 m_IsSuddenChange = true;
208 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
210 }
211 else if ( m_Chance < m_ClearWeatherChance )
212 {
214 m_IsSuddenChange = false;
215
216 if ( m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
218 }
219 else if ( m_Chance > m_BadWeatherChance )
220 {
222
223 if ( m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
225
226 if ( m_IsSuddenChange )
227 {
228 m_IsSuddenChange = false;
229
230 #ifdef WEATHER_DATA_LOGGING
232 #endif
233 }
234 else
235 {
236 if ( Math.RandomIntInclusive( 0, 100 ) < m_WeatherDefaultSettings.m_BadWeatherSuddenChance )
237 {
238 m_IsSuddenChange = true;
239
240 #ifdef WEATHER_DATA_LOGGING
242 #endif
243 }
244 else
245 {
246 #ifdef WEATHER_DATA_LOGGING
248 #endif
249 }
250 }
251 }
252 else
253 {
255 m_IsSuddenChange = false;
256 if ( m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
258 }
259
262
263 m_ClearWeatherChance = m_WeatherDefaultSettings.m_ClearWeatherChance;
264 m_BadWeatherChance = m_WeatherDefaultSettings.m_BadWeatherChance;
265
266 //----
267 //set choosen weather
268 if ( m_ChoosenWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
269 {
271 #ifdef WEATHER_DATA_LOGGING
273 #endif
274 phmnValue = Math.RandomFloatInclusive( 0.07, 0.3 );
275 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
276 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
277 }
278
280 {
281 #ifdef WEATHER_DATA_LOGGING
283 #endif
285
286 phmnValue = Math.RandomFloatInclusive( 0.3, 0.6 );
287 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
288 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
289 }
290
291 if ( m_ChoosenWeather == WorldDataWeatherConstants.BAD_WEATHER )
292 {
294
295 phmnValue = Math.RandomFloatInclusive( 0.6, 1.0 );
296 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinTime, m_WeatherDefaultSettings.m_OvercastMaxTime );
297 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_OvercastMinLength, m_WeatherDefaultSettings.m_OvercastMaxLength );
298
299 if ( m_IsSuddenChange )
300 {
303 }
304
305 #ifdef WEATHER_DATA_LOGGING
306 if ( phmnValue > m_WeatherDefaultSettings.m_ThundersnowThreshold )
307 {
308 if ( m_IsSuddenChange )
309 {
311 if ( m_Chance < m_WeatherDefaultSettings.m_GlobalSuddenChance )
312 {
314 }
315 else
316 {
318 }
319 }
320 else
321 {
324 }
325 }
326 #endif
327
328 }
329
331
332 //we want to control wind with the overcast calculation and change with it.
336
337 if( m_IsSuddenChange )
338 {
339 m_Weather.GetSnowfall().Set(Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0); //forces to snow in the suddenchange.
340 }
341
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()));
344
345 #ifdef WEATHER_DATA_LOGGING
346 int testYear = 0;
347 int testMonth = 0;
348 int testDay = 0;
349 int testHour = 0;
350 int testMinute = 0;
351 GetGame().GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
352
353 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
354 {
355 FileHandle file = OpenFile("$profile:OvercastCountsSakhal" + (currentDay + 1) + ".log", FileMode.WRITE);
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);
367
368 currentDay++;
370 if ( currentDay == daysToRun )
371 {
372 g_Game.RequestExit(IDC_MAIN_QUIT);
373 }
374
380 badWeatherCount = 0;
383 }
384 #endif
385
386
387 return true;
388 }
389 //-----------------------------------------------------------------------------------------------------------------------------
390 case EWeatherPhenomenon.SNOWFALL:
391 {
392 float actualOvercast = m_Weather.GetOvercast().GetActual();
393
394 m_Chance = Math.RandomIntInclusive( 0, 100 );
395 phmnValue = 0.2;
396 phmnTime = 90;
397 phmnLength = 20;
398
399 if ( actualOvercast <= m_WeatherDefaultSettings.m_SnowfallThreshold )
400 {
401 m_Weather.GetSnowfall().Set( 0.0, m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMin );
402 CalculateVolFog(0.0, m_Weather.GetWindMagnitude().GetForecast(), phmnTime);
403
404 Debug.WeatherLog(string.Format("Sakhal::Weather::Snow::ForceEnd:: (%1) %2 -> 0", g_Game.GetDayTime(), actual));
405 return true;
406 }
407
408 if ( actualOvercast > m_WeatherDefaultSettings.m_ThundersnowThreshold )
409 {
410 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
411 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax ) * 0.5;
412 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax ) * 1.2;
413
415
417 Debug.WeatherLog(string.Format("Sakhal::Weather::Snow::ForceStorm:: (%1) %2 -> %3", g_Game.GetDayTime(), actual, phmnValue));
418 return true;
419 }
420
421 if ( actualOvercast == m_Weather.GetOvercast().GetForecast() && m_Weather.GetSnowfall().GetActual() >= 0.8 && m_Weather.GetWindSpeed() >= 10 ) //if overcast is not changing and there was high snowfall
422 {
423 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
424 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax ) * 0.5;
425 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax ) * 1.2;
426
427 m_Weather.GetWindMagnitude().Set(m_Weather.GetWindMagnitude().GetActual() * 0.2, phmnTime , phmnLength); // next change will be happen in phenomenon change and reset the wind speed
429
431 Debug.WeatherLog(string.Format("Sakhal::Weather::Snow::ForceStorm:: (%1) %2 -> %3", g_Game.GetDayTime(), actual, phmnValue));
432 return true;
433 }
434
435 if ( actualOvercast < 0.6 ) //snowfall treshold to 0.6 overcast, snowfall in this bracket does not increase wetness
436 {
437 if ( m_Chance < 40 )
438 {
439 phmnValue = Math.RandomFloatInclusive( 0.02, 0.4 );
440 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
441 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax ) * 1.2;
442 }
443 else //also have the chance to not have snow at all
444 {
445 phmnValue = 0;
446 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
447 phmnLength = Math.RandomIntInclusive(m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax) * 2;
448 }
449 }
450 else if ( actualOvercast < 0.75 ) //0.6 to 0.75 overcast
451 {
452 if ( m_Chance < 30 )
453 {
454 phmnValue = Math.RandomFloatInclusive( 0.5, 0.8 );
455 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
456 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
457 }
458 else if ( m_Chance < 60 )
459 {
460 phmnValue = Math.RandomFloat( 0.3, 0.5 ); //0.5 snowfall starts to increase wetness
461 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
462 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
463 }
464 else if ( m_Chance < 75 )
465 {
466 phmnValue = Math.RandomFloatInclusive( 0.02, 0.3 );
467 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
468 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
469 }
470 else //also have the chance to not have snow at all
471 {
472 if ( m_IsSuddenChange )
473 {
474 phmnValue = Math.RandomFloat( 0.3, 0.5 ); //0.5 snowfall starts to increase wetness
475 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
476 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
477 }
478 else
479 {
480 phmnValue = 0;
481 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
482 phmnLength = Math.RandomIntInclusive(m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax) * 1.2;
483 }
484 }
485 }
486 else //0.75 to thunderstorm threshold overcast
487 {
488 if ( m_Chance < 35 )
489 {
490 phmnValue = Math.RandomFloatInclusive( 0.7, 1.0 );
491 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
492 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
493 }
494 else if ( m_Chance < 75 )
495 {
496 phmnValue = Math.RandomFloatInclusive( 0.5, 0.7 );
497 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
498 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax ) ;
499 }
500 else if ( m_Chance < 85 )
501 {
502 phmnValue = Math.RandomFloat( 0.2, 0.5 ); //0.5 snowfall starts to increase wetness
503 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
504 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
505 }
506 else
507 {
508 if ( m_IsSuddenChange )
509 {
510 phmnValue = Math.RandomFloat( 0.5, 0.7 ); //0.5 snowfall starts to increase wetness
511 phmnTime = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
512 phmnLength = Math.RandomIntInclusive( m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax );
513 }
514 else
515 {
516 phmnValue = Math.RandomFloat( 0.02, 0.1 );
517 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
518 phmnLength = Math.RandomIntInclusive(m_WeatherDefaultSettings.m_SnowfallLengthMin, m_WeatherDefaultSettings.m_SnowfallLengthMax) * 1.2;
519 }
520 }
521 }
522
525
526 Debug.WeatherLog(string.Format("Sakhal::Weather::Snow:: (%1) %2", g_Game.GetDayTime(), actual));
527
528 return true;
529 }
530 //-----------------------------------------------------------------------------------------------------------------------------
531 case EWeatherPhenomenon.FOG:
532 {
533 m_Weather.GetFog().Set(0,0,100000);
534
535 return true;
536
537 /*float fogMin = 0.0;
538 float fogMax = 0.15;
539 float fogTime = 1800.0;
540
541 if ( m_Weather.GetWindSpeed() >= 10 )
542 {
543 m_Weather.GetFog().Set( 0, 300, 0);
544 Debug.WeatherLog(string.Format("Sakhal::Weather::Fog:: (%1) %2", g_Game.GetDayTime(), actual));
545
546 return true;
547 }
548
549 if ( m_Weather.GetOvercast().GetActual() < 0.3 )
550 {
551 fogMin = 0.0;
552 fogMax = 0.1;
553 fogTime = 600.0;
554 }
555 else if ( m_Weather.GetOvercast().GetActual() > 0.6 )
556 {
557 fogMin = 0.1;
558 fogMax = 0.3;
559 fogTime = 600.0;
560 }
561 else
562 {
563 fogMin = 0.0;
564 fogMax = 0.15;
565 fogTime = 600.0;
566 }
567
568 m_Weather.GetFog().Set( Math.RandomFloatInclusive( fogMin, fogMax ), fogTime, 0);
569 Debug.WeatherLog(string.Format("Sakhal::Weather::Fog:: (%1) %2", g_Game.GetDayTime(), actual));
570
571 return true;*/
572 }
573 //-----------------------------------------------------------------------------------------------------------------------------
574 case EWeatherPhenomenon.WIND_MAGNITUDE:
575 {
576 phmnTime = Math.RandomInt( m_WeatherDefaultSettings.m_SnowfallTimeMin, m_WeatherDefaultSettings.m_SnowfallTimeMax );
577 m_Weather.GetWindMagnitude().Set(m_Weather.GetWindMagnitude().GetActual() / 0.2, phmnTime , m_WeatherDefaultSettings.m_OvercastMaxTime + 1000); // next change will be happen with the overcast or snowfall change
578 CalculateVolFog(m_Weather.GetSnowfall().GetForecast(), m_Weather.GetWindMagnitude().GetForecast(), phmnTime);
579
580 return true;
581 }
582 }
583
584 return false;
585 }
DayZGame g_Game
Definition DayZGame.c:3815
EWeatherPhenomenon
Definition Weather.c:11
Definition Debug.c:14
static void WeatherLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:209
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
Definition Sakhal.c:587
const int CLOUDY_WEATHER
Definition Sakhal.c:692
proto native void SetStorm(float density, float threshold, float timeOut)
Sets the thunderstorm properties.
proto native void SetWindMaximumSpeed(float maxSpeed)
Sets the maximal wind speed in metre per second. Equivalent to setting WindMagnitude phenomenon(s) va...
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native void SetSnowfallThresholds(float tMin, float tMax, float tTime)
Sets overcast threshold values for snowfall phenomena.
proto native WindDirection GetWindDirection()
Returns a wind direction phenomenon object.
int m_LastWeather
Definition WorldData.c:48
float SUDDENCHANGE_TIME_MULTIPLIER
how many % of environment temperature can be lowered by clouds
Definition WorldData.c:13
int m_ChoosenWeather
Definition WorldData.c:47
float WIND_MAGNITUDE_TIME_MULTIPLIER
Definition WorldData.c:15
int m_StepValue
Definition WorldData.c:45
int m_Chance
Definition WorldData.c:46
float WIND_DIRECTION_TIME_MULTIPLIER
Definition WorldData.c:16
int m_SameWeatherCnt
Definition WorldData.c:44
float SUDDENCHANGE_LENGTH_MULTIPLIER
Definition WorldData.c:14
bool m_IsSuddenChange
Definition WorldData.c:38
FileMode
Definition EnSystem.c:383
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.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
const int IDC_MAIN_QUIT
Definition constants.c:144

Перекрестные ссылки CalculateVolFog(), CalculateWind(), CloseFile(), CLOUDY_WEATHER, FPrintln(), g_Game, Weather::GetFog(), GetGame(), Weather::GetOvercast(), Weather::GetRain(), Weather::GetSnowfall(), Weather::GetWindDirection(), Weather::GetWindMagnitude(), Weather::GetWindSpeed(), IDC_MAIN_QUIT, WorldData::m_BadWeatherChance, WorldData::m_Chance, WorldData::m_ChoosenWeather, WorldData::m_ClearWeatherChance, WorldData::m_IsSuddenChange, WorldData::m_LastWeather, WorldData::m_SameWeatherCnt, WorldData::m_StepValue, WorldData::m_Weather, WorldData::m_WeatherDefaultSettings, OpenFile(), Math::RandomFloat(), Math::RandomFloatInclusive(), Math::RandomInt(), Math::RandomIntInclusive(), Weather::SetSnowfallThresholds(), Weather::SetStorm(), Weather::SetWindMaximumSpeed(), WorldData::SUDDENCHANGE_LENGTH_MULTIPLIER, WorldData::SUDDENCHANGE_TIME_MULTIPLIER, Debug::WeatherLog(), WorldData::WIND_DIRECTION_TIME_MULTIPLIER и WorldData::WIND_MAGNITUDE_TIME_MULTIPLIER.

Поля

◆ BAD_WEATHER

const int BAD_WEATHER = 3
protected

◆ CLEAR_WEATHER

const int CLEAR_WEATHER = 1
protected

DEPRECATED (see WorldDataWeatherConstants)

◆ CLOUDY_WEATHER

const int CLOUDY_WEATHER = 2
protected

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

◆ COLD_AREA_TOOL_DMG_MODIF

const float COLD_AREA_TOOL_DMG_MODIF = 1.2
private

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

◆ SPAWN_CHANCE_CHOLERA

const float SPAWN_CHANCE_CHOLERA = 20
private

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


Объявления и описания членов класса находятся в файле: