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

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

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