71 m_MaxTemps = {3,5,7,14,19,24,26,25,21,16,10,5};
72 m_MinTemps = {-3,-2,0,4,9,14,18,17,12,7,4,0};
91 if ( monthday <= 8.0 )
98 if ( monthday <= 8.0 )
106 int year, month, day, hour, minute;
107 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
113 if (hour >= sunriseTimeStart && hour < (sunriseTimeStart + 2))
115 else if (hour >= (sunriseTimeStart + 2) && hour < sunsetTimeStart)
117 else if (hour >= sunsetTimeStart && hour < (sunsetTimeStart + 2))
127 float dayLight = approxSunset - approxSunrise;
128 float nightTime = 24.0 - dayLight;
129 int tempArrayIndex =
Math.
Floor(monthday) - 1;
130 int tempArrayIndexToLerp = tempArrayIndex + 1;
131 if ( tempArrayIndexToLerp >= 12 )
132 tempArrayIndexToLerp = 0;
133 float tempArrayLerp = monthday -
Math.
Floor(monthday);
135 float minTempB =
m_MinTemps[tempArrayIndexToLerp];
137 float maxTempB =
m_MaxTemps[tempArrayIndexToLerp];
138 float eveningMinA = minTempA + ( 0.5 *
Math.
AbsFloat( minTempA - maxTempA ) );
139 float eveningMinB = minTempB + ( 0.5 *
Math.
AbsFloat( minTempB - maxTempB ) );
141 if ( ( daytime >= approxSunrise ) && ( daytime <= approxSunset ) ) {
142 if ( daytime <= ( approxSunrise + ( dayLight * 0.75 ) ) )
144 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
145 Math.
Lerp( maxTempA, maxTempB, tempArrayLerp ),
146 ( ( daytime - approxSunrise ) / ( dayLight * 0.75 ) ) );
149 Math.
Lerp( maxTempA, maxTempB, tempArrayLerp ),
150 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
151 ( ( ( daytime - approxSunrise ) - ( dayLight * 0.75 ) ) / ( dayLight - ( dayLight * 0.75 ) ) ) );
153 if ( ( daytime > approxSunset ) && ( daytime < 24 ) )
155 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
156 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
157 ( ( daytime - approxSunset ) / ( 24 - approxSunset ) ) / 2.0 );
160 Math.
Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
161 Math.
Lerp( minTempA, minTempB, tempArrayLerp ),
162 ( ( ( daytime + ( 24 - approxSunset ) ) / nightTime ) / 2.0 ) + 0.5 );
170 int year, month, day, hour, minute;
171 g_Game.GetWorld().GetDate( year, month, day, hour, minute );
200 float overcastScale =
Math.
Lerp( 0.50, 1.25, overcast01 );
201 float windScale =
Math.
Lerp( 1.25, 1.00, wind01 );
203 return Math.
Clamp( overcastScale * windScale, 0.50, 1.25 );
219 float terrainHeight = pos[1];
235 ErrorEx(
"Undefined enviro temperature for liquid type: " + liquidType);
271 Print(
"--------------------");
272 for (
int i = 0; i < 24; i++ )
274 for (
int j = 0; j < 6; j++ )
276 int minute = ( j * 10 );
329 float temperatureOut = 0.0;
339 Debug.
Log(
string.Format(
"Only OVERCAST, WIND and FOG parameters are supported"));
342 return temperatureOut;
347 float temperatureOutput = 0.0;
350 temperatureOutput = temperatureOutput *
m_Weather.GetWindMagnitude().GetActual() *
GetWindCoef();
352 return -temperatureOutput;
355 protected void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction);
357 protected void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime);
417class WorldDataWeatherConstants
458class WorldDataLiquidSettings
EEnvironmentTemperatureComponent
class WorldDataWeatherSettings m_Temperatures
class WorldData CLEAR_WEATHER
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.
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()
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
float GetBaseEnvTemperatureExact(int month, int day, int hour, int minute)
float m_TemperatureInsideBuildingsModifier
how many % of environment temperature can be lowered by clouds
void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
const float COLD_AREA_TOOL_DMG_MODIF_DEF
const float SPAWN_CHANCE_CHOLERA_DEF
void BaseTempDebug(int month, int day)
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)
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)
int m_CalmAfterStormTimeMax
int m_FoggyMorningHeigthBiasLowLimit
float m_ThundersnowThreshold
int m_CalmAfterStormTimeMin
float m_SnowfallThreshold
int m_BadWeatherSuddenChance
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.
array< string > 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 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.