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

◆ BodyPartHeatProperties() [2/2]

void BodyPartHeatProperties ( int pBodyPartId,
float pCoef,
out float pHeatComfort,
out float pHeat )
protected

Iterate through given body part and calculates heatcofort and item heat value.

Аргументы
pBodyPartIdsList of body parts to iterate through (see InventorySlots)
pCoefMultiplier used for heatcomfort enhancing
[out]pHeatComfortoverall heatcomfort from items of given body part
[out]pHeatoverall heat from items for given body part

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

1354 {
1355 pHeatComfort = 0;
1356 pHeat = 0;
1357
1358 int attCount = m_Player.GetInventory().AttachmentCount();
1359 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1360 {
1361 EntityAI attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1362 if (attachment.IsClothing())
1363 {
1364 ItemBase item = ItemBase.Cast(attachment);
1365 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1366
1367 if (attachmentSlot == pBodyPartId)
1368 {
1369 #ifdef ENABLE_LOGGING
1370 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartId)));
1371 #endif
1372
1373 float itemHeatcomfort = 0;
1374 float itemTemperature = 0;
1375
1376 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1377 int inventoryAttCount = item.GetInventory().AttachmentCount();
1378 if (inventoryAttCount > 0)
1379 {
1380 #ifdef ENABLE_LOGGING
1381 LogItemHeat(string.Format("attachments:"), false);
1382 #endif
1383 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1384 {
1385 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1386 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1387 if (attachmentItem && attachmentItem.CanHaveTemperature())
1388 {
1389 itemTemperature = attachmentItem.GetTemperature();
1390 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1391 {
1392 itemHeatcomfort = NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1393 #ifdef ENABLE_LOGGING
1394 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1395 #endif
1396 pHeat += itemHeatcomfort;
1397 }
1398 }
1399 }
1400 }
1401 if (item.GetInventory().GetCargo())
1402 {
1403 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1404
1405 if (inventoryItemCount > 0)
1406 {
1407 #ifdef ENABLE_LOGGING
1408 LogItemHeat(string.Format("cargo:"), false);
1409 #endif
1410 for (int j = 0; j < inventoryItemCount; ++j)
1411 {
1412 ItemBase inventoryItem = ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1413 if (inventoryItem && inventoryItem.CanHaveTemperature())
1414 {
1415 itemTemperature = inventoryItem.GetTemperature();
1416 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1417 {
1418 itemHeatcomfort = NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1419 #ifdef ENABLE_LOGGING
1420 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1421 #endif
1422 pHeat += itemHeatcomfort;
1423 }
1424 }
1425 }
1426 }
1427 }
1428
1429 pHeatComfort = MiscGameplayFunctions.GetCurrentItemHeatIsolation(item) * pCoef;
1430
1431 #ifdef ENABLE_LOGGING
1432 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1433 LogItemHeat("");
1434 #endif
1435
1436 break;
1437 }
1438 }
1439 }
1440 }
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 ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT
Определения 3_Game/constants.c:804

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

Используется в ProcessHeatComfort().