Restrict to one slot wide
This commit is contained in:
parent
f67e582e08
commit
459ec0d101
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"minMagazineSizeToBeIncluded": 30,
|
"minMagazineCapacityToBeIncluded": 40,
|
||||||
"maxMagazineSizeToBeIncluded": 60,
|
"maxMagazineCapacityToBeIncluded": 50
|
||||||
"newMagazineInventorySlotSize": 2
|
|
||||||
}
|
}
|
10
src/mod.ts
10
src/mod.ts
@ -35,20 +35,22 @@ class TwoSlotExtendedMags implements IPostDBLoadMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateInventorySlotSize(itemProp: Props): void {
|
private updateInventorySlotSize(itemProp: Props): void {
|
||||||
itemProp.Height = config.newMagazineInventorySlotSize;
|
itemProp.Height = 2;
|
||||||
// itemProp.ExtraSizeDown = config.newMagazineInventorySlotSize--;
|
// itemProp.ExtraSizeDown = config.newMagazineInventorySlotSize--;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isExtendedMag(item: ITemplateItem): boolean {
|
private isExtendedMag(item: ITemplateItem): boolean {
|
||||||
const magazineCategoryId = "5448bc234bdc2d3c308b4569";
|
const magazineCategoryId = "5448bc234bdc2d3c308b4569";
|
||||||
|
|
||||||
return item._parent == magazineCategoryId && this.isMagazineSizeWithinCapacity(item._props);
|
return item._parent == magazineCategoryId &&
|
||||||
|
item._props.Width == 1 && // We don't want to make horizontal mags like P90's to be 4 squares wide or change drum mags (for now)
|
||||||
|
this.isWithinMagazineSizeCapacity(item._props);
|
||||||
}
|
}
|
||||||
|
|
||||||
private isMagazineSizeWithinCapacity(itemProp: Props): boolean {
|
private isWithinMagazineSizeCapacity(itemProp: Props): boolean {
|
||||||
const capacity = this.getMagazineCapacity(itemProp);
|
const capacity = this.getMagazineCapacity(itemProp);
|
||||||
|
|
||||||
return capacity >= config.minMagazineSizeToBeIncluded && capacity <= config.maxMagazineSizeToBeIncluded;
|
return capacity >= config.minMagazineCapacityToBeIncluded && capacity <= config.maxMagazineCapacityToBeIncluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getMagazineCapacity(itemProp: Props): number {
|
private getMagazineCapacity(itemProp: Props): number {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user