876 {
877 if (pItem)
878 {
879 float dryingIncrement = pItem.GetDryingIncrement("player");
881 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
882
884 bool isParentWet = false;
885 bool parentContainsLiquid = false;
886
888 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
889 {
891 if (parent)
892 {
894 if (parentItem)
895 {
897 isParentWet = true;
898
899 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
900 parentContainsLiquid = true;
901 }
902
905 }
906 }
907
908 float dryingCoef = 0;
909
910 if (!isParentWet && !parentContainsLiquid)
911 {
912
915 {
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);
918 #endif
919 pItem.AddWet(dryingCoef);
920 }
921
922 if (pItem.GetInventory().GetCargo())
923 {
924 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
925 for (int i = 0; i < inItemCount; ++i)
926 {
928 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
930 }
931 }
932
933 int attCount = pItem.GetInventory().AttachmentCount();
934 if (attCount > 0)
935 {
936 for (int attIdx = 0; attIdx < attCount; ++attIdx)
937 {
938 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
940 if (
ItemBase.CastTo(itemAtt, attachment))
942 }
943 }
944 }
945
946 if (parentContainsLiquid)
947 {
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);
952 #endif
953 pItem.AddWet(dryingCoef);
954 }
955
956 if (isParentWet)
957 {
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);
962 #endif
963 pItem.AddWet(dryingCoef);
964 }
965 }
966 }
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