DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Weather.c
См. документацию.
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
210 proto native Sandstorm GetSandstorm();
211
219 proto native void SetStorm( float density, float threshold, float timeOut );
220
222 proto native void SuppressLightningSimulation(bool state);
223
225 proto native vector GetWind();
226
241 proto native void SetWind( vector wind );
242
248 proto native float GetWindSpeed();
249
256 proto native void SetWindSpeed( float speed );
257
263 proto native float GetWindMaximumSpeed();
264
269 proto native void SetWindMaximumSpeed( float maxSpeed );
270
277 proto void GetWindFunctionParams( out float fnMin, out float fnMax, out float fnSpeed );
278
285 proto native void SetWindFunctionParams( float fnMin, float fnMax, float fnSpeed );
286
303 proto native void SetRainThresholds( float tMin, float tMax, float tTime );
304
321 proto native void SetSnowfallThresholds( float tMin, float tMax, float tTime );
322
328 proto native void SetSnowflakeScale(float scale);
329
333 proto native float GetSnowflakeScale();
334
340 static proto float WindDirectionToAngle( vector dir );
341
347 static proto vector AngleToWindDirection( float angle );
348
349
354 proto native bool IsDynVolFogEnabled();
360 proto native void SetDynVolFogDistanceDensity(float value, float time = 0);
364 proto native float GetDynVolFogDistanceDensity();
370 proto native void SetDynVolFogHeightDensity(float value, float time = 0);
374 proto native float GetDynVolFogHeightDensity();
381 proto native void SetDynVolFogHeightBias(float value, float time = 0);
385 proto native float GetDynVolFogHeightBias();
386
387 void MissionWeather( bool use )
388 {
389 m_missionWeather = use;
390 }
391
393 {
394 return m_missionWeather;
395 }
396
397 void SetWeatherUpdateFreeze(bool state)
398 {
399 m_UpdateFrozen = state;
400 }
401
403 {
404 return m_UpdateFrozen;
405 }
406
407 [Obsolete("1.30: AI noise dampening is now done natively via AIParams config parameters. Kept for HUD and old mods.")]
409 {
410 float rainReduction = GetRainNoiseReduction();
411 float snowfallReduction = GetSnowfallNoiseReduction();
412 float sandstormReduction = GetSandstormNoiseReduction(object);
413
414 // If all reductions are zero, return 1 (no reduction)
415 if (rainReduction == 0 && snowfallReduction == 0 && sandstormReduction == 0)
416 return 1;
417
418 float maxReduction = Math.Max(rainReduction, Math.Max(snowfallReduction, sandstormReduction));
419 return 1 - maxReduction;
420 }
421
426
431
432 private float GetSandstormNoiseReduction(notnull Object object)
433 {
434 SandstormController sandstormController = GetSandstorm();
435 if (sandstormController.IsActive())
436 {
437 Man player = Man.Cast(object);
438 if (player)
439 {
440 return sandstormController.GetIntensityForPlayer(player) * GameConstants.SANDSTORM_NOISE_REDUCTION_WEIGHT;
441 }
442 else
443 {
444 return sandstormController.GetIntensity(object.GetPosition()) * GameConstants.SANDSTORM_NOISE_REDUCTION_WEIGHT;
445 }
446 }
447
448 return 0;
449 }
450
452 // deprecated - do not use
454 [Obsolete("Use Weather.GetNoiseReductionByWeatherEx instead!")]
456 {
459
460 if (rainReduction == 0 && snowfallReduction == 0)
461 return 1;
462
463 if (rainReduction > snowfallReduction) // combined phenomenons dont need to have multiplicative effects
464 return 1 - rainReduction;
465 else
466 return 1 - snowfallReduction;
467 }
468};
DayZGame g_Game
Определения DayZGame.c:4074
@ OVERCAST
@ FOG
SandstormController Sandstorm
Определения Sandstorm.c:135
WeatherPhenomenon Fog
Определения Weather.c:154
WeatherPhenomenon Rain
Определения Weather.c:155
EWeatherPhenomenon
Определения Weather.c:11
@ VOLFOG_HEIGHT_DENSITY
Определения Weather.c:18
@ SNOWFALL
Определения Weather.c:15
@ WIND_MAGNITUDE
Определения Weather.c:17
@ RAIN
Определения Weather.c:14
@ VOLFOG_DISTANCE_DENSITY
Определения Weather.c:19
@ WIND_DIRECTION
Определения Weather.c:16
@ VOLFOG_HEIGHT_BIAS
Определения Weather.c:20
WeatherPhenomenon WindDirection
Определения Weather.c:157
WeatherPhenomenon Overcast
Определения Weather.c:153
WeatherPhenomenon Snowfall
Определения Weather.c:156
WeatherPhenomenon WindMagnitude
Определения Weather.c:158
Определения EnMath.c:7
WorldData GetWorldData()
Определения gameplay.c:742
Mission class.
Определения gameplay.c:686
Определения ObjectTyped.c:2
proto native float GetIntensity(vector worldPosition)
Returns the intensity of the sandstorm at a given position in world space. The sandstorm must be acti...
float GetIntensityForPlayer(Man player)
Returns the intensity of the sandstorm at a players head position in world space. Value is influenced...
proto native bool IsActive()
Returns whether sandstorm is currently active.
Определения Sandstorm.c:7
float GetSnowfallNoiseReduction()
Определения Weather.c:427
proto native Fog GetFog()
Returns a fog phenomenon object.
void Weather()
Определения Weather.c:172
proto native float GetDynVolFogHeightBias()
Returns the current 'dynamic' volumetric fog height bias in meters.
proto native void SetDynVolFogHeightBias(float value, float time=0)
Sets the 'dynamic' volumetric height bias. Takes effect only if enabled via world config.
float GetNoiseReductionByWeather()
Определения Weather.c:455
bool m_missionWeather
Определения Weather.c:169
proto native void SetWind(vector wind)
Sets the wind vector (direction and speed as length of the vector).
proto native void SetSnowflakeScale(float scale)
Sets the overall scale of snowflakes during snowfall phenomenon. This value is not synchronized and s...
proto native void SetStorm(float density, float threshold, float timeOut)
Sets the thunderstorm properties.
proto native void SetWindSpeed(float speed)
Sets the actual wind speed in metre per second.
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
bool GetMissionWeather()
Определения Weather.c:392
float GetRainNoiseReduction()
Определения Weather.c:422
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 bool IsDynVolFogEnabled()
Dynamic volumetric fog only takes effect if enabled in the world config.
proto native Sandstorm GetSandstorm()
Returns the sandstorm phenomenon weather controller.
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
proto native float GetSnowflakeScale()
Returns the overall scale of snowflakes during snowfall phenomenon.
proto native void SetRainThresholds(float tMin, float tMax, float tTime)
Sets overcast threshold values for rain phenomena.
proto native void SetWindFunctionParams(float fnMin, float fnMax, float fnSpeed)
Sets function parameters that controls the wind behaviour (change in time).
proto void GetWindFunctionParams(out float fnMin, out float fnMax, out float fnSpeed)
Reads function parameters that controls the wind behaviour (change in time).
float GetNoiseReductionByWeatherEx(notnull Object object)
Определения Weather.c:408
float GetSandstormNoiseReduction(notnull Object object)
Определения Weather.c:432
static proto float WindDirectionToAngle(vector dir)
Returns the xz angle of the provided wind vector.
proto native vector GetWind()
Returns wind vector (direction and speed as length of the vector).
bool m_UpdateFrozen
Определения Weather.c:170
proto native float GetTime()
Returns actual time from start of a server (how many seconds elapsed from server start).
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native WindDirection GetWindDirection()
Returns a wind direction phenomenon object.
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...
bool GetWeatherUpdateFrozen()
Определения Weather.c:402
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
void SetWeatherUpdateFreeze(bool state)
Определения Weather.c:397
void MissionWeather(bool use)
Определения Weather.c:387
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 void SuppressLightningSimulation(bool state)
enables/disables thunderbolt simulation on client (together with sounds)
static proto vector AngleToWindDirection(float angle)
Returns wind direction from the provided wind angle.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native float GetDynVolFogHeightDensity()
Returns the current 'dynamic' volumetric fog height density.
void ~Weather()
Определения Weather.c:177
proto native float GetDynVolFogDistanceDensity()
Returns the current 'dynamic' volumetric fog distance density.
proto native void SetWindMaximumSpeed(float maxSpeed)
Sets the maximal wind speed in metre per second. Equivalent to setting WindMagnitude phenomenon(s) va...
Определения Weather.c:168
proto void GetLimits(out float fnMin, out float fnMax)
Reads limits of this phenomenon.
proto native void Set(float forecast, float time=0, float minDuration=0)
Sets the forecast.
proto native float GetActual()
proto native void SetNextChange(float time)
Sets the time in seconds when the next forecast will be computed.
proto native void SetLimits(float fnMin, float fnMax)
Sets limits of this phenomenon.
proto native void SetForecastChangeLimits(float fcMin, float fcMax)
Sets limits of change when forecast is computed.
bool OnBeforeChange(float change, float time)
Is called every time the Phenomenon computes new forecast.
Определения Weather.c:125
proto void GetForecastTimeLimits(out float ftMin, out float ftMax)
Reads time range in which next forecast can be computed.
proto native EWeatherPhenomenon GetType()
Returns type of this phenomenon.
void ~WeatherPhenomenon()
Определения Weather.c:31
proto native float GetNextChange()
Reads the time in seconds when the next forecast will be computed.
void WeatherPhenomenon()
Определения Weather.c:30
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 native void SetForecastTimeLimits(float ftMin, float ftMax)
Sets time range in which next forecast can be computed.
Определения Weather.c:29
bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
Определения WorldData.c:251
Keeps information about currently loaded world, like temperature.
Определения WorldData.c:3
Определения EnConvert.c:119
static float SANDSTORM_NOISE_REDUCTION_WEIGHT
Определения 3_Game/DayZ/constants.c:1145
static float RAIN_NOISE_REDUCTION_WEIGHT
Определения 3_Game/DayZ/constants.c:1143
static float SNOWFALL_NOISE_REDUCTION_WEIGHT
Определения 3_Game/DayZ/constants.c:1144
void Obsolete(string msg="")
Определения EnScript.c:371
static proto float Max(float x, float y)
Returns bigger of two given values.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473