736 {
737 if (pItem)
738 {
740 bool isParentWet = false;
741 bool parentContainsLiquid = false;
743
744 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
745 {
747 if (parent)
748 {
750 if (parentItem)
751 {
753 isParentWet = true;
754
755 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
756 parentContainsLiquid = true;
757 }
758 else
759 isParentWet = true;
760
763 }
764 }
765
766 if (isParentWet || parentContainsLiquid)
767 {
768 float soakingCoef = 0;
769 if (parentContainsLiquid)
770 {
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);
774 #endif
775 }
776 else if (isParentWet && parentItem)
777 {
778 if (pItem.GetWet() < parentItem.GetWet())
780
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);
783 #endif
784 }
785 else
786 {
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);
790 #endif
791 }
792
793 pItem.AddWet(soakingCoef);
794
795 if (pItem.GetInventory().GetCargo())
796 {
797 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
798 for (int i = 0; i < inItemCount; ++i)
799 {
801 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
803 }
804 }
805
806 int attCount = pItem.GetInventory().AttachmentCount();
807 if (attCount > 0)
808 {
809 for (int attIdx = 0; attIdx < attCount; ++attIdx)
810 {
811 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
813 if (itemAtt)
815 }
816 }
817 }
818 }
819 }
float GetWetDelta()
Calculates soaking/drying delta based on character's location and weather.
void ApplyWetnessToItem(ItemBase pItem)
Super root of all classes in Enforce script.
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