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

1357 {
1358 pHeatComfort = 0;
1359 pHeat = 0;
1360
1361 GameInventory playerInventory = m_Player.GetInventory();
1362 int attCount = playerInventory.AttachmentCount();
1363 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1364 {
1365 EntityAI attachment = playerInventory.GetAttachmentFromIndex(attIdx);
1366 if (attachment.IsClothing())
1367 {
1368 ItemBase item = ItemBase.Cast(attachment);
1369 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1370
1371 if (attachmentSlot == pBodyPartId)
1372 {
1373 #ifdef ENABLE_LOGGING
1374 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartId)));
1375 #endif
1376
1377 float itemHeatcomfort = 0;
1378 float itemTemperature = 0;
1379
1380 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1381 GameInventory itemInventory = item.GetInventory();
1382 int inventoryAttCount = itemInventory.AttachmentCount();
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 {
1390 EntityAI inAttachment = itemInventory.GetAttachmentFromIndex(inAttIdx);
1391 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1392 if (attachmentItem && attachmentItem.CanHaveTemperature())
1393 {
1394 itemTemperature = attachmentItem.GetTemperature();
1395 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
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
1407 CargoBase inventoryItemCargo = itemInventory.GetCargo();
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 {
1419 ItemBase inventoryItem = ItemBase.Cast(inventoryItemCargo.GetItem(j));
1420 if (inventoryItem && inventoryItem.CanHaveTemperature())
1421 {
1422 itemTemperature = inventoryItem.GetTemperature();
1423 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
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 }
map m_Player
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
Определения Environment.c:1721
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Определения EnConvert.c:614
Определения EnConvert.c:603
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
Определения InventorySlots.c:6
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT
Определения 3_Game/DayZ/constants.c:807

Перекрестные ссылки GameInventory::AttachmentCount(), EnumTools::EnumToString(), GameInventory::GetAttachmentFromIndex(), GameInventory::GetCargo(), CargoBase::GetItem(), CargoBase::GetItemCount(), GameConstants::ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT и NormalizedTemperature().

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