DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Weather.c
Go to the documentation of this file.
1
6//-----------------------------------------------------------------------------
11{
14 RAIN
15};
16
17
18//-----------------------------------------------------------------------------
23{
24 private void WeatherPhenomenon() {}
25 private void ~WeatherPhenomenon() {}
26
29
31 proto native float GetActual();
32
34 proto native float GetForecast();
35
42 proto native void Set( float forecast, float time = 0, float minDuration = 0 );
43
45 proto native float GetNextChange();
47 proto native void SetNextChange( float time );
48
54 proto void GetLimits( out float fnMin, out float fnMax );
67 proto native void SetLimits( float fnMin, float fnMax );
68
74 proto void GetForecastChangeLimits( out float fcMin, out float fcMax );
88 proto native void SetForecastChangeLimits( float fcMin, float fcMax );
89
95 proto void GetForecastTimeLimits( out float ftMin, out float ftMax );
106 proto native void SetForecastTimeLimits( float ftMin, float ftMax );
107
118 bool OnBeforeChange( float change, float time )
119 {
120 // check if mission forces use of custom weather
121 Weather weather = g_Game.GetWeather();
122
123 if ( weather.GetMissionWeather() )
124 return false;
125
126 // check for active worlddata with custom onbeforechange behaviour
127 Mission currentMission = g_Game.GetMission();
128
129 if ( currentMission )
130 {
131 WorldData worldData = currentMission.GetWorldData();
132 if ( worldData )
133 {
134 return worldData.WeatherOnBeforeChange( GetType(), GetActual(), change, time );
135 }
136 }
137
138 return false;
139 }
140};
141
142
146
147
148
149
150//-----------------------------------------------------------------------------
155{
156 protected bool m_missionWeather;
157
158 private void Weather()
159 {
160 m_missionWeather = false;
161 }
162
163 private void ~Weather() {}
164
166 proto native float GetTime();
167
169 proto native Overcast GetOvercast();
170
172 proto native Fog GetFog();
173
175 proto native Rain GetRain();
176
184 proto native void SetStorm( float density, float threshold, float timeOut );
185
187 proto native void SuppressLightningSimulation(bool state);
188
190 proto native vector GetWind();
192 proto native void SetWind( vector wind );
197 proto native float GetWindSpeed();
203 proto native void SetWindSpeed( float speed );
208 proto native float GetWindMaximumSpeed();
210 proto native void SetWindMaximumSpeed( float maxSpeed );
217 proto void GetWindFunctionParams( out float fnMin, out float fnMax, out float fnSpeed );
224 proto native void SetWindFunctionParams( float fnMin, float fnMax, float fnSpeed );
225
242 proto native void SetRainThresholds( float tMin, float tMax, float tTime );
243
244 void MissionWeather( bool use )
245 {
246 m_missionWeather = use;
247 }
248
250 {
251 return m_missionWeather;
252 }
253
254};
DayZGame g_Game
Definition DayZGame.c:3654
WeatherPhenomenon Fog
Definition Weather.c:144
WeatherPhenomenon Rain
Definition Weather.c:145
EWeatherPhenomenon
Definition Weather.c:11
@ OVERCAST
Definition Weather.c:12
@ FOG
Definition Weather.c:13
@ RAIN
Definition Weather.c:14
WeatherPhenomenon Overcast
Definition Weather.c:143
Mission class.
Definition gameplay.c:670
WorldData GetWorldData()
Definition gameplay.c:719
proto native void SetStorm(float density, float threshold, float timeOut)
Sets the thunderstorm properties.
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)
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.
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
void MissionWeather(bool use)
Definition Weather.c:244
private void ~Weather()
Definition Weather.c:163
protected bool m_missionWeather
Definition Weather.c:156
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 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 SetWind(vector wind)
Sets the wind vector (direction and speed as length of the vector).
bool GetMissionWeather()
Definition Weather.c:249
private void Weather()
Definition Weather.c:158
proto native vector GetWind()
Returns wind vector (direction and speed as length of the vector).
proto native Fog GetFog()
Returns a fog phenomenon object.
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:118
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.
private void WeatherPhenomenon()
Definition Weather.c:24
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.
proto void GetLimits(out float fnMin, out float fnMax)
Reads limits of this phenomenon.
private void ~WeatherPhenomenon()
Definition Weather.c:25
proto native float GetActual()
Returns actual value of phenomenon in range <0, 1>.
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:126