From cc488477fbd69366f1c45b4c0066070c25d4b647 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 27 Nov 2023 17:01:38 +0000 Subject: [PATCH] Logging improvements --- project/src/generators/BotLootGenerator.ts | 3 ++- project/src/helpers/BotWeaponGeneratorHelper.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index 8e69be4c..6f80b2e7 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -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; } diff --git a/project/src/helpers/BotWeaponGeneratorHelper.ts b/project/src/helpers/BotWeaponGeneratorHelper.ts index 3c370f41..011a5a05 100644 --- a/project/src/helpers/BotWeaponGeneratorHelper.ts +++ b/project/src/helpers/BotWeaponGeneratorHelper.ts @@ -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);