80 m_MaxTemps = {3,5,7,14,19,24,26,25,21,16,10,5};
81 m_MinTemps = {-3,-2,0,4,9,14,18,17,12,7,4,0};
101 if ( monthday <= 8.0 )
108 if ( monthday <= 8.0 )
116 int year, month, day, hour, minute;
117 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
123 if (hour >= sunriseTimeStart && hour < (sunriseTimeStart + 2))
125 else if (hour >= (sunriseTimeStart + 2) && hour < sunsetTimeStart)
127 else if (hour >= sunsetTimeStart && hour < (sunsetTimeStart + 2))
137 float dayLight = approxSunset - approxSunrise;
138 float nightTime = 24.0 - dayLight;
139 int tempArrayIndex =
Math.
Floor(monthday) - 1;
140 int tempArrayIndexToLerp = tempArrayIndex + 1;
141 if ( tempArrayIndexToLerp >= 12 )
142 tempArrayIndexToLerp = 0;
143 float tempArrayLerp = monthday -
Math.
Floor(monthday);
145 float minTempB =
m_MinTemps[tempArrayIndexToLerp];
147 float maxTempB =
m_MaxTemps[tempArrayIndexToLerp];
148 float eveningMinA = minTempA + ( 0.5 *
Math.
AbsFloat( minTempA - maxTempA ) );
149 float eveningMinB = minTempB + ( 0.5 *
Math.
AbsFloat( minTempB - maxTempB ) );
151 if ( ( daytime >= approxSunrise ) && ( daytime <= approxSunset ) ) {
152 if ( daytime <= ( approxSunrise + ( dayLight * 0.75 ) ) )
154 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
155 Math.
Lerp( maxTempA, maxTempB, tempArrayLerp ),
156 ( ( daytime - approxSunrise ) / ( dayLight * 0.75 ) ) );
159 Math.
Lerp( maxTempA, maxTempB, tempArrayLerp ),
160 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
161 ( ( ( daytime - approxSunrise ) - ( dayLight * 0.75 ) ) / ( dayLight - ( dayLight * 0.75 ) ) ) );
163 if ( ( daytime > approxSunset ) && ( daytime < 24 ) )
165 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
166 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
167 ( ( daytime - approxSunset ) / ( 24 - approxSunset ) ) / 2.0 );
170 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
171 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
172 ( ( ( daytime + ( 24 - approxSunset ) ) / nightTime ) / 2.0 ) + 0.5 );
180 int year, month, day, hour, minute;
181 g_Game.GetWorld().GetDate( year, month, day, hour, minute );
210 float overcastScale =
Math.
Lerp( 0.50, 1.25, overcast01 );
211 float windScale =
Math.
Lerp( 1.25, 1.00, wind01 );
213 return Math.
Clamp( overcastScale * windScale, 0.50, 1.25 );
229 float terrainHeight = pos[1];
245 ErrorEx(
"Undefined enviro temperature for liquid type: " + liquidType);
281 Print(
"--------------------");
282 for (
int i = 0; i < 24; i++ )
284 for (
int j = 0; j < 6; j++ )
286 int minute = ( j * 10 );
339 float temperatureOut = 0.0;
349 Debug.
Log(
string.Format(
"Only OVERCAST, WIND and FOG parameters are supported"));
352 return temperatureOut;
358 overcastEffectOnSunModifier =
Math.
Clamp(overcastEffectOnSunModifier, 0, 1);
367 int daysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
370 for (
int i = 0; i < month - 1; i++)
372 dayNumber += daysInMonth[i];
387 return avg + amp *
Math.
Cos(angle);
399 return avg - amp *
Math.
Cos(angle);
404 float temperatureOutput = 0.0;
407 temperatureOutput = temperatureOutput *
m_Weather.GetWindMagnitude().GetActual() *
GetWindCoef();
409 return -temperatureOutput;
412 protected void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction);
414 protected void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime);
486 if (!
m_Weather.GetSandstorm().Start(timeToGather,
true))
498 bool isStartedByWeather =
false;
499 if (!continuedSession)
505 isStartedByWeather =
true;
554class WorldDataWeatherConstants
603class WorldDataLiquidSettings
647 foreach (
int value : range)
649 if (current == value)
657class DustEffectsSettings
EEnvironmentTemperatureComponent
float m_CloudEffectCooldownMin
float m_GroundEffectLifetimeMin
class WorldDataDaytime m_GroundEffectEnable
class WorldDataWeatherSettings m_Temperatures
float m_GroundEffectLifetimeMax
float m_GroundEffectSizeMin
float m_CloudEffectDurationMax
float m_CloudEffectMinWindStrength
float m_GroundEffectWindWeight
float m_GroundEffectDistance
float m_GroundEffectSizeMax
float m_GroundEffectMinWindStrength
float m_CloudEffectCooldownMax
float m_CloudEffectDistance
float m_GroundEffectFrequency
bool m_CloudEffectFromSurface
bool m_GroundEffectEndPoindTest
float m_CloudEffectDurationMin
class WorldData CLEAR_WEATHER
static float GetSandstormFrequency()
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
proto native void SetSnowflakeScale(float scale)
Sets the overall scale of snowflakes during snowfall phenomenon. This value is not synchronized and s...
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native float GetActual()
float GetAgentSpawnChance(eAgents agent)
float GetApproxSunriseTime(float monthday)
float ComputeSnowflakeScale(Weather weather)
Returns the desired snowflake scale based on weather simulation state.
float SUDDENCHANGE_TIME_MULTIPLIER
float GetTemperature(Object object, EEnvironmentTemperatureComponent properties=EEnvironmentTemperatureComponent.BASE)
Return actual temperature of environment based on provided parameters.
float GetSunEffectOnTemperature(int m_DayTime)
void StartSandstorm(float timeToGather)
Helper function that starts the sandstorm while setting an internal flag that allows WorldData identi...
void UpdateBaseEnvTemperature(float timeslice)
void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
float SUDDENCHANGE_LENGTH_MULTIPLIER
ref WorldDataLiquidSettings m_LiquidSettings
float GetNightTemperature()
float WIND_DIRECTION_TIME_MULTIPLIER
CatchYieldBank GetCatchYieldBank()
void OnSandstormStart(bool isStartedByWeather)
float GetSunsetTime(float dayNumber)
Returns sunset time for passed day.
sealed void WeatherSandstormStart(bool continuedSession)
Event propagated from SandstormController::OnStart raised when the sandstorm starts and begins fading...
float GetBaseEnvTemperature()
float GetBaseEnvTemperatureAtObject(notnull Object object)
float GetDayTemperature()
float GetBaseEnvTemperatureAtPosition(vector pos)
bool WeatherOnBeforeChange(EWeatherPhenomenon type, float actual, float change, float time)
ref WorldDataWeatherSettings m_WeatherDefaultSettings
float GetApproxSunsetTime(float monthday)
array< vector > GetArtyFiringPos()
ref array< vector > m_FiringPos
float m_WaterContactTemperatureModifier
float m_TemperaturePerHeightReductionModifier
directly accesible (defined/overriden in Init())
float m_CloudsTemperatureEffectModifier
amount of °C reduced for each 100 meteres of height above water level
TStringArray GetDefaultPRAPaths()
void UpdateWeatherEffects(Weather weather, float timeslice)
Updates local weather effects.
ref CatchYieldBank m_YieldBank
ref map< int, float > m_TemperatureUnderSunModifier
float GetBaseEnvTemperatureExact(int month, int day, int hour, int minute)
int DayOfYear(int day, int month)
Returns number of day in current year (eg. 1 - 365)
float m_TemperatureInsideBuildingsModifier
how many % of environment temperature can be lowered by clouds
float GetSunriseTime(float dayNumber)
Returns sunrise time for passed day.
void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
DustEffectsSettings GetDustEffectsSettings()
const float COLD_AREA_TOOL_DMG_MODIF_DEF
const float SPAWN_CHANCE_CHOLERA_DEF
void OnSandstormStop(bool calledFromWeather)
void BaseTempDebug(int month, int day)
ref DustEffectsSettings m_DustEffectsSettings
bool m_IsSandstormStartedByWeather
ref TStringArray m_DefaultPlayerRestrictedAreas
float GetUniversalTemperatureSourceCapModifier()
int m_BadWeatherChance
weather related
float GetColdAreaToolDamageModifier()
float WIND_MAGNITUDE_TIME_MULTIPLIER
float m_EnvironmentTemperature
void SetupWeatherSettings()
float m_UniversalTemperatureSourceCapModifier
float GetLiquidTypeEnviroTemperature(int liquidType)
sealed void WeatherSandstormStop(bool calledFromWeather)
Event propagated from SandstormController::OnStop raised when the sandstorm fades out and terminates.
void SetupLiquidTemperatures()
float GetTemperatureComponentValue(float temperatureIn, EEnvironmentTemperatureComponent properties=0)
Return value of queried EEnvironmentTemperatureComponent which can be used in future calculation(s)
void InitYieldBank()
override this to properly register world-specific yields
float CalcBaseEnvironmentTemperature(float monthday, float daytime)
float WindEffectTemperatureValue(float temperatureInput)
static string ToString(int value)
static bool IsInRange(int current, TIntArray range)
int m_CalmAfterStormTimeMax
float m_OvercastEffectMinLimitOnSunExposure
int m_FoggyMorningHeigthBiasLowLimit
float m_OvercastEffectMaxLimitOnSunExposure
float m_ThundersnowThreshold
int m_CalmAfterStormTimeMin
float m_SandstormMaxWindDirection
float m_SnowfallThreshold
int m_BadWeatherSuddenChance
float m_SandstormMinWindMagnitude
float m_SandstormMinWindDirection
float m_sandstormFrequency
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const int INDEX_NOT_FOUND
proto void Print(void var)
Prints content of variable to console/log.
class array< Class T > TStringArray
const float ENVIRO_WIND_CHILL_LIMIT
Affects the slope of calculation.
const float ENVIRO_FOG_TEMP_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by fog
const float ENVIRO_WIND_EFFECT_SLOPE
time modifier, how much longer it takes to dig up worms while in a cold area
const int LIQUID_STILLWATER
const int LIQUID_FRESHWATER
const int LIQUID_CLEANWATER
const int LIQUID_RIVERWATER
const int LIQUID_SALTWATER
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float AbsFloat(float f)
Returns absolute value.
vector GetPosition()
Get the world position of the Effect.