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