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

◆ BodyPartHeatProperties() [1/2]

void BodyPartHeatProperties ( array< int > pBodyPartIds,
float pCoef,
out float pHeatComfort,
out float pHeat )
protected

returns weighted avg heat comfort for bodypart

go through all body parts we've defined for that zone (ex.: head, body, feet)

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

1792 {
1793 pHeatComfort = 0;
1794 pHeat = 0;
1795
1796 if (pBodyPartIds.Count() > 0)
1797 {
1798 #ifdef ENABLE_LOGGING
1799 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartIds[0])));
1800 #endif
1801
1802 int attCount = m_Player.GetInventory().AttachmentCount();
1803 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1804 {
1805 EntityAI attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1806 if (attachment.IsClothing())
1807 {
1808 ItemBase item = ItemBase.Cast(attachment);
1809 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1810
1812 for (int i = 0; i < pBodyPartIds.Count(); ++i)
1813 {
1814 if (attachmentSlot == pBodyPartIds[i])
1815 {
1816 float heatIsoMult = 1.0;
1817 if (attachmentSlot == InventorySlots.BACK)
1819 else if (attachmentSlot == InventorySlots.VEST)
1821
1822 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
1823
1824 float itemHeatcomfort = 0;
1825 float itemTemperature = 0;
1826
1827 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1828 int inventoryAttCount = item.GetInventory().AttachmentCount();
1829 if (inventoryAttCount > 0)
1830 {
1831 #ifdef ENABLE_LOGGING
1832 LogItemHeat(string.Format("attachments:"), false);
1833 #endif
1834 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1835 {
1836 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1837 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1838 if (attachmentItem && attachmentItem.CanHaveTemperature())
1839 {
1840 itemTemperature = attachmentItem.GetTemperature();
1841 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1842 {
1843 itemHeatcomfort = NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1844 #ifdef ENABLE_LOGGING
1845 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1846 pHeat += itemHeatcomfort;
1847 #endif
1848 }
1849 }
1850 }
1851 }
1852 if (item.GetInventory().GetCargo())
1853 {
1854 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1855
1856 if (inventoryItemCount > 0)
1857 {
1858 #ifdef ENABLE_LOGGING
1859 LogItemHeat(string.Format("cargo:"), false);
1860 #endif
1861 for (int j = 0; j < inventoryItemCount; ++j)
1862 {
1863 ItemBase inventoryItem = ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1864 if (inventoryItem && inventoryItem.CanHaveTemperature())
1865 {
1866 itemTemperature = inventoryItem.GetTemperature();
1867 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1868 {
1869 itemHeatcomfort = NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1870 #ifdef ENABLE_LOGGING
1871 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1872 #endif
1873 pHeat += itemHeatcomfort;
1874 }
1875 }
1876 }
1877 }
1878 }
1879 }
1880 }
1881 }
1882 }
1883
1884 pHeatComfort += (pHeatComfort / pBodyPartIds.Count()) * pCoef;
1885
1886 #ifdef ENABLE_LOGGING
1887 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1888 LogItemHeat("");
1889 #endif
1890 }
1891 }
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
Определения Environment.c:1714
DayZPlayer m_Player
Определения Hand_Events.c:42
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Определения EnConvert.c:601
Определения EnConvert.c:590
provides access to slot configuration
Определения InventorySlots.c:6
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
Определения 3_Game/constants.c:1096
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
Определения 3_Game/constants.c:1095
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT
Определения 3_Game/constants.c:804

Перекрестные ссылки EnumTools::EnumToString(), GameConstants::ENVIRO_HEATISOLATION_BACK_WEIGHT, GameConstants::ENVIRO_HEATISOLATION_VEST_WEIGHT, GameConstants::ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT, m_Player и NormalizedTemperature().