Iterate through given body part and calculates heatcofort and item heat value.
1357 {
1358 pHeatComfort = 0;
1359 pHeat = 0;
1360
1363 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1364 {
1366 if (attachment.IsClothing())
1367 {
1369 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1370
1371 if (attachmentSlot == pBodyPartId)
1372 {
1373 #ifdef ENABLE_LOGGING
1375 #endif
1376
1377 float itemHeatcomfort = 0;
1378 float itemTemperature = 0;
1379
1380
1383 if (inventoryAttCount > 0)
1384 {
1385 #ifdef ENABLE_LOGGING
1386 LogItemHeat(string.Format("attachments:"), false);
1387 #endif
1388 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1389 {
1392 if (attachmentItem && attachmentItem.CanHaveTemperature())
1393 {
1394 itemTemperature = attachmentItem.GetTemperature();
1396 {
1397 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1398 #ifdef ENABLE_LOGGING
1399 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1400 #endif
1401 pHeat += itemHeatcomfort;
1402 }
1403 }
1404 }
1405 }
1406
1408 if (inventoryItemCargo)
1409 {
1410 int inventoryItemCount = inventoryItemCargo.
GetItemCount();
1411
1412 if (inventoryItemCount > 0)
1413 {
1414 #ifdef ENABLE_LOGGING
1415 LogItemHeat(string.Format("cargo:"), false);
1416 #endif
1417 for (int j = 0; j < inventoryItemCount; ++j)
1418 {
1420 if (inventoryItem && inventoryItem.CanHaveTemperature())
1421 {
1422 itemTemperature = inventoryItem.GetTemperature();
1424 {
1425 itemHeatcomfort =
NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1426 #ifdef ENABLE_LOGGING
1427 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1428 #endif
1429 pHeat += itemHeatcomfort;
1430 }
1431 }
1432 }
1433 }
1434 }
1435
1436 pHeatComfort = MiscGameplayFunctions.GetCurrentItemHeatIsolation(item) * pCoef;
1437
1438 #ifdef ENABLE_LOGGING
1439 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1440 LogItemHeat("");
1441 #endif
1442
1443 break;
1444 }
1445 }
1446 }
1447 }
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
proto native EntityAI GetAttachmentFromIndex(int index)
proto native CargoBase GetCargo()
cargo
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
provides access to slot configuration
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT