Add location property minFillLooseMagazinePercent
Make static/dynamic magazine loot have chance to not have cartridges
This commit is contained in:
parent
1f05fe1994
commit
6cd82ce2a6
@ -890,6 +890,7 @@
|
||||
"minFillStaticMagazinePercent": 50,
|
||||
"makeWishingTreeAlwaysGiveGift": true,
|
||||
"allowDuplicateItemsInStaticContainers": true,
|
||||
"magazineLootHasAmmoChancePercent": 50,
|
||||
"looseLootBlacklist": {},
|
||||
"scavRaidTimeSettings": {
|
||||
"settings": {
|
||||
|
@ -850,8 +850,12 @@ export class LocationGenerator
|
||||
}
|
||||
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE))
|
||||
{
|
||||
// Create array with just magazine + randomised amount of cartridges
|
||||
// Create array with just magazine
|
||||
const magazineItem: Item[] = [{ _id: this.objectId.generate(), _tpl: chosenTpl }];
|
||||
|
||||
if (this.randomUtil.getChance100(this.locationConfig.magazineLootHasAmmoChancePercent))
|
||||
{
|
||||
// Add randomised amount of cartridges
|
||||
this.itemHelper.fillMagazineWithRandomCartridge(
|
||||
magazineItem,
|
||||
itemTemplate, // Magazine template
|
||||
@ -859,6 +863,8 @@ export class LocationGenerator
|
||||
null,
|
||||
this.locationConfig.minFillLooseMagazinePercent / 100,
|
||||
);
|
||||
}
|
||||
|
||||
itemWithMods.push(...magazineItem);
|
||||
}
|
||||
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
|
||||
@ -1057,6 +1063,8 @@ export class LocationGenerator
|
||||
this.itemHelper.addCartridgesToAmmoBox(items, itemTemplate);
|
||||
}
|
||||
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE))
|
||||
{
|
||||
if (this.randomUtil.getChance100(this.locationConfig.magazineLootHasAmmoChancePercent))
|
||||
{
|
||||
// Create array with just magazine
|
||||
const magazineWithCartridges = [items[0]];
|
||||
@ -1071,6 +1079,7 @@ export class LocationGenerator
|
||||
// Replace existing magazine with above array
|
||||
items.splice(items.indexOf(items[0]), 1, ...magazineWithCartridges);
|
||||
}
|
||||
}
|
||||
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
|
||||
{
|
||||
// We make base item above, at start of function, no need to do it here
|
||||
|
@ -36,6 +36,8 @@ export interface ILocationConfig extends IBaseConfig
|
||||
/** How full must a random static magazine be %*/
|
||||
minFillStaticMagazinePercent: number;
|
||||
allowDuplicateItemsInStaticContainers: boolean;
|
||||
/** Chance loose/static magazines have ammo in them */
|
||||
magazineLootHasAmmoChancePercent: number;
|
||||
/** Key: map, value: loose loot ids to ignore */
|
||||
looseLootBlacklist: Record<string, string[]>;
|
||||
/** Key: map, value: settings to control how long scav raids are*/
|
||||
|
Loading…
Reference in New Issue
Block a user