749 {
750 if (pItem)
751 {
752 float dryingIncrement = pItem.GetDryingIncrement("player");
753 if (pDrynessData.m_UseTemperatureSources)
754 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
755
757 bool isParentWet = false;
758 bool parentContainsLiquid = false;
759
760 InventoryLocation iLoc = new InventoryLocation();
761 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
762 {
764 if (parent)
765 {
767 if (parentItem)
768 {
769 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
770 isParentWet = true;
771
772 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
773 parentContainsLiquid = true;
774 }
775
778 }
779 }
780
781 float dryingCoef = 0;
782
783 if (!isParentWet && !parentContainsLiquid)
784 {
785
786 dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
787 if (pItem.GetWet() >= GameConstants.STATE_DAMP)
788 {
789 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
790 pItem.AddWet(dryingCoef);
791 }
792
793 if (pItem.GetInventory().GetCargo())
794 {
795 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
796 for (int i = 0; i < inItemCount; ++i)
797 {
799 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
801 }
802 }
803
804 int attCount = pItem.GetInventory().AttachmentCount();
805 if (attCount > 0)
806 {
807 for (int attIdx = 0; attIdx < attCount; ++attIdx)
808 {
809 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
811 if (
ItemBase.CastTo(itemAtt, attachment))
813 }
814 }
815 }
816
817 if (parentContainsLiquid)
818 {
820 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
821 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);
822 pItem.AddWet(dryingCoef);
823 }
824
825 if (isParentWet)
826 {
828 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
829 LogDryWetProcess(
string.Format(
"%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
830 pItem.AddWet(dryingCoef);
831 }
832 }
833 }
class GP5GasMask extends MaskBase ItemBase
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
void LogDryWetProcess(string message, bool indented=false)
proto native EntityAI GetParent()
returns parent of current inventory location