Fixed off by one error inside generateUniqueBotNickname
that would result in undefined names when the unique name pool was low
This commit is contained in:
parent
9d55bf0fac
commit
24ab327ac2
@ -60,7 +60,7 @@ export class BotNameService {
|
||||
let isUnique = true;
|
||||
let attempts = 0;
|
||||
|
||||
while (attempts < 5) {
|
||||
while (attempts <= 5) {
|
||||
const isPlayerScav = botGenerationDetails.isPlayerScav;
|
||||
const simulateScavName = isPlayerScav ? false : this.shouldSimulatePlayerScavName(botRole);
|
||||
|
||||
@ -93,7 +93,11 @@ export class BotNameService {
|
||||
// Not unique
|
||||
if (attempts >= 5) {
|
||||
// 5 attempts to generate a name, pool probably isn't big enough
|
||||
this.logger.debug(`Failed to find unique name for: ${name} after 5 attempts`);
|
||||
const genericName = `${botGenerationDetails.side} ${this.randomUtil.getInt(100000, 999999)}`;
|
||||
this.logger.debug(
|
||||
`Failed to find unique name for: ${name} after 5 attempts, using: ${genericName}`,
|
||||
);
|
||||
return genericName;
|
||||
}
|
||||
|
||||
attempts++;
|
||||
|
Loading…
Reference in New Issue
Block a user