sealedWeaponContainer - Get random weapon preset if default preset not found

This commit is contained in:
Dev 2023-07-23 11:27:04 +01:00
parent 4c1884fda3
commit 89ab3a99a8

View File

@ -279,10 +279,16 @@ export class LootGenerator
}
// Get weapon preset - default or choose a random one from all possible
const chosenWeaponPreset = containerSettings.defaultPresetsOnly
let chosenWeaponPreset = containerSettings.defaultPresetsOnly
? this.presetHelper.getDefaultPreset(chosenWeaponTpl)
: this.randomUtil.getArrayValue(this.presetHelper.getPresets(chosenWeaponTpl));
if (!chosenWeaponPreset)
{
this.logger.warning(`Default preset for weapon ${chosenWeaponTpl} not found, choosing random instead`);
chosenWeaponPreset = this.randomUtil.getArrayValue(this.presetHelper.getPresets(chosenWeaponTpl));
}
// Add preset to return object
itemsToReturn.push({
count: 1,