10class EnvironmentSnapshotData
101 #ifdef ENABLE_LOGGING
102 bool m_DebugLogDryWet =
false;
103 bool m_DebugLogItemHeat =
false;
315 return m_Player.IsSoundInsideBuilding();
334 return parent.IsAnyInherited(typenames);
374 if (car && car.EngineIsOn())
402 vector hitPosition, hitNormal;
404 vector to = from +
"0 25 0";
436 g_Game.SurfaceUnderObjectByBoneCorrectedLiquid(
m_Player, SurfaceAnimationBone.RightFrontLimb, surfType, liquidType);
461 g_Game.SurfaceUnderObjectExCorrectedLiquid(
m_Player, surfType, impact, liquidType);
471 pWaterLevel =
m_Player.GetCurrentWaterLevel();
527 temperature = waterBodyTemperature -
m_WorldData.m_WaterContactTemperatureModifier;
534 temperature +=
m_WorldData.m_TemperatureInsideBuildingsModifier;
553 if (temperaturesDiff * (temperaturesDiff - temperature) > 0.0)
603 if (weatherEffect <= 0)
701 int playerAttachmentCount =
m_Player.GetInventory().AttachmentCount();
703 #ifdef ENABLE_LOGGING
706 for (
int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
708 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
709 if (attachment.IsItemBase())
711 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
712 for (
int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
714 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
715 for (
int i = 0; i < pSlotIds.Count(); ++i)
717 if (attachmentSlot == pSlotIds.Get(i))
730 #ifdef ENABLE_LOGGING
731 LogDryWetProcess(
"==========");
740 bool isParentWet =
false;
741 bool parentContainsLiquid =
false;
744 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
755 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
756 parentContainsLiquid =
true;
766 if (isParentWet || parentContainsLiquid)
768 float soakingCoef = 0;
769 if (parentContainsLiquid)
771 soakingCoef = pItem.GetSoakingIncrement(
"parentWithLiquid");
772 #ifdef ENABLE_LOGGING
773 LogDryWetProcess(
string.Format(
"%1 (soak coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), soakingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
776 else if (isParentWet && parentItem)
778 if (pItem.GetWet() < parentItem.GetWet())
781 #ifdef ENABLE_LOGGING
782 LogDryWetProcess(
string.Format(
"%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
788 #ifdef ENABLE_LOGGING
789 LogDryWetProcess(
string.Format(
"%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
793 pItem.AddWet(soakingCoef);
795 if (pItem.GetInventory().GetCargo())
797 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
798 for (
int i = 0; i < inItemCount; ++i)
801 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
806 int attCount = pItem.GetInventory().AttachmentCount();
809 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
811 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
830 int attCount =
m_Player.GetInventory().AttachmentCount();
832 #ifdef ENABLE_LOGGING
841 distance =
Math.
Max(distance, 0.1);
843 #ifdef ENABLE_LOGGING
844 LogDryWetProcess(
string.Format(
"distance to heatsource: %1 m", distance));
848 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
850 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
851 if (attachment && attachment.IsItemBase())
864 #ifdef ENABLE_LOGGING
865 LogDryWetProcess(
"==========");
879 float dryingIncrement = pItem.GetDryingIncrement(
"player");
881 dryingIncrement = pItem.GetDryingIncrement(
"playerHeatSource");
884 bool isParentWet =
false;
885 bool parentContainsLiquid =
false;
888 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
899 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
900 parentContainsLiquid =
true;
908 float dryingCoef = 0;
910 if (!isParentWet && !parentContainsLiquid)
916 #ifdef ENABLE_LOGGING
917 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
919 pItem.AddWet(dryingCoef);
922 if (pItem.GetInventory().GetCargo())
924 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
925 for (
int i = 0; i < inItemCount; ++i)
928 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
933 int attCount = pItem.GetInventory().AttachmentCount();
936 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
938 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
940 if (
ItemBase.CastTo(itemAtt, attachment))
946 if (parentContainsLiquid)
950 #ifdef ENABLE_LOGGING
951 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), dryingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
953 pItem.AddWet(dryingCoef);
960 #ifdef ENABLE_LOGGING
961 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
963 pItem.AddWet(dryingCoef);
978 float hcBodyPartTotal, hcBodyPart;
979 float hBodyPartTotal, hBodyPart;
981 float heatComfortSum = 0.0;
982 float heatItems = 0.0;
984 #ifdef ENABLE_LOGGING
985 LogItemHeat(
"====================");
988 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
990 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
992 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
994 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
996 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
998 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1000 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1002 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1004 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1013 heatItems = hBodyPartTotal;
1014 heatComfortSum = hcBodyPartTotal;
1015 heatComfortSum += hcPenaltyTotal;
1019 if (
m_Player.GetStomach().GetStomachVolume() > 0.0)
1021 float stomachContentTemperature =
m_Player.GetStomach().GetStomachTemperature();
1029 stomachContentTemperature,
1039 stomachContentTemperature,
1043 stomachContentTemperature = 0.0;
1057 targetHeatComfort =
Math.
Clamp(targetHeatComfort, 0.0,
m_Player.GetStatHeatComfort().GetMax());
1059 targetHeatComfort =
Math.
Clamp(targetHeatComfort,
m_Player.GetStatHeatComfort().GetMin(),
m_Player.GetStatHeatComfort().GetMax());
1061 targetHeatComfort =
Math.
Round(targetHeatComfort * 100) * 0.01;
1063 float dynamicHeatComfort;
1066 float direction = 1.0;
1067 if (targetHeatComfort < 0.0)
1076 dynamicHeatComfort =
Math.
Round(dynamicHeatComfort * 100) * 0.01;
1093 float targetHeatComfort = 0.0;
1099 m_Player.GetStatHeatComfort().Set(dynamicHeatComfort);
1114 m_Player.SetHeatBufferDynamicMax(heatBufferMax);
1122 heatBuffer.Add(-heatBufferValueCorrection);
1126 float increaseRate = 0.0;
1127 float decreaseRate = 0.0;
1133 float decreaseRateByHeatBufferStageCoef = 1;
1138 switch (
m_Player.GetHeatBufferStage())
1141 decreaseRateByHeatBufferStageCoef =
Math.
Lerp(
1144 heatBufferMaxInversed,
1148 decreaseRateByHeatBufferStageCoef =
Math.
Lerp(
1151 heatBufferMaxInversed,
1161 decreaseRate *= decreaseRateByHeatBufferStageCoef;
1172 heatBuffer.Add(-decreaseRate);
1179 if (applicableHeatbuffer > 0.0)
1180 heatBuffer.Add(-decreaseRate);
1181 else if (applicableHeatbuffer != 0.0 && !
m_Player.GetModifiersManager().IsModifierActive(
eModifiers.MDF_HEATBUFFER))
1182 heatBuffer.Set(0.0);
1189 if (applicableHeatbuffer < heatBufferMax)
1191 heatBuffer.Add(increaseRate);
1195 else if (applicableHeatbuffer > 0.0)
1196 heatBuffer.Add(-decreaseRate);
1197 else if (applicableHeatbuffer != 0.0 && !
m_Player.GetModifiersManager().IsModifierActive(
eModifiers.MDF_HEATBUFFER))
1198 heatBuffer.Set(0.0);
1208 float applicableHeatbuffer =
Math.
Round((heatBuffer.Get() / heatBuffer.GetMax()) * 1000) * 0.001;
1210 return applicableHeatbuffer;
1224 int attCount =
m_Player.GetInventory().AttachmentCount();
1225 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1227 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1229 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1232 for (
int i = 0; i < pBodyPartIds.Count(); ++i)
1234 if (attachmentSlot == pBodyPartIds[i])
1236 float heatPermCoef = item.GetHeatPermeabilityCoef();
1255 float heatPermCoef = item.GetHeatPermeabilityCoef();
1266 float heatPermCoef = heatPermeabilityCoef;
1269 int inventoryAttCount = item.GetInventory().AttachmentCount();
1270 if (inventoryAttCount > 0)
1273 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1275 if (
Class.
CastTo(attachmentItem,item.GetInventory().GetAttachmentFromIndex(inAttIdx)))
1277 heatPermCoef = heatPermeabilityCoef;
1278 heatPermCoef *= attachmentItem.GetHeatPermeabilityCoef();
1290 if (item.GetInventory().GetCargo())
1292 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1293 if (inventoryItemCount > 0)
1296 for (
int j = 0; j < inventoryItemCount; ++j)
1298 if (
Class.
CastTo(inventoryItem,item.GetInventory().GetCargo().GetItem(j)))
1300 heatPermCoef = heatPermeabilityCoef;
1301 heatPermCoef *= inventoryItem.GetHeatPermeabilityCoef();
1318 bool globalCooling =
true;
1324 globalCooling =
false;
1327 if (item.GetTemperature() != targetTemperature || !item.IsFreezeThawProgressFinished())
1329 TemperatureDataInterpolated temperatureData =
new TemperatureDataInterpolated(
1334 heatPermeabilityCoef,
1336 temperatureData.m_UseGlobalCooling = globalCooling;
1338 item.SetTemperatureEx(temperatureData);
1363 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1366 if (attachment.IsClothing())
1369 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1371 if (attachmentSlot == pBodyPartId)
1373 #ifdef ENABLE_LOGGING
1377 float itemHeatcomfort = 0;
1378 float itemTemperature = 0;
1383 if (inventoryAttCount > 0)
1385 #ifdef ENABLE_LOGGING
1386 LogItemHeat(
string.Format(
"attachments:"),
false);
1388 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1392 if (attachmentItem && attachmentItem.CanHaveTemperature())
1394 itemTemperature = attachmentItem.GetTemperature();
1397 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1398 #ifdef ENABLE_LOGGING
1399 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat),
true);
1401 pHeat += itemHeatcomfort;
1408 if (inventoryItemCargo)
1410 int inventoryItemCount = inventoryItemCargo.
GetItemCount();
1412 if (inventoryItemCount > 0)
1414 #ifdef ENABLE_LOGGING
1415 LogItemHeat(
string.Format(
"cargo:"),
false);
1417 for (
int j = 0; j < inventoryItemCount; ++j)
1420 if (inventoryItem && inventoryItem.CanHaveTemperature())
1422 itemTemperature = inventoryItem.GetTemperature();
1425 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1426 #ifdef ENABLE_LOGGING
1427 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort),
true);
1429 pHeat += itemHeatcomfort;
1436 pHeatComfort = MiscGameplayFunctions.GetCurrentItemHeatIsolation(item) * pCoef;
1438 #ifdef ENABLE_LOGGING
1439 LogItemHeat(
string.Format(
"overall heat from items=%1 (coef applied)", pHeat));
1457 float penalty = 0.0;
1488 foreach (
EntityAI nearestEntity : nearestObjects)
1490 if (nearestEntity.IsUniversalTemperatureSource() && nearestEntity !=
m_Player)
1493 if (!nearestEntity.GetUniversalTemperatureSource().GetLambda().AffectsPlayer())
1504 if (
m_Player.GetItemInHands() &&
m_Player.GetItemInHands().IsUniversalTemperatureSource())
1528 float itemCoefAverage = 0.0;
1532 itemCoefAverage += tempSource.GetTemperatureItemCoef();
1534 itemCoefAverage /= UTScount;
1537 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
1538 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
1540 if (max > 0 && min < 0)
1579 distance =
Math.
Max(distance, 0.1);
1580 float temperature = 0;
1583 if (distance > uts.GetFullRange())
1585 float distFactor =
Math.
InverseLerp(uts.GetMaxRange(), uts.GetFullRange(), distance);
1586 temperature = uts.GetTemperatureCap() * distFactor;
1590 temperature = uts.GetTemperatureCap();
1599 #ifdef DIAG_DEVELOPER
1600 EnvDebugData GetEnvDebugData()
1602 EnvDebugData data =
new EnvDebugData();
1607 void ShowEnvDebugPlayerInfo(
bool enabled)
1609 EnvDebugData data = GetEnvDebugData();
1610 DisplayEnvDebugPlayerInfo(enabled, data);
1613 static void DisplayEnvDebugPlayerInfo(
bool enabled, EnvDebugData data)
1623 DbgUI.Text(
string.Format(
"Heat comfort(target): %1", data.m_PlayerData.m_HeatComfortTarget));
1624 DbgUI.Text(
string.Format(
"Heat comfort(dynamic): %1", data.m_PlayerData.m_HeatComfortDynamic));
1625 DbgUI.Text(
string.Format(
"Inside: %1 (%2)", data.m_PlayerData.m_Inside, data.m_PlayerData.m_Surface));
1626 DbgUI.Text(
string.Format(
"Under roof: %1 (%2)", data.m_PlayerData.m_UnderRoof, data.m_PlayerData.m_UnderRoofTimer));
1627 if ( data.m_PlayerData.m_WaterLevel > 0 )
1629 DbgUI.Text(
string.Format(
"Water Level: %1", data.m_PlayerData.m_WaterLevel));
1638 DbgUI.Text(
string.Format(
"Env temperature (base): %1", data.m_MiscData.m_TemperatureBase));
1639 DbgUI.Text(
string.Format(
"Env temperature (height corrected): %1", data.m_MiscData.m_HeightCorrectedTemperature));
1640 DbgUI.Text(
string.Format(
"Env temperature (modfied): %1", data.m_MiscData.m_TemperatureModified));
1641 DbgUI.Text(
string.Format(
"Wind magnitude(surface mult): %1 (x%2)", data.m_WeatherData.m_Wind, data.m_WeatherData.m_WindModifier));
1642 DbgUI.Text(
string.Format(
"Rain: %1", data.m_WeatherData.m_Rain));
1643 DbgUI.Text(
string.Format(
"Snow: %1", data.m_WeatherData.m_Snowfall));
1644 DbgUI.Text(
string.Format(
"Datetime: %1", WorldDataDaytime.ToString(
g_Game.GetMission().GetWorldData().GetDaytime())));
1645 DbgUI.Text(
string.Format(
"Fog: %1", data.m_WeatherData.m_Fog));
1646 DbgUI.Text(
string.Format(
"Clouds: %1", data.m_WeatherData.m_Clouds));
1647 DbgUI.Text(
string.Format(
"Wet delta: %1", data.m_MiscData.m_WetDelta));
1652 void FillDebugWeatherData(EnvDebugWeatherData data)
1666 message +=
"Player stats";
1668 message +=
"\nHeat comfort(dynamic): " +
m_HeatComfort.ToString();
1671 string impact, surfaceType;
1672 g_Game.SurfaceUnderObjectExCorrectedLiquid(
m_Player, surfaceType, impact, liquidType);
1675 message +=
"\nSurface: " + surfaceType;
1676 message +=
"\nLiquid: " + liquidType;
1683 message +=
"\n\nWeather stats";
1684 message +=
"\nEnv temperature (base): " +
m_WorldData.GetBaseEnvTemperature().ToString();
1685 message +=
"\nEnv temperature (height corrected): " +
m_WorldData.GetBaseEnvTemperatureAtObject(
m_Player);
1688 message +=
"\nRain: " +
m_Rain.ToString();
1689 message +=
"\nSnow: " +
m_Snowfall.ToString();
1691 message +=
"\nFog: " +
m_Fog.ToString();
1692 message +=
"\nClouds: " +
m_Clouds.ToString();
1715 if (temperature >= lowerLimit && temperature <= upperLimit)
1736 #ifdef ENABLE_LOGGING
1737 private void LogDryWetProcess(
string message,
bool indented =
false)
1739 if (m_DebugLogDryWet)
1741 string indentation =
"";
1743 indentation =
"|--";
1745 Debug.Log(
string.Format(
"%1 %2", indentation, message));
1750 #ifdef ENABLE_LOGGING
1751 private void LogItemHeat(
string message,
bool indented =
false)
1753 if (m_DebugLogItemHeat)
1755 string indentation =
"";
1757 indentation =
"|--";
1759 Debug.Log(
string.Format(
"%1 %2", indentation, message));
1794 return temperature_reduction;
1803 if (pBodyPartIds.Count() > 0)
1805 #ifdef ENABLE_LOGGING
1809 int attCount =
m_Player.GetInventory().AttachmentCount();
1810 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1812 EntityAI attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1813 if (attachment.IsClothing())
1816 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1819 for (
int i = 0; i < pBodyPartIds.Count(); ++i)
1821 if (attachmentSlot == pBodyPartIds[i])
1823 float heatIsoMult = 1.0;
1829 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
1831 float itemHeatcomfort = 0;
1832 float itemTemperature = 0;
1835 int inventoryAttCount = item.GetInventory().AttachmentCount();
1836 if (inventoryAttCount > 0)
1838 #ifdef ENABLE_LOGGING
1839 LogItemHeat(
string.Format(
"attachments:"),
false);
1841 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1843 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1845 if (attachmentItem && attachmentItem.CanHaveTemperature())
1847 itemTemperature = attachmentItem.GetTemperature();
1850 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1851 #ifdef ENABLE_LOGGING
1852 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat),
true);
1853 pHeat += itemHeatcomfort;
1859 if (item.GetInventory().GetCargo())
1861 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1863 if (inventoryItemCount > 0)
1865 #ifdef ENABLE_LOGGING
1866 LogItemHeat(
string.Format(
"cargo:"),
false);
1868 for (
int j = 0; j < inventoryItemCount; ++j)
1870 ItemBase inventoryItem =
ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1871 if (inventoryItem && inventoryItem.CanHaveTemperature())
1873 itemTemperature = inventoryItem.GetTemperature();
1876 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1877 #ifdef ENABLE_LOGGING
1878 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort),
true);
1880 pHeat += itemHeatcomfort;
1891 pHeatComfort += (pHeatComfort / pBodyPartIds.Count()) * pCoef;
1893 #ifdef ENABLE_LOGGING
1894 LogItemHeat(
string.Format(
"overall heat from items=%1 (coef applied)", pHeat));
1902 EnvironmentSnapshotData data =
new EnvironmentSnapshotData();
1939#ifdef DIAG_DEVELOPER
1940class EnvDebugPlayerData :
Param
1942 float m_HeatComfortDynamic;
1943 float m_HeatComfortTarget;
1947 int m_UnderRoofTimer;
1952 m_HeatComfortTarget = env.GetTargetHeatComfort();
1953 m_HeatComfortDynamic = player.GetStatHeatComfort().Get();
1954 m_Inside = env.IsInsideBuilding();
1956 m_UnderRoof = env.IsUnderRoof();
1957 m_UnderRoofTimer = env.GetNextRoofCheck();
1973class EnvDebugMiscData :
Param
1975 float m_TemperatureBase;
1976 float m_TemperatureModified;
1977 float m_HeightCorrectedTemperature;
1982 m_TemperatureBase =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
1983 m_TemperatureModified = env.GetTemperature();
1984 m_HeightCorrectedTemperature = m_TemperatureBase - env.GetTemperatureHeightCorrection();
1985 m_WetDelta = env.GetWetDelta();
1990 return ctx.
Write(m_TemperatureBase) && ctx.
Write(m_TemperatureModified) && ctx.
Write(m_HeightCorrectedTemperature) && ctx.
Write(m_WetDelta);
1995 return ctx.
Read(m_TemperatureBase) && ctx.
Read(m_TemperatureModified) && ctx.
Read(m_HeightCorrectedTemperature) && ctx.
Read(m_WetDelta);
1999class EnvDebugWeatherData :
Param
2002 float m_WindModifier;
2010 env.FillDebugWeatherData(
this);
2024class EnvDebugData :
Param
2026 ref EnvDebugPlayerData m_PlayerData =
new EnvDebugPlayerData();
2027 ref EnvDebugMiscData m_MiscData =
new EnvDebugMiscData();
2028 ref EnvDebugWeatherData m_WeatherData =
new EnvDebugWeatherData();
2032 m_PlayerData.Synch(env, player);
2033 m_MiscData.Synch(env);
2034 m_WeatherData.Synch(env);
2039 return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
2044 return m_PlayerData.Deserializer(ctx) && m_MiscData.Deserializer(ctx) && m_WeatherData.Deserializer(ctx);
void DayZPlayerUtils()
cannot be instantiated
EEnvironmentTemperatureComponent
ref EnvironmentSnapshotData m_EnvironmentSnapshot
bool IsNeutralTemperature(float temperature, float lowerLimit=GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT, float upperLimit=GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
void CollectAndSetEnvironmentData()
Sets actual weather related values for further use (rain, snow, wind, etc.)
ref SimpleMovingAverage< float > m_UTSAverageTemperatureBuffer
ref array< UTemperatureSource > m_UTemperatureSources
void SetTargetHeatComfort(float value)
float GetTemperatureHeightCorrection()
bool IsChildOfType(array< typename > typenames)
Returns true if character is child of given parent type(s)
bool IsWaterContact()
Is character in contact with water body? (periodically checked - GameConstants.ENVIRO_TICK_RATE).
ref array< int > m_SlotIdsComplete
int m_HeatComfortBehaviorCategory
bool IsInsideBuilding()
Is character inside building? (periodically checked - GameConstants.ENVIRO_TICK_ROOF_RC_CHECK).
float m_UTSAverageTemperature
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
void SetAreaGenericColdness()
Determines whether player is in cold area which restricts use of some actions (digging)
void ProcessTemperatureSources()
Processes registered UTSources and calculates resulting m_UTSAverageTemperature.
float m_PlayerTemperature
bool OverridenHeatComfort(out float value)
void CheckUnderRoof()
Checks whether character is sheltered and sets the information.
void AddToEnvironmentTemperature(float pTemperature)
float m_ItemTemperatureCoef
const float SNOWFALL_LIMIT_LOW
float m_EnvironmentTemperature
ref array< int > m_HeadParts
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
ref array< int > m_SlotIdsUpper
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
void ProcessItemsWetness(array< int > pSlotIds)
Soak items at specific Slot ID(s)
float m_HeatSourceTemp
DEPRECATED.
float GetWindModifierPerSurface()
Wind intensity (influence) modifier of temperature value.
float GetApplicableHeatbuffer()
ref array< int > m_SlotIdsLower
void ProcessItemsInHandsTemperature()
Process temperature of item in character hands and cool/warm it to neutral temparature.
void Environment(PlayerBase pPlayer)
void SetEnvironmentSnapshotData()
bool IsUnderRoof()
Is character under roof (periodically checked - GameConstants.ENVIRO_TICK_ROOF_RC_CHECK)....
ref SimpleMovingAverage< float > m_AverageHeatComfortBuffer
bool m_IsUnderRoofBuilding
const float WATER_LEVEL_MID
float m_Rain
target value of heatcomfort (non-buffered)
void ProcessWetnessByWaterLevel(float pWaterLevel)
Processes items wetness in player possession based on the current water level (the character is in)
float WindEffectTemperatureValue(float temperatureInput)
backward compatibility [<1.28]
const float SNOWFALL_WIND_COMBINED_THRESHOLD
void SetProcessedItemTemperature(ItemBase item, float heatPermeabilityCoef=1.0)
void CollectAndSetPlayerData()
Sets character related value for furher use.
enum EEnvironmentHeatcomfortBehaviorCategory m_ClothingHeatComfort
void ProcessItemHierarchyRecursive(ItemBase item, float heatPermeabilityCoef=1.0)
bool IsTemperatureSet()
For safe-guards, waiting for the proper temperature to be set.
ref array< int > m_BodyParts
void SetItemHeatingCoef(float val)
void GatherTemperatureSources()
Checks characters proximity for usable Universal Temperature Sources and register them.
const float WATER_LEVEL_LOW
const float WATER_LEVEL_NONE
void OnTemperatureSourcesLeft()
Event fired when characters leave the UTSource proximity.
ref array< int > m_FeetParts
float EnvTempToCoef(float pTemp)
const float WATER_LEVEL_HIGH
EEnvironmentHeatcomfortBehaviorCategory
Categories that are changing behavior of Heat comfort processing.
ref SimpleMovingAverage< float > m_WindAverageBuffer
string GetDebugMessage()
debug
float GetWetDelta()
Calculates soaking/drying delta based on character's location and weather.
bool DetermineHeatcomfortBehavior()
Changes Heat Comfort curve behavior based on where the character is.
void ApplyWetnessToItem(ItemBase pItem)
void BodyPartHeatProperties(int pBodyPartId, float pCoef, out float pHeatComfort, out float pHeat)
Iterate through given body part and calculates heatcofort and item heat value.
float m_HeatBufferCapPrevious
reused as state toggle
bool IsRaining()
Rain phenomenon actual value > RAIN_LIMIT_LOW.
void SetEnvironmentTemperature()
ref array< int > m_SlotIdsBottom
float GetEnvironmentTemperature()
Calculations of temperarute for different situations.
float GetUniversalSourcesTemperageAverage()
float NakedBodyPartHeatComfortPenalty(int pBodyPartSlotId, float pCoef)
Calculates penalty value for heatcomfort - this simulates uncovered body part reaction.
void SetHeatcomfortDirectly()
void ProcessWetnessByRain()
void OnTemperatureSourcesEnter()
Event fired when characters enters into UTSource proximity.
void ApplyDrynessToItem(ItemBase pItem)
bool IsSnowing()
Snowfall phenomenon actual value > SNOWFALL_LIMIT_LOW.
float m_RoofCheckTimer
keeps wetness of most wet item in player's possesion
class EnvironmentDrynessData RAIN_LIMIT_LOW
Simulates influence of environment to character Takes input data from WorldData, Weather system and e...
void ProcessItemsDryness()
Dry items in player possession.
float GetPlayerHeat()
Character's heat (calculated from movement speed multiplied by constant)
float m_TargetHeatComfort
player's heatcomfort (buffered, stored in player stats)
float GetTargetHeatComfort()
bool m_HasTemperatureSources
bool IsUnderRoofBuilding()
Is character under building's roof (periodically checked - GameConstants.ENVIRO_TICK_ROOF_RC_CHECK)....
void ProcessHeatComfort()
Calculates and process player's heatcomfort related to defined body parts.
void ProcessHeatBuffer(EnvironmentSnapshotData data)
void ProcessItemsTemperature(array< int > pBodyPartIds)
Iterate through items in player posession (by given body parts) and cool/warm them to neutral tempara...
void CheckWaterContact(out float pWaterLevel)
Checks player's contanct with water.
void PlayerStat(T min, T max, T init, string label, int flags)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
void Synch(EntityAI victim)
keeping "step" here for consistency only
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Super root of all classes in Enforce script.
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
float m_TemperatureSourceDistance
bool m_UseTemperatureSources
proto native EntityAI GetAttachmentFromIndex(int index)
proto native CargoBase GetCargo()
cargo
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
const float STAGE_THRESHOLDS[NUMBER_OF_STAGES]
proto native float GetCurrentMovementSpeed()
0,1,2..3 idle, walk, run, sprint
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
proto native EntityAI GetParent()
returns parent of current inventory location
provides access to slot configuration
override bool IsSelfAdjustingTemperature()
bool Deserializer(Serializer ctx)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
proto bool Write(void value_out)
proto bool Read(void value_in)
Native class for boats - handles physics simulation.
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native float GetActual()
static string ToString(int value)
Keeps information about currently loaded world, like temperature.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float TEMP_COEF_INVENTORY
const float TEMP_COEF_SWIMMING
const float ENVIRO_WIND_CHILL_LIMIT
Affects the slope of calculation.
const float ENVIRO_NAKED_BODY_PENALTY_SNOWFALL_MIN_VALUE
how intensive a rain should be to enable rain penalty on naked body
const float ENVIRO_TEMPERATURE_UNDERROOF_COEF
increases temp inside vehicles
const float ENVIRO_TEMP_EFFECT_ON_PLAYER
comfort temperature of environment for the player
static const float ENVIRO_HEATCOMFORT_VEST_WEIGHT
const float ENVIRO_HIGH_TEMP_LIMIT
lowest temperature(deg Celsius) where the player gets lowest possible heat comfort (-1)
const float ENVIRO_HEATCOMFORT_MAX_STEP_SIZE
when is sun highest on sky
static const float ENVIRO_HEATCOMFORT_HIPS_WEIGHT
const float ENVIRO_FOG_DRY_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by cloudy sky
const float COLD_AREA_TEMPERATURE_THRESHOLD
const float ENVIRO_DRY_INCREMENT
amount of wetness added to items wet value each tick if is raining
const float ENVIRO_ISOLATION_WETFACTOR_DRENCHED
const float ENVIRO_CLOUD_DRY_EFFECT
how much is the generic temp effect increased when player is next to a fireplace
const float ENVIRO_PLAYER_HEATBUFFER_CAPACITY_MIN
How much heat buffer change rates are affected by temperature.
const float ENVIRO_WET_INCREMENT
in secs. how often we should check if player is under the roof (raycast)
const float ENVIRO_PLAYER_HEATBUFFER_WATEREFFECT
impact of enviro temperature on player (lower value = higher, cannot be zero or below!...
const float ENVIRO_STOMACH_WEIGHT
const float ENVIRO_TICKS_TO_WETNESS_CALCULATION
in secs. how often should enviro effet process
static const float ENVIRO_HEATCOMFORT_LEGS_WEIGHT
static const float ENVIRO_HEATCOMFORT_WEIGHT_SUMMARY
don't forget to update the weights from above if you are adding/removing them
const float ENVIRO_PLAYER_HEATBUFFER_DECREASE
impact of water contact on player's heatbuffer
const float ENVIRO_PLAYER_HEATBUFFER_TEMP_AFFECT
How much heat buffer increases per one enviro tick.
static const float ENVIRO_HEATCOMFORT_GLOVES_WEIGHT
static const float ENVIRO_HEATCOMFORT_FEET_WEIGHT
const float ENVIRO_TICK_ROOF_RC_CHECK
each X (ticks) is processed wetness on items on player
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT
const float ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF
heat entity generates if not moving
const float ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS
const float ENVIRO_WIND_EFFECT
windchill effect on base temperature
const float ENVIRO_WIND_EFFECT_SLOPE
time modifier, how much longer it takes to dig up worms while in a cold area
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT
damage per second dealt to attachment by fire
const float ENVIRO_TICK_RATE
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
static const float ENVIRO_HEATCOMFORT_BODY_WEIGHT
const float ENVIRO_PLAYER_COMFORT_TEMP
highest temperature(deg Celsius) where the player gets highest possible heat comfort (1)
const float ENVIRO_PLAYER_HEATBUFFER_INCREASE
How much heat buffer decreases per one enviro tick.
static const float ENVIRO_HEATCOMFORT_BACK_WEIGHT
static const float ENVIRO_HEATCOMFORT_HEADGEAR_WEIGHT
max step of dynamic heatcomfort change (applies if diff between target and dynamic HC is bigger than ...
const float ENVIRO_DEFAULT_ENTITY_HEAT
how many times slower is wetting/drying items in backpacks
const float ENVIRO_SNOW_WET_COEF
Above this value, the wind effect increases the modified temperature.
const float ENVIRO_NAKED_BODY_PENALTY_RAIN_MIN_VALUE
const float ENVIRO_LOW_TEMP_LIMIT
how much stomach content affects final heatcomfort
static const float ENVIRO_HEATCOMFORT_MASK_WEIGHT
how much this body part affects final heatcomfort
static ref array< ref TFloatArray > ENVIRO_PLAYER_HEATBUFFER_STAGE_RATELIMIT
Minimal heatbuffer capacity of naked character.
const float STATE_SOAKING_WET
const int LIQUID_STILLWATER
const int LIQUID_HOTWATER
const int LIQUID_FRESHWATER
const int LIQUID_RIVERWATER
const int LIQUID_SALTWATER
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float SqrFloat(float f)
Returns squared value.
static proto float Round(float f)
Returns mathematical round of value.
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 float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput=true)
Returns given value remaped from input range into output range.
static proto float AbsFloat(float f)
Returns absolute value.
vector GetPosition()
Get the world position of the Effect.