Prevent server error when loot generator tries to find non-existent loot
This commit is contained in:
parent
90f82d0e03
commit
9eee25a175
@ -694,6 +694,13 @@ export class LocationGenerator
|
|||||||
itemArray.push(new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability));
|
itemArray.push(new ProbabilityObject(itemDist.composedKey.key, itemDist.relativeProbability));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemArray.length === 0)
|
||||||
|
{
|
||||||
|
this.logger.warning(`Loot pool for position: ${spawnPoint.template.Id} is empty. Skipping`);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw a random item from spawn points possible items
|
// Draw a random item from spawn points possible items
|
||||||
const chosenComposedKey = itemArray.draw(1)[0];
|
const chosenComposedKey = itemArray.draw(1)[0];
|
||||||
const createItemResult = this.createDynamicLootItem(chosenComposedKey, spawnPoint, staticAmmoDist);
|
const createItemResult = this.createDynamicLootItem(chosenComposedKey, spawnPoint, staticAmmoDist);
|
||||||
|
Loading…
Reference in New Issue
Block a user