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

◆ ApplyDrynessToItemEx()

void Environment::ApplyDrynessToItemEx ( ItemBase pItem,
EnvironmentDrynessData pDrynessData )
inlineprotected

adds wetness to item inside parent item containing liquid

adds wetness to item inside wet parent item

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

749 {
750 if (pItem)
751 {
752 float dryingIncrement = pItem.GetDryingIncrement("player");
753 if (pDrynessData.m_UseTemperatureSources)
754 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
755
756 ItemBase parentItem;
757 bool isParentWet = false;
758 bool parentContainsLiquid = false;
759
760 InventoryLocation iLoc = new InventoryLocation();
761 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
762 {
763 EntityAI parent = iLoc.GetParent();
764 if (parent)
765 {
766 parentItem = ItemBase.Cast(parent);
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
776 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
777 m_ItemsWetnessMax = pItem.GetWet();
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 {
798 ItemBase inItem;
799 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
800 ApplyDrynessToItemEx(inItem, pDrynessData);
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);
810 ItemBase itemAtt;
811 if (ItemBase.CastTo(itemAtt, attachment))
812 ApplyDrynessToItemEx(itemAtt, pDrynessData);
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 LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
Определения Environment.c:748
PlayerBase m_Player
Определения Environment.c:30
float m_ItemsWetnessMax
Определения Environment.c:26
void LogDryWetProcess(string message, bool indented=false)
Определения Environment.c:1530
proto native EntityAI GetParent()
returns parent of current inventory location

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

Используется в ApplyDrynessToItem(), ApplyDrynessToItemEx() и ProcessItemsDryness().