733 {
734 if (pItem)
735 {
737 bool isParentWet = false;
738 bool parentContainsLiquid = false;
740
741 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
742 {
744 if (parent)
745 {
747 if (parentItem)
748 {
750 isParentWet = true;
751
752 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
753 parentContainsLiquid = true;
754 }
755 else
756 isParentWet = true;
757
760 }
761 }
762
763 if (isParentWet || parentContainsLiquid)
764 {
765 float soakingCoef = 0;
766 if (parentContainsLiquid)
767 {
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);
771 #endif
772 }
773 else if (isParentWet && parentItem)
774 {
775 if (pItem.GetWet() < parentItem.GetWet())
777
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);
780 #endif
781 }
782 else
783 {
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);
787 #endif
788 }
789
790 pItem.AddWet(soakingCoef);
791
792 if (pItem.GetInventory().GetCargo())
793 {
794 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
795 for (int i = 0; i < inItemCount; ++i)
796 {
798 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
800 }
801 }
802
803 int attCount = pItem.GetInventory().AttachmentCount();
804 if (attCount > 0)
805 {
806 for (int attIdx = 0; attIdx < attCount; ++attIdx)
807 {
808 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
810 if (itemAtt)
812 }
813 }
814 }
815 }
816 }
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