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 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
109 float sunriseTimeStart =
g_Game.GetMission().GetWorldData().GetApproxSunriseTime(month);
110 float sunsetTimeStart =
g_Game.GetMission().GetWorldData().GetApproxSunsetTime(month);
112 if (hour >= sunriseTimeStart && hour < (sunriseTimeStart + 2))
114 else if (hour >= (sunriseTimeStart + 2) && hour < sunsetTimeStart)
116 else if (hour >= sunsetTimeStart && hour < (sunsetTimeStart + 2))
126 float dayLight = approxSunset - approxSunrise;
127 float nightTime = 24.0 - dayLight;
128 int tempArrayIndex =
Math.Floor(monthday) - 1;
129 int tempArrayIndexToLerp = tempArrayIndex + 1;
130 if ( tempArrayIndexToLerp >= 12 )
131 tempArrayIndexToLerp = 0;
132 float tempArrayLerp = monthday -
Math.Floor(monthday);
134 float minTempB =
m_MinTemps[tempArrayIndexToLerp];
136 float maxTempB =
m_MaxTemps[tempArrayIndexToLerp];
137 float eveningMinA = minTempA + ( 0.5 *
Math.AbsFloat( minTempA - maxTempA ) );
138 float eveningMinB = minTempB + ( 0.5 *
Math.AbsFloat( minTempB - maxTempB ) );
140 if ( ( daytime >= approxSunrise ) && ( daytime <= approxSunset ) ) {
141 if ( daytime <= ( approxSunrise + ( dayLight * 0.75 ) ) )
143 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
144 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
145 ( ( daytime - approxSunrise ) / ( dayLight * 0.75 ) ) );
148 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
149 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
150 ( ( ( daytime - approxSunrise ) - ( dayLight * 0.75 ) ) / ( dayLight - ( dayLight * 0.75 ) ) ) );
152 if ( ( daytime > approxSunset ) && ( daytime < 24 ) )
154 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
155 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
156 ( ( daytime - approxSunset ) / ( 24 - approxSunset ) ) / 2.0 );
159 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
160 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
161 ( ( ( daytime + ( 24 - approxSunset ) ) / nightTime ) / 2.0 ) + 0.5 );
169 int year, month, day, hour, minute;
170 GetGame().GetWorld().GetDate( year, month, day, hour, minute );
187 weather.SetSnowflakeScale( snowflakeScale );
196 float overcast01 =
Math.Clamp(
Math.InverseLerp( 0.4, 1.0, weather.GetOvercast().GetActual() ), 0.0, 1.0 );
197 float wind01 = weather.GetWindSpeed() / weather.GetWindMaximumSpeed();
199 float overcastScale =
Math.Lerp( 0.50, 1.25, overcast01 );
200 float windScale =
Math.Lerp( 1.25, 1.00, wind01 );
202 return Math.Clamp( overcastScale * windScale, 0.50, 1.25 );
218 float terrainHeight = pos[1];
219 float heightCorrection =
Math.Max(0, (terrainHeight * m_TemperaturePerHeightReductionModifier));
234 ErrorEx(
"Undefined enviro temperature for liquid type: " + liquidType);
256 return SPAWN_CHANCE_CHOLERA_DEF;
264 return COLD_AREA_TOOL_DMG_MODIF_DEF;
270 Print(
"--------------------");
271 for (
int i = 0; i < 24; i++ )
273 for (
int j = 0; j < 6; j++ )
275 int minute = ( j * 10 );
310 temperature +=
m_Weather.GetOvercast().GetActual() * m_CloudsTemperatureEffectModifier;
328 float temperatureOut = 0.0;
331 temperatureOut =
m_Weather.GetOvercast().GetActual() * m_CloudsTemperatureEffectModifier;
338 Debug.Log(
string.Format(
"Only OVERCAST, WIND and FOG parameters are supported"));
341 return temperatureOut;
346 float temperatureOutput = 0.0;
349 temperatureOutput = temperatureOutput *
m_Weather.GetWindMagnitude().GetActual() *
GetWindCoef();
351 return -temperatureOutput;
354 protected void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction);
356 protected void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime);
416class WorldDataWeatherConstants
425 int m_OvercastMinTime = 600;
426 int m_OvercastMaxTime = 900;
427 int m_OvercastMinLength = 600;
428 int m_OvercastMaxLength = 900;
430 float m_RainThreshold = 0.6;
431 int m_RainTimeMin = 60;
432 int m_RainTimeMax = 120;
433 int m_RainLengthMin = 60;
434 int m_RainLengthMax = 120;
436 float m_StormThreshold = 0.85;
437 float m_ThundersnowThreshold = 0.98;
439 float m_SnowfallThreshold = 0.3;
440 int m_SnowfallTimeMin = 60;
441 int m_SnowfallTimeMax = 120;
442 int m_SnowfallLengthMin = 150;
443 int m_SnowfallLengthMax = 300;
445 int m_GlobalSuddenChance = 95;
446 int m_ClearWeatherChance = 30;
447 int m_BadWeatherChance = 80;
448 int m_BadWeatherSuddenChance = 95;
450 int m_FoggyMorningHeigthBiasLowLimit = 155;
451 int m_DefaultHeigthBias = 170;
453 int m_CalmAfterStormTimeMin = 480;
454 int m_CalmAfterStormTimeMax = 600;
457class WorldDataLiquidSettings
465 static int NIGHT = 0;
#define LIQUID_RIVERWATER
#define LIQUID_FRESHWATER
#define LIQUID_CLEANWATER
#define LIQUID_STILLWATER
Keeps information about currently loaded world, like temperature.
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 native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
class JsonUndergroundAreaTriggerData GetPosition
class WorldDataWeatherSettings m_Temperatures
class WorldData CLEAR_WEATHER