873 {
874 if (pItem)
875 {
876 float dryingIncrement = pItem.GetDryingIncrement("player");
878 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
879
881 bool isParentWet = false;
882 bool parentContainsLiquid = false;
883
885 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
886 {
888 if (parent)
889 {
891 if (parentItem)
892 {
894 isParentWet = true;
895
896 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
897 parentContainsLiquid = true;
898 }
899
902 }
903 }
904
905 float dryingCoef = 0;
906
907 if (!isParentWet && !parentContainsLiquid)
908 {
909
912 {
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);
915 #endif
916 pItem.AddWet(dryingCoef);
917 }
918
919 if (pItem.GetInventory().GetCargo())
920 {
921 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
922 for (int i = 0; i < inItemCount; ++i)
923 {
925 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
927 }
928 }
929
930 int attCount = pItem.GetInventory().AttachmentCount();
931 if (attCount > 0)
932 {
933 for (int attIdx = 0; attIdx < attCount; ++attIdx)
934 {
935 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
937 if (
ItemBase.CastTo(itemAtt, attachment))
939 }
940 }
941 }
942
943 if (parentContainsLiquid)
944 {
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);
949 #endif
950 pItem.AddWet(dryingCoef);
951 }
952
953 if (isParentWet)
954 {
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);
959 #endif
960 pItem.AddWet(dryingCoef);
961 }
962 }
963 }
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
Super root of all classes in Enforce script.
float m_TemperatureSourceDistance
bool m_UseTemperatureSources
proto native EntityAI GetParent()
returns parent of current inventory location
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float ENVIRO_TICK_RATE
const float STATE_SOAKING_WET