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";
433 g_Game.SurfaceUnderObjectByBoneCorrectedLiquid(
m_Player, SurfaceAnimationBone.RightFrontLimb, surfType, liquidType);
458 g_Game.SurfaceUnderObjectExCorrectedLiquid(
m_Player, surfType, impact, liquidType);
468 pWaterLevel =
m_Player.GetCurrentWaterLevel();
524 temperature = waterBodyTemperature -
m_WorldData.m_WaterContactTemperatureModifier;
531 temperature +=
m_WorldData.m_TemperatureInsideBuildingsModifier;
600 if (weatherEffect <= 0)
698 int playerAttachmentCount =
m_Player.GetInventory().AttachmentCount();
700 #ifdef ENABLE_LOGGING
703 for (
int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
705 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
706 if (attachment.IsItemBase())
708 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
709 for (
int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
711 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
712 for (
int i = 0; i < pSlotIds.Count(); ++i)
714 if (attachmentSlot == pSlotIds.Get(i))
727 #ifdef ENABLE_LOGGING
728 LogDryWetProcess(
"==========");
737 bool isParentWet =
false;
738 bool parentContainsLiquid =
false;
741 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
752 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
753 parentContainsLiquid =
true;
763 if (isParentWet || parentContainsLiquid)
765 float soakingCoef = 0;
766 if (parentContainsLiquid)
768 soakingCoef = pItem.GetSoakingIncrement(
"parentWithLiquid");
769 #ifdef ENABLE_LOGGING
770 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);
773 else if (isParentWet && parentItem)
775 if (pItem.GetWet() < parentItem.GetWet())
778 #ifdef ENABLE_LOGGING
779 LogDryWetProcess(
string.Format(
"%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
785 #ifdef ENABLE_LOGGING
786 LogDryWetProcess(
string.Format(
"%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
790 pItem.AddWet(soakingCoef);
792 if (pItem.GetInventory().GetCargo())
794 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
795 for (
int i = 0; i < inItemCount; ++i)
798 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
803 int attCount = pItem.GetInventory().AttachmentCount();
806 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
808 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
827 int attCount =
m_Player.GetInventory().AttachmentCount();
829 #ifdef ENABLE_LOGGING
838 distance =
Math.
Max(distance, 0.1);
840 #ifdef ENABLE_LOGGING
841 LogDryWetProcess(
string.Format(
"distance to heatsource: %1 m", distance));
845 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
847 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
848 if (attachment && attachment.IsItemBase())
861 #ifdef ENABLE_LOGGING
862 LogDryWetProcess(
"==========");
876 float dryingIncrement = pItem.GetDryingIncrement(
"player");
878 dryingIncrement = pItem.GetDryingIncrement(
"playerHeatSource");
881 bool isParentWet =
false;
882 bool parentContainsLiquid =
false;
885 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
896 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
897 parentContainsLiquid =
true;
905 float dryingCoef = 0;
907 if (!isParentWet && !parentContainsLiquid)
913 #ifdef ENABLE_LOGGING
914 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
916 pItem.AddWet(dryingCoef);
919 if (pItem.GetInventory().GetCargo())
921 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
922 for (
int i = 0; i < inItemCount; ++i)
925 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
930 int attCount = pItem.GetInventory().AttachmentCount();
933 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
935 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
937 if (
ItemBase.CastTo(itemAtt, attachment))
943 if (parentContainsLiquid)
947 #ifdef ENABLE_LOGGING
948 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);
950 pItem.AddWet(dryingCoef);
957 #ifdef ENABLE_LOGGING
958 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef /
GameConstants.
ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
960 pItem.AddWet(dryingCoef);
975 float hcBodyPartTotal, hcBodyPart;
976 float hBodyPartTotal, hBodyPart;
978 float heatComfortSum = 0.0;
979 float heatItems = 0.0;
981 #ifdef ENABLE_LOGGING
982 LogItemHeat(
"====================");
985 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
987 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
989 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
991 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
993 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
995 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
997 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
999 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1001 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
1010 heatItems = hBodyPartTotal;
1011 heatComfortSum = hcBodyPartTotal;
1012 heatComfortSum += hcPenaltyTotal;
1016 if (
m_Player.GetStomach().GetStomachVolume() > 0.0)
1018 float stomachContentTemperature =
m_Player.GetStomach().GetStomachTemperature();
1026 stomachContentTemperature,
1036 stomachContentTemperature,
1040 stomachContentTemperature = 0.0;
1054 targetHeatComfort =
Math.
Clamp(targetHeatComfort, 0.0,
m_Player.GetStatHeatComfort().GetMax());
1056 targetHeatComfort =
Math.
Clamp(targetHeatComfort,
m_Player.GetStatHeatComfort().GetMin(),
m_Player.GetStatHeatComfort().GetMax());
1058 targetHeatComfort =
Math.
Round(targetHeatComfort * 100) * 0.01;
1060 float dynamicHeatComfort;
1063 float direction = 1.0;
1064 if (targetHeatComfort < 0.0)
1073 dynamicHeatComfort =
Math.
Round(dynamicHeatComfort * 100) * 0.01;
1090 float targetHeatComfort = 0.0;
1096 m_Player.GetStatHeatComfort().Set(dynamicHeatComfort);
1111 m_Player.SetHeatBufferDynamicMax(heatBufferMax);
1119 heatBuffer.Add(-heatBufferValueCorrection);
1123 float increaseRate = 0.0;
1124 float decreaseRate = 0.0;
1130 float decreaseRateByHeatBufferStageCoef = 1;
1135 switch (
m_Player.GetHeatBufferStage())
1138 decreaseRateByHeatBufferStageCoef =
Math.
Lerp(
1141 heatBufferMaxInversed,
1145 decreaseRateByHeatBufferStageCoef =
Math.
Lerp(
1148 heatBufferMaxInversed,
1158 decreaseRate *= decreaseRateByHeatBufferStageCoef;
1169 heatBuffer.Add(-decreaseRate);
1176 if (applicableHeatbuffer > 0.0)
1177 heatBuffer.Add(-decreaseRate);
1178 else if (applicableHeatbuffer != 0.0 && !
m_Player.GetModifiersManager().IsModifierActive(
eModifiers.MDF_HEATBUFFER))
1179 heatBuffer.Set(0.0);
1186 if (applicableHeatbuffer < heatBufferMax)
1188 heatBuffer.Add(increaseRate);
1192 else if (applicableHeatbuffer > 0.0)
1193 heatBuffer.Add(-decreaseRate);
1194 else if (applicableHeatbuffer != 0.0 && !
m_Player.GetModifiersManager().IsModifierActive(
eModifiers.MDF_HEATBUFFER))
1195 heatBuffer.Set(0.0);
1205 float applicableHeatbuffer =
Math.
Round((heatBuffer.Get() / heatBuffer.GetMax()) * 1000) * 0.001;
1207 return applicableHeatbuffer;
1221 int attCount =
m_Player.GetInventory().AttachmentCount();
1222 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1224 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1226 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1229 for (
int i = 0; i < pBodyPartIds.Count(); ++i)
1231 if (attachmentSlot == pBodyPartIds[i])
1233 float heatPermCoef = item.GetHeatPermeabilityCoef();
1252 float heatPermCoef = item.GetHeatPermeabilityCoef();
1263 float heatPermCoef = heatPermeabilityCoef;
1266 int inventoryAttCount = item.GetInventory().AttachmentCount();
1267 if (inventoryAttCount > 0)
1270 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1272 if (
Class.
CastTo(attachmentItem,item.GetInventory().GetAttachmentFromIndex(inAttIdx)))
1274 heatPermCoef = heatPermeabilityCoef;
1275 heatPermCoef *= attachmentItem.GetHeatPermeabilityCoef();
1287 if (item.GetInventory().GetCargo())
1289 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1290 if (inventoryItemCount > 0)
1293 for (
int j = 0; j < inventoryItemCount; ++j)
1295 if (
Class.
CastTo(inventoryItem,item.GetInventory().GetCargo().GetItem(j)))
1297 heatPermCoef = heatPermeabilityCoef;
1298 heatPermCoef *= inventoryItem.GetHeatPermeabilityCoef();
1315 bool globalCooling =
true;
1321 globalCooling =
false;
1324 if (item.GetTemperature() != targetTemperature || !item.IsFreezeThawProgressFinished())
1326 TemperatureDataInterpolated temperatureData =
new TemperatureDataInterpolated(
1331 heatPermeabilityCoef,
1333 temperatureData.m_UseGlobalCooling = globalCooling;
1335 item.SetTemperatureEx(temperatureData);
1358 int attCount =
m_Player.GetInventory().AttachmentCount();
1359 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1361 EntityAI attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1362 if (attachment.IsClothing())
1365 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1367 if (attachmentSlot == pBodyPartId)
1369 #ifdef ENABLE_LOGGING
1373 float itemHeatcomfort = 0;
1374 float itemTemperature = 0;
1377 int inventoryAttCount = item.GetInventory().AttachmentCount();
1378 if (inventoryAttCount > 0)
1380 #ifdef ENABLE_LOGGING
1381 LogItemHeat(
string.Format(
"attachments:"),
false);
1383 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1385 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1387 if (attachmentItem && attachmentItem.CanHaveTemperature())
1389 itemTemperature = attachmentItem.GetTemperature();
1392 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1393 #ifdef ENABLE_LOGGING
1394 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat),
true);
1396 pHeat += itemHeatcomfort;
1401 if (item.GetInventory().GetCargo())
1403 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1405 if (inventoryItemCount > 0)
1407 #ifdef ENABLE_LOGGING
1408 LogItemHeat(
string.Format(
"cargo:"),
false);
1410 for (
int j = 0; j < inventoryItemCount; ++j)
1412 ItemBase inventoryItem =
ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1413 if (inventoryItem && inventoryItem.CanHaveTemperature())
1415 itemTemperature = inventoryItem.GetTemperature();
1418 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1419 #ifdef ENABLE_LOGGING
1420 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort),
true);
1422 pHeat += itemHeatcomfort;
1429 pHeatComfort = MiscGameplayFunctions.GetCurrentItemHeatIsolation(item) * pCoef;
1431 #ifdef ENABLE_LOGGING
1432 LogItemHeat(
string.Format(
"overall heat from items=%1 (coef applied)", pHeat));
1450 float penalty = 0.0;
1481 foreach (
EntityAI nearestEntity : nearestObjects)
1483 if (nearestEntity.IsUniversalTemperatureSource() && nearestEntity !=
m_Player)
1486 if (!nearestEntity.GetUniversalTemperatureSource().GetLambda().AffectsPlayer())
1497 if (
m_Player.GetItemInHands() &&
m_Player.GetItemInHands().IsUniversalTemperatureSource())
1521 float itemCoefAverage = 0.0;
1525 itemCoefAverage += tempSource.GetTemperatureItemCoef();
1527 itemCoefAverage /= UTScount;
1530 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
1531 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
1533 if (max > 0 && min < 0)
1572 distance =
Math.
Max(distance, 0.1);
1573 float temperature = 0;
1576 if (distance > uts.GetFullRange())
1578 float distFactor =
Math.
InverseLerp(uts.GetMaxRange(), uts.GetFullRange(), distance);
1579 temperature = uts.GetTemperatureCap() * distFactor;
1583 temperature = uts.GetTemperatureCap();
1592 #ifdef DIAG_DEVELOPER
1593 EnvDebugData GetEnvDebugData()
1595 EnvDebugData data =
new EnvDebugData();
1600 void ShowEnvDebugPlayerInfo(
bool enabled)
1602 EnvDebugData data = GetEnvDebugData();
1603 DisplayEnvDebugPlayerInfo(enabled, data);
1606 static void DisplayEnvDebugPlayerInfo(
bool enabled, EnvDebugData data)
1616 DbgUI.Text(
string.Format(
"Heat comfort(target): %1", data.m_PlayerData.m_HeatComfortTarget));
1617 DbgUI.Text(
string.Format(
"Heat comfort(dynamic): %1", data.m_PlayerData.m_HeatComfortDynamic));
1618 DbgUI.Text(
string.Format(
"Inside: %1 (%2)", data.m_PlayerData.m_Inside, data.m_PlayerData.m_Surface));
1619 DbgUI.Text(
string.Format(
"Under roof: %1 (%2)", data.m_PlayerData.m_UnderRoof, data.m_PlayerData.m_UnderRoofTimer));
1620 if ( data.m_PlayerData.m_WaterLevel > 0 )
1622 DbgUI.Text(
string.Format(
"Water Level: %1", data.m_PlayerData.m_WaterLevel));
1631 DbgUI.Text(
string.Format(
"Env temperature (base): %1", data.m_MiscData.m_TemperatureBase));
1632 DbgUI.Text(
string.Format(
"Env temperature (height corrected): %1", data.m_MiscData.m_HeightCorrectedTemperature));
1633 DbgUI.Text(
string.Format(
"Env temperature (modfied): %1", data.m_MiscData.m_TemperatureModified));
1634 DbgUI.Text(
string.Format(
"Wind magnitude(surface mult): %1 (x%2)", data.m_WeatherData.m_Wind, data.m_WeatherData.m_WindModifier));
1635 DbgUI.Text(
string.Format(
"Rain: %1", data.m_WeatherData.m_Rain));
1636 DbgUI.Text(
string.Format(
"Snow: %1", data.m_WeatherData.m_Snowfall));
1637 DbgUI.Text(
string.Format(
"Datetime: %1", WorldDataDaytime.ToString(
g_Game.GetMission().GetWorldData().GetDaytime())));
1638 DbgUI.Text(
string.Format(
"Fog: %1", data.m_WeatherData.m_Fog));
1639 DbgUI.Text(
string.Format(
"Clouds: %1", data.m_WeatherData.m_Clouds));
1640 DbgUI.Text(
string.Format(
"Wet delta: %1", data.m_MiscData.m_WetDelta));
1645 void FillDebugWeatherData(EnvDebugWeatherData data)
1659 message +=
"Player stats";
1661 message +=
"\nHeat comfort(dynamic): " +
m_HeatComfort.ToString();
1664 string impact, surfaceType;
1665 g_Game.SurfaceUnderObjectExCorrectedLiquid(
m_Player, surfaceType, impact, liquidType);
1668 message +=
"\nSurface: " + surfaceType;
1669 message +=
"\nLiquid: " + liquidType;
1676 message +=
"\n\nWeather stats";
1677 message +=
"\nEnv temperature (base): " +
m_WorldData.GetBaseEnvTemperature().ToString();
1678 message +=
"\nEnv temperature (height corrected): " +
m_WorldData.GetBaseEnvTemperatureAtObject(
m_Player);
1681 message +=
"\nRain: " +
m_Rain.ToString();
1682 message +=
"\nSnow: " +
m_Snowfall.ToString();
1684 message +=
"\nFog: " +
m_Fog.ToString();
1685 message +=
"\nClouds: " +
m_Clouds.ToString();
1708 if (temperature >= lowerLimit && temperature <= upperLimit)
1729 #ifdef ENABLE_LOGGING
1730 private void LogDryWetProcess(
string message,
bool indented =
false)
1732 if (m_DebugLogDryWet)
1734 string indentation =
"";
1736 indentation =
"|--";
1738 Debug.Log(
string.Format(
"%1 %2", indentation, message));
1743 #ifdef ENABLE_LOGGING
1744 private void LogItemHeat(
string message,
bool indented =
false)
1746 if (m_DebugLogItemHeat)
1748 string indentation =
"";
1750 indentation =
"|--";
1752 Debug.Log(
string.Format(
"%1 %2", indentation, message));
1787 return temperature_reduction;
1796 if (pBodyPartIds.Count() > 0)
1798 #ifdef ENABLE_LOGGING
1802 int attCount =
m_Player.GetInventory().AttachmentCount();
1803 for (
int attIdx = 0; attIdx < attCount; ++attIdx)
1805 EntityAI attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1806 if (attachment.IsClothing())
1809 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1812 for (
int i = 0; i < pBodyPartIds.Count(); ++i)
1814 if (attachmentSlot == pBodyPartIds[i])
1816 float heatIsoMult = 1.0;
1822 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
1824 float itemHeatcomfort = 0;
1825 float itemTemperature = 0;
1828 int inventoryAttCount = item.GetInventory().AttachmentCount();
1829 if (inventoryAttCount > 0)
1831 #ifdef ENABLE_LOGGING
1832 LogItemHeat(
string.Format(
"attachments:"),
false);
1834 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1836 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1838 if (attachmentItem && attachmentItem.CanHaveTemperature())
1840 itemTemperature = attachmentItem.GetTemperature();
1843 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1844 #ifdef ENABLE_LOGGING
1845 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat),
true);
1846 pHeat += itemHeatcomfort;
1852 if (item.GetInventory().GetCargo())
1854 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1856 if (inventoryItemCount > 0)
1858 #ifdef ENABLE_LOGGING
1859 LogItemHeat(
string.Format(
"cargo:"),
false);
1861 for (
int j = 0; j < inventoryItemCount; ++j)
1863 ItemBase inventoryItem =
ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1864 if (inventoryItem && inventoryItem.CanHaveTemperature())
1866 itemTemperature = inventoryItem.GetTemperature();
1869 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1870 #ifdef ENABLE_LOGGING
1871 LogItemHeat(
string.Format(
"%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort),
true);
1873 pHeat += itemHeatcomfort;
1884 pHeatComfort += (pHeatComfort / pBodyPartIds.Count()) * pCoef;
1886 #ifdef ENABLE_LOGGING
1887 LogItemHeat(
string.Format(
"overall heat from items=%1 (coef applied)", pHeat));
1895 EnvironmentSnapshotData data =
new EnvironmentSnapshotData();
1932#ifdef DIAG_DEVELOPER
1933class EnvDebugPlayerData :
Param
1935 float m_HeatComfortDynamic;
1936 float m_HeatComfortTarget;
1940 int m_UnderRoofTimer;
1945 m_HeatComfortTarget = env.GetTargetHeatComfort();
1946 m_HeatComfortDynamic = player.GetStatHeatComfort().Get();
1947 m_Inside = env.IsInsideBuilding();
1949 m_UnderRoof = env.IsUnderRoof();
1950 m_UnderRoofTimer = env.GetNextRoofCheck();
1966class EnvDebugMiscData :
Param
1968 float m_TemperatureBase;
1969 float m_TemperatureModified;
1970 float m_HeightCorrectedTemperature;
1975 m_TemperatureBase =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
1976 m_TemperatureModified = env.GetTemperature();
1977 m_HeightCorrectedTemperature = m_TemperatureBase - env.GetTemperatureHeightCorrection();
1978 m_WetDelta = env.GetWetDelta();
1983 return ctx.
Write(m_TemperatureBase) && ctx.
Write(m_TemperatureModified) && ctx.
Write(m_HeightCorrectedTemperature) && ctx.
Write(m_WetDelta);
1988 return ctx.
Read(m_TemperatureBase) && ctx.
Read(m_TemperatureModified) && ctx.
Read(m_HeightCorrectedTemperature) && ctx.
Read(m_WetDelta);
1992class EnvDebugWeatherData :
Param
1995 float m_WindModifier;
2003 env.FillDebugWeatherData(
this);
2017class EnvDebugData :
Param
2019 ref EnvDebugPlayerData m_PlayerData =
new EnvDebugPlayerData();
2020 ref EnvDebugMiscData m_MiscData =
new EnvDebugMiscData();
2021 ref EnvDebugWeatherData m_WeatherData =
new EnvDebugWeatherData();
2025 m_PlayerData.Synch(env, player);
2026 m_MiscData.Synch(env);
2027 m_WeatherData.Synch(env);
2032 return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
2037 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
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
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.
class JsonUndergroundAreaTriggerData GetPosition