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

◆ ApplyDrynessToItemEx()

void ApplyDrynessToItemEx ( ItemBase pItem,
EnvironmentDrynessData pDrynessData )
protected

adds wetness to item inside parent item containing liquid

adds wetness to item inside wet parent item

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

873 {
874 if (pItem)
875 {
876 float dryingIncrement = pItem.GetDryingIncrement("player");
877 if (pDrynessData.m_UseTemperatureSources)
878 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
879
880 ItemBase parentItem;
881 bool isParentWet = false;
882 bool parentContainsLiquid = false;
883
885 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
886 {
887 EntityAI parent = iLoc.GetParent();
888 if (parent)
889 {
890 parentItem = ItemBase.Cast(parent);
891 if (parentItem)
892 {
893 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
894 isParentWet = true;
895
896 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
897 parentContainsLiquid = true;
898 }
899
900 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
901 m_ItemsWetnessMax = pItem.GetWet();
902 }
903 }
904
905 float dryingCoef = 0;
906
907 if (!isParentWet && !parentContainsLiquid)
908 {
909
910 dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
911 if (pItem.GetWet() >= GameConstants.STATE_DAMP)
912 {
913 #ifdef ENABLE_LOGGING
914 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
915 #endif
916 pItem.AddWet(dryingCoef);
917 }
918
919 if (pItem.GetInventory().GetCargo())
920 {
921 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
922 for (int i = 0; i < inItemCount; ++i)
923 {
924 ItemBase inItem;
925 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
926 ApplyDrynessToItemEx(inItem, pDrynessData);
927 }
928 }
929
930 int attCount = pItem.GetInventory().AttachmentCount();
931 if (attCount > 0)
932 {
933 for (int attIdx = 0; attIdx < attCount; ++attIdx)
934 {
935 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
936 ItemBase itemAtt;
937 if (ItemBase.CastTo(itemAtt, attachment))
938 ApplyDrynessToItemEx(itemAtt, pDrynessData);
939 }
940 }
941 }
942
943 if (parentContainsLiquid)
944 {
946 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
947 #ifdef ENABLE_LOGGING
948 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);
949 #endif
950 pItem.AddWet(dryingCoef);
951 }
952
953 if (isParentWet)
954 {
956 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
957 #ifdef ENABLE_LOGGING
958 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
959 #endif
960 pItem.AddWet(dryingCoef);
961 }
962 }
963 }
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
Определения Environment.c:872
float m_ItemsWetnessMax
Определения Environment.c:39
DayZPlayer m_Player
Определения Hand_Events.c:42
Super root of all classes in Enforce script.
Определения EnScript.c:11
float m_TemperatureSourceDistance
Определения Environment.c:19
bool m_UseTemperatureSources
Определения Environment.c:18
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_DAMP
Определения 3_Game/constants.c:875
const float STATE_SOAKING_WET
Определения 3_Game/constants.c:873

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

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