DayZ 1.29
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 строка 875

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

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

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