Logging improvements

This commit is contained in:
Dev 2023-11-27 17:01:38 +00:00
parent 58e6cc8cd7
commit cc488477fb
2 changed files with 10 additions and 8 deletions

View File

@ -366,7 +366,7 @@ export class BotLootGenerator
if (fitItemIntoContainerAttempts >= 4)
{
this.logger.debug(
`Failed to place item ${i} of ${totalItemCount} item into ${botRole} container: ${equipmentSlots}, ${fitItemIntoContainerAttempts} times. ${ItemAddedResult[itemAddedResult]}, skipping`,
`Failed to place item ${i} of ${totalItemCount} items into ${botRole} containers: ${equipmentSlots.join(",")}. Tried ${fitItemIntoContainerAttempts} times, reason: ${ItemAddedResult[itemAddedResult]}, skipping`,
);
break;
@ -374,6 +374,7 @@ export class BotLootGenerator
}
else
{
// Reset counter
fitItemIntoContainerAttempts = 0;
}

View File

@ -180,16 +180,16 @@ export class BotWeaponGeneratorHelper
const container = inventory.items.find((i) => i.slotId === slot);
if (!container)
{
// Desired equipment container (e.g. backpack) not found
this.logger.debug(
`Unable to add item: ${
itemWithChildren[0]._tpl
} to: ${slot}, slot missing/bot generated without item in slot`,
);
missingContainerCount++;
if (missingContainerCount === equipmentSlots.length)
{
// Bot doesnt have any containers
this.logger.debug(
`Unable to add item: ${
itemWithChildren[0]._tpl
} to bot as it lacks the following containers: ${equipmentSlots.join(",")}`,
);
return ItemAddedResult.NO_CONTAINERS
}
@ -210,6 +210,7 @@ export class BotWeaponGeneratorHelper
// Container has no slots to hold items
continue;
}
// Get x/y grid size of item
const itemSize = this.inventoryHelper.getItemSize(parentTpl, parentId, itemWithChildren);