Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
weather.c
Go to the documentation of this file.
1
4
5
6//-----------------------------------------------------------------------------
22
23
24//-----------------------------------------------------------------------------
29{
30 private void WeatherPhenomenon() {}
31 private void ~WeatherPhenomenon() {}
32
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
124
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
200
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
389 {
390 return m_missionWeather;
391 }
392
393 void SetWeatherUpdateFreeze(bool state)
394 {
395 m_UpdateFrozen = state;
396 }
397
399 {
400 return m_UpdateFrozen;
401 }
402
403 // Noise reduction due to environmental conditions, used for AI noise evaluation
405 {
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};
Mission class.
Definition gameplay.c:686
WorldData GetWorldData()
Definition gameplay.c:742
Weather controller.
Definition weather.c:168
void ~Weather()
Definition weather.c:177
proto native float GetDynVolFogHeightBias()
Returns the current 'dynamic' volumetric fog height bias in meters.
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
proto native void SetStorm(float density, float threshold, float timeOut)
Sets the thunderstorm properties.
proto native void SetDynVolFogHeightBias(float value, float time=0)
Sets the 'dynamic' volumetric height bias.
proto native float GetTime()
Returns actual time from start of a server (how many seconds elapsed from server start).
proto native void SuppressLightningSimulation(bool state)
enables/disables thunderbolt simulation on client (together with sounds)
float GetNoiseReductionByWeather()
Definition weather.c:404
proto native void SetDynVolFogDistanceDensity(float value, float time=0)
Sets the dynamic volumetric fog distance density.
proto native void SetWindFunctionParams(float fnMin, float fnMax, float fnSpeed)
Sets function parameters that controls the wind behaviour (change in time).
proto native void SetWindMaximumSpeed(float maxSpeed)
Sets the maximal wind speed in metre per second.
proto native void SetWindSpeed(float speed)
Sets the actual wind speed in metre per second.
static proto vector AngleToWindDirection(float angle)
Returns wind direction from the provided wind angle.
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
void MissionWeather(bool use)
Definition weather.c:383
proto native float GetDynVolFogHeightDensity()
Returns the current 'dynamic' volumetric fog height density.
static proto float WindDirectionToAngle(vector dir)
Returns the xz angle of the provided wind vector.
proto native void SetSnowflakeScale(float scale)
Sets the overall scale of snowflakes during snowfall phenomenon.
bool m_UpdateFrozen
Definition weather.c:170
proto native float GetSnowflakeScale()
Returns the overall scale of snowflakes during snowfall phenomenon.
bool GetWeatherUpdateFrozen()
Definition weather.c:398
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto void GetWindFunctionParams(out float fnMin, out float fnMax, out float fnSpeed)
Reads function parameters that controls the wind behaviour (change in time).
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
void SetWeatherUpdateFreeze(bool state)
Definition weather.c:393
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native void SetRainThresholds(float tMin, float tMax, float tTime)
Sets overcast threshold values for rain phenomena.
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 bool IsDynVolFogEnabled()
Dynamic volumetric fog only takes effect if enabled in the world config.
proto native void SetWind(vector wind)
Sets the wind vector (direction and speed as length of the vector).
bool GetMissionWeather()
Definition weather.c:388
proto native void SetDynVolFogHeightDensity(float value, float time=0)
Sets the dynamic volumetric fog height density.
bool m_missionWeather
Definition weather.c:169
proto native vector GetWind()
Returns wind vector (direction and speed as length of the vector).
proto native WindDirection GetWindDirection()
Returns a wind direction phenomenon object.
proto native float GetDynVolFogDistanceDensity()
Returns the current 'dynamic' volumetric fog distance density.
proto native Fog GetFog()
Returns a fog phenomenon object.
void Weather()
Definition weather.c:172
Weather phenomenon.
Definition weather.c:29
proto native void SetForecastChangeLimits(float fcMin, float fcMax)
Sets limits of change when forecast is computed.
proto native void Set(float forecast, float time=0, float minDuration=0)
Sets the forecast.
bool OnBeforeChange(float change, float time)
Is called every time the Phenomenon computes new forecast.
Definition weather.c:125
proto native void SetNextChange(float time)
Sets the time in seconds when the next forecast will be computed.
proto native float GetNextChange()
Reads the time in seconds when the next forecast will be computed.
proto void GetForecastTimeLimits(out float ftMin, out float ftMax)
Reads time range in which next forecast can be computed.
void ~WeatherPhenomenon()
Definition weather.c:31
proto native void SetLimits(float fnMin, float fnMax)
Sets limits of this phenomenon.
proto native EWeatherPhenomenon GetType()
Returns type of this phenomenon.
proto void GetForecastChangeLimits(out float fcMin, out float fcMax)
Reads limits of change when forecast is computed.
proto native float GetForecast()
Returns a forecast value the phenomenon is heading towards.
void WeatherPhenomenon()
Definition weather.c:30
proto void GetLimits(out float fnMin, out float fnMax)
Reads limits of this phenomenon.
proto native float GetActual()
Returns actual value of phenomenon in range <0, 1>. (does not apply for Wind, which always returns th...
proto native void SetForecastTimeLimits(float ftMin, float ftMax)
Sets time range in which next forecast can be computed.
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:241
DayZGame g_Game
Definition dayzgame.c:3942
static float SNOWFALL_NOISE_REDUCTION_WEIGHT
Definition constants.c:1083
static float RAIN_NOISE_REDUCTION_WEIGHT
Definition constants.c:1082
WeatherPhenomenon Fog
Definition weather.c:154
WeatherPhenomenon Rain
Definition weather.c:155
EWeatherPhenomenon
All classes related to game weather.
Definition weather.c:11
@ VOLFOG_HEIGHT_DENSITY
Definition weather.c:18
@ SNOWFALL
Definition weather.c:15
@ 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