DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ApplyWetnessToItem()

void ApplyWetnessToItem ( ItemBase pItem)
protected

См. определение в файле Environment.c строка 732

733 {
734 if (pItem)
735 {
736 ItemBase parentItem;
737 bool isParentWet = false;
738 bool parentContainsLiquid = false;
740
741 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
742 {
743 EntityAI parent = iLoc.GetParent();
744 if (parent)
745 {
746 parentItem = ItemBase.Cast(parent);
747 if (parentItem)
748 {
749 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
750 isParentWet = true;
751
752 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
753 parentContainsLiquid = true;
754 }
755 else
756 isParentWet = true;
757
758 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
759 m_ItemsWetnessMax = pItem.GetWet();
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())
776 soakingCoef = GetWetDelta();
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 {
784 soakingCoef = GetWetDelta();
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 {
797 ItemBase inItem;
798 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
799 ApplyWetnessToItem(inItem);
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);
809 ItemBase itemAtt = ItemBase.Cast(attachment);
810 if (itemAtt)
811 ApplyWetnessToItem(itemAtt);
812 }
813 }
814 }
815 }
816 }
float GetWetDelta()
Calculates soaking/drying delta based on character's location and weather.
Определения Environment.c:563
void ApplyWetnessToItem(ItemBase pItem)
Определения Environment.c:732
float m_ItemsWetnessMax
Определения Environment.c:39
DayZPlayer m_Player
Определения Hand_Events.c:42
Super root of all classes in Enforce script.
Определения EnScript.c:11
proto native EntityAI GetParent()
returns parent of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float ENVIRO_TICK_RATE
Определения 3_Game/constants.c:720
const float STATE_SOAKING_WET
Определения 3_Game/constants.c:873

Перекрестные ссылки ApplyWetnessToItem(), Class::CastTo(), GameConstants::ENVIRO_TICK_RATE, InventoryLocation::GetParent(), GetWetDelta(), m_ItemsWetnessMax, m_Player и GameConstants::STATE_SOAKING_WET.

Используется в ApplyWetnessToItem() и ProcessItemsWetness().