diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 6cbad945..e55656ed 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -25,6 +25,7 @@ import { DatabaseService } from "@spt/services/DatabaseService"; import { LocalisationService } from "@spt/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService"; import { SeasonalEventService } from "@spt/services/SeasonalEventService"; +import { ProgressWriter } from "@spt/utils/ProgressWriter"; import { RandomUtil } from "@spt/utils/RandomUtil"; import { ICloner } from "@spt/utils/cloners/ICloner"; import { inject, injectable } from "tsyringe"; @@ -306,15 +307,17 @@ export class BotController { } // We're below desired count, add bots to cache + const progressWriter = new ProgressWriter(botGenerationDetails.botCountToGenerate); for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++) { const detailsClone = this.cloner.clone(botGenerationDetails); botPromises.push(this.generateSingleBotAndStoreInCache(detailsClone, sessionId, cacheKey)); + progressWriter.increment(); } - return Promise.all(botPromises).then(() => { + return await Promise.all(botPromises).then(() => { this.logger.debug( `Generated ${botGenerationDetails.botCountToGenerate} ${botGenerationDetails.role} (${ - botGenerationDetails.eventRole ?? "" + botGenerationDetails.eventRole ?? botGenerationDetails.role ?? "" }) ${botGenerationDetails.botDifficulty} bots`, ); }); diff --git a/project/src/utils/ProgressWriter.ts b/project/src/utils/ProgressWriter.ts index 48343259..8c0a88d0 100644 --- a/project/src/utils/ProgressWriter.ts +++ b/project/src/utils/ProgressWriter.ts @@ -48,5 +48,7 @@ export class ProgressWriter { readline.cursorTo(process.stdout, 0, null); this.done = true; } + + readline.cursorTo(process.stdout, 0, null); } }