4 const float SPAWN_CHANCE_CHOLERA_DEF = 50;
5 const float COLD_AREA_TOOL_DMG_MODIF_DEF = 1;
8 float m_TemperaturePerHeightReductionModifier;
9 float m_CloudsTemperatureEffectModifier;
10 float m_TemperatureInsideBuildingsModifier;
11 float m_WaterContactTemperatureModifier;
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};
78 m_TemperaturePerHeightReductionModifier = 0.02;
79 m_CloudsTemperatureEffectModifier = 3.0;
80 m_TemperatureInsideBuildingsModifier = 1.0;
81 m_WaterContactTemperatureModifier = 20.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 );
188 weather.SetSnowflakeScale( snowflakeScale );
197 float overcast01 =
Math.Clamp(
Math.InverseLerp( 0.4, 1.0, weather.GetOvercast().GetActual() ), 0.0, 1.0 );
198 float wind01 = weather.GetWindSpeed() / weather.GetWindMaximumSpeed();
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];
220 float heightCorrection =
Math.Max(0, (terrainHeight * m_TemperaturePerHeightReductionModifier));
235 ErrorEx(
"Undefined enviro temperature for liquid type: " + liquidType);
257 return SPAWN_CHANCE_CHOLERA_DEF;
265 return COLD_AREA_TOOL_DMG_MODIF_DEF;
271 Print(
"--------------------");
272 for (
int i = 0; i < 24; i++ )
274 for (
int j = 0; j < 6; j++ )
276 int minute = ( j * 10 );
311 temperature +=
m_Weather.GetOvercast().GetActual() * m_CloudsTemperatureEffectModifier;
329 float temperatureOut = 0.0;
332 temperatureOut =
m_Weather.GetOvercast().GetActual() * m_CloudsTemperatureEffectModifier;
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
426 int m_OvercastMinTime = 600;
427 int m_OvercastMaxTime = 900;
428 int m_OvercastMinLength = 600;
429 int m_OvercastMaxLength = 900;
431 float m_RainThreshold = 0.6;
432 int m_RainTimeMin = 60;
433 int m_RainTimeMax = 120;
434 int m_RainLengthMin = 60;
435 int m_RainLengthMax = 120;
437 float m_StormThreshold = 0.85;
438 float m_ThundersnowThreshold = 0.98;
440 float m_SnowfallThreshold = 0.3;
441 int m_SnowfallTimeMin = 60;
442 int m_SnowfallTimeMax = 120;
443 int m_SnowfallLengthMin = 150;
444 int m_SnowfallLengthMax = 300;
446 int m_GlobalSuddenChance = 95;
447 int m_ClearWeatherChance = 30;
448 int m_BadWeatherChance = 80;
449 int m_BadWeatherSuddenChance = 95;
451 int m_FoggyMorningHeigthBiasLowLimit = 155;
452 int m_DefaultHeigthBias = 170;
454 int m_CalmAfterStormTimeMin = 480;
455 int m_CalmAfterStormTimeMax = 600;
458class WorldDataLiquidSettings
466 static int NIGHT = 0;
#define LIQUID_RIVERWATER
#define LIQUID_FRESHWATER
#define LIQUID_CLEANWATER
#define LIQUID_STILLWATER
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
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)
void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
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)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
EEnvironmentTemperatureComponent
const int INDEX_NOT_FOUND
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
vector GetPosition()
Get the world position of the Effect.
class WorldDataWeatherSettings m_Temperatures
class WorldData CLEAR_WEATHER