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

◆ BodyPartHeatProperties() [1/2]

void Environment::BodyPartHeatProperties ( array< int > pBodyPartIds,
float pCoef,
out float pHeatComfort,
out float pHeat )
inlineprotected

returns weighted avg heat comfort for bodypart

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

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

1591 {
1592 pHeatComfort = 0;
1593 pHeat = 0;
1594
1595 if (pBodyPartIds.Count() > 0)
1596 {
1597 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartIds[0])));
1598
1599 int attCount = m_Player.GetInventory().AttachmentCount();
1600 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1601 {
1602 EntityAI attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1603 if (attachment.IsClothing())
1604 {
1605 ItemBase item = ItemBase.Cast(attachment);
1606 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1607
1609 for (int i = 0; i < pBodyPartIds.Count(); ++i)
1610 {
1611 if (attachmentSlot == pBodyPartIds[i])
1612 {
1613 float heatIsoMult = 1.0;
1614 if (attachmentSlot == InventorySlots.BACK)
1615 heatIsoMult = GameConstants.ENVIRO_HEATISOLATION_BACK_WEIGHT;
1616 else if (attachmentSlot == InventorySlots.VEST)
1617 heatIsoMult = GameConstants.ENVIRO_HEATISOLATION_VEST_WEIGHT;
1618
1619 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
1620
1621 float itemHeatcomfort = 0;
1622 float itemTemperature = 0;
1623
1624 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1625 int inventoryAttCount = item.GetInventory().AttachmentCount();
1626 if (inventoryAttCount > 0)
1627 {
1628 LogItemHeat(string.Format("attachments:"), false);
1629 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1630 {
1631 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1632 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1633 if (attachmentItem && attachmentItem.CanHaveTemperature())
1634 {
1635 itemTemperature = attachmentItem.GetTemperature();
1636 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1637 {
1638 itemHeatcomfort = NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1639 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1640 pHeat += itemHeatcomfort;
1641 }
1642 }
1643 }
1644 }
1645 if (item.GetInventory().GetCargo())
1646 {
1647 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1648
1649 if (inventoryItemCount > 0)
1650 {
1651 LogItemHeat(string.Format("cargo:"), false);
1652 for (int j = 0; j < inventoryItemCount; ++j)
1653 {
1654 ItemBase inventoryItem = ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1655 if (inventoryItem && inventoryItem.CanHaveTemperature())
1656 {
1657 itemTemperature = inventoryItem.GetTemperature();
1658 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1659 {
1660 itemHeatcomfort = NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1661 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1662 pHeat += itemHeatcomfort;
1663 }
1664 }
1665 }
1666 }
1667 }
1668 }
1669 }
1670 }
1671 }
1672
1673 pHeatComfort += (pHeatComfort / pBodyPartIds.Count()) * pCoef;
1674
1675 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1676 LogItemHeat("");
1677 }
1678 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
Определения Environment.c:1515
void LogItemHeat(string message, bool indented=false)
Определения Environment.c:1544
PlayerBase m_Player
Определения Environment.c:30

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