Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
weather.c
Go to the documentation of this file.
1
6//-----------------------------------------------------------------------------
22
23
24//-----------------------------------------------------------------------------
29{
30 private void WeatherPhenomenon() {}
31 private void ~WeatherPhenomenon() {}
32
34 proto native EWeatherPhenomenon GetType();
35
38 proto native float GetActual();
39
41 proto native float GetForecast();
42
49 proto native void Set( float forecast, float time = 0, float minDuration = 0 );
50
52 proto native float GetNextChange();
54 proto native void SetNextChange( float time );
55
61 proto void GetLimits( out float fnMin, out float fnMax );
74 proto native void SetLimits( float fnMin, float fnMax );
75
81 proto void GetForecastChangeLimits( out float fcMin, out float fcMax );
95 proto native void SetForecastChangeLimits( float fcMin, float fcMax );
96
102 proto void GetForecastTimeLimits( out float ftMin, out float ftMax );
113 proto native void SetForecastTimeLimits( float ftMin, float ftMax );
114
125 bool OnBeforeChange( float change, float time )
126 {
127 // check if mission forces use of custom weather
128 Weather weather = g_Game.GetWeather();
129
130 if ( weather.GetMissionWeather() )
131 return false;
132
133 if (weather.GetWeatherUpdateFrozen())
134 return true;
135
136 // check for active worlddata with custom onbeforechange behaviour
137 Mission currentMission = g_Game.GetMission();
138
139 if ( currentMission )
140 {
141 WorldData worldData = currentMission.GetWorldData();
142 if ( worldData )
143 {
144 return worldData.WeatherOnBeforeChange( GetType(), GetActual(), change, time );
145 }
146 }
147
148 return false;
149 }
150};
151
152
159
160
161
162
163//-----------------------------------------------------------------------------
168{
169 protected bool m_missionWeather;
170 protected bool m_UpdateFrozen;
171
172 private void Weather()
173 {
174 m_missionWeather = false;
175 }
176
177 private void ~Weather() {}
178
180 proto native float GetTime();
181
183 proto native Overcast GetOvercast();
184
186 proto native Fog GetFog();
187
189 proto native Rain GetRain();
190
192 proto native Snowfall GetSnowfall();
193
199 proto native WindDirection GetWindDirection();
200
205 proto native WindMagnitude GetWindMagnitude();
206
214 proto native void SetStorm( float density, float threshold, float timeOut );
215
217 proto native void SuppressLightningSimulation(bool state);
218
220 proto native vector GetWind();
221
236 proto native void SetWind( vector wind );
237
243 proto native float GetWindSpeed();
244
251 proto native void SetWindSpeed( float speed );
252
258 proto native float GetWindMaximumSpeed();
259
264 proto native void SetWindMaximumSpeed( float maxSpeed );
265
272 proto void GetWindFunctionParams( out float fnMin, out float fnMax, out float fnSpeed );
273
280 proto native void SetWindFunctionParams( float fnMin, float fnMax, float fnSpeed );
281
298 proto native void SetRainThresholds( float tMin, float tMax, float tTime );
299
316 proto native void SetSnowfallThresholds( float tMin, float tMax, float tTime );
317
323 proto native void SetSnowflakeScale(float scale);
324
328 proto native float GetSnowflakeScale();
329
335 static proto float WindDirectionToAngle( vector dir );
336
342 static proto vector AngleToWindDirection( float angle );
343
344
349 proto native bool IsDynVolFogEnabled();
355 proto native void SetDynVolFogDistanceDensity(float value, float time = 0);
359 proto native float GetDynVolFogDistanceDensity();
365 proto native void SetDynVolFogHeightDensity(float value, float time = 0);
369 proto native float GetDynVolFogHeightDensity();
376 proto native void SetDynVolFogHeightBias(float value, float time = 0);
380 proto native float GetDynVolFogHeightBias();
381
382
383 void MissionWeather( bool use )
384 {
385 m_missionWeather = use;
386 }
387
388 bool GetMissionWeather()
389 {
390 return m_missionWeather;
391 }
392
393 void SetWeatherUpdateFreeze(bool state)
394 {
395 m_UpdateFrozen = state;
396 }
397
398 bool GetWeatherUpdateFrozen()
399 {
400 return m_UpdateFrozen;
401 }
402
403 // Noise reduction due to environmental conditions, used for AI noise evaluation
404 float GetNoiseReductionByWeather()
405 {
406 float rainReduction = GetRain().GetActual() * GameConstants.RAIN_NOISE_REDUCTION_WEIGHT;
407 float snowfallReduction = GetSnowfall().GetActual() * GameConstants.SNOWFALL_NOISE_REDUCTION_WEIGHT;
408
409 if (rainReduction == 0 && snowfallReduction == 0)
410 return 1;
411
412 if (rainReduction > snowfallReduction) // combined phenomenons dont need to have multiplicative effects
413 return 1 - rainReduction;
414 else
415 return 1 - snowfallReduction;
416 }
417};
eBleedingSourceType GetType()
Mission class.
Definition gameplay.c:687
bool m_missionWeather
Definition weather.c:169
bool m_UpdateFrozen
Definition weather.c:170
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
Definition worlddata.c:240
DayZGame g_Game
Definition dayzgame.c:3868
WeatherPhenomenon Fog
Definition weather.c:154
WeatherPhenomenon Rain
Definition weather.c:155
EWeatherPhenomenon
Definition weather.c:11
@ VOLFOG_HEIGHT_DENSITY
Definition weather.c:18
@ OVERCAST
Definition weather.c:12
@ SNOWFALL
Definition weather.c:15
@ FOG
Definition weather.c:13
@ WIND_MAGNITUDE
Definition weather.c:17
@ RAIN
Definition weather.c:14
@ VOLFOG_DISTANCE_DENSITY
Definition weather.c:19
@ WIND_DIRECTION
Definition weather.c:16
@ VOLFOG_HEIGHT_BIAS
Definition weather.c:20
WeatherPhenomenon WindDirection
Definition weather.c:157
WeatherPhenomenon Overcast
Definition weather.c:153
WeatherPhenomenon Snowfall
Definition weather.c:156
WeatherPhenomenon WindMagnitude
Definition weather.c:158