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,15 +850,21 @@ 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 }];
|
||||||
this.itemHelper.fillMagazineWithRandomCartridge(
|
|
||||||
magazineItem,
|
if (this.randomUtil.getChance100(this.locationConfig.magazineLootHasAmmoChancePercent))
|
||||||
itemTemplate, // Magazine template
|
{
|
||||||
staticAmmoDist,
|
// Add randomised amount of cartridges
|
||||||
null,
|
this.itemHelper.fillMagazineWithRandomCartridge(
|
||||||
this.locationConfig.minFillLooseMagazinePercent / 100,
|
magazineItem,
|
||||||
);
|
itemTemplate, // Magazine template
|
||||||
|
staticAmmoDist,
|
||||||
|
null,
|
||||||
|
this.locationConfig.minFillLooseMagazinePercent / 100,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
itemWithMods.push(...magazineItem);
|
itemWithMods.push(...magazineItem);
|
||||||
}
|
}
|
||||||
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
|
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
|
||||||
@ -1058,18 +1064,21 @@ export class LocationGenerator
|
|||||||
}
|
}
|
||||||
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE))
|
else if (this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MAGAZINE))
|
||||||
{
|
{
|
||||||
// Create array with just magazine
|
if (this.randomUtil.getChance100(this.locationConfig.magazineLootHasAmmoChancePercent))
|
||||||
const magazineWithCartridges = [items[0]];
|
{
|
||||||
this.itemHelper.fillMagazineWithRandomCartridge(
|
// Create array with just magazine
|
||||||
magazineWithCartridges,
|
const magazineWithCartridges = [items[0]];
|
||||||
itemTemplate,
|
this.itemHelper.fillMagazineWithRandomCartridge(
|
||||||
staticAmmoDist,
|
magazineWithCartridges,
|
||||||
null,
|
itemTemplate,
|
||||||
this.locationConfig.minFillStaticMagazinePercent / 100,
|
staticAmmoDist,
|
||||||
);
|
null,
|
||||||
|
this.locationConfig.minFillStaticMagazinePercent / 100,
|
||||||
|
);
|
||||||
|
|
||||||
// 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))
|
||||||
{
|
{
|
||||||
|
@ -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…
Reference in New Issue
Block a user