From f4fce0612ec07cd36d031d697e84373dd3676e97 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 26 Oct 2023 20:31:05 +0100 Subject: [PATCH] Force handguards that take a sub-handguard to set handguard spawn chance to 100% - fixes split handguards appearing without the lower part Only adds lower when weapon has no launcher attached Adjust sub stock adding code to trigger when stock has a subslot that starts with `mod_stock`, this means `mod_stock_akms` and `mod_stock_000` will be included --- project/assets/database/bots/types/bear.json | 5 +++++ project/assets/database/bots/types/usec.json | 3 +++ project/src/generators/BotEquipmentModGenerator.ts | 10 +++++++++- project/src/models/eft/common/tables/IBotType.ts | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/project/assets/database/bots/types/bear.json b/project/assets/database/bots/types/bear.json index 7a0a0252..2594f846 100644 --- a/project/assets/database/bots/types/bear.json +++ b/project/assets/database/bots/types/bear.json @@ -13785,6 +13785,11 @@ "5a800961159bd4315e3a1657" ] }, + "637f57b78d137b27f70c496a": { + "mod_foregrip": [ + "58c157c886f774032749fb06" + ] + }, "6386300124a1dc425c00577a": { "mod_stock": [ "5a0c59791526d8dba737bba7" diff --git a/project/assets/database/bots/types/usec.json b/project/assets/database/bots/types/usec.json index 52a12286..c71d7a61 100644 --- a/project/assets/database/bots/types/usec.json +++ b/project/assets/database/bots/types/usec.json @@ -4068,6 +4068,9 @@ "5a800961159bd4315e3a1657" ] }, + "637f57b78d137b27f70c496a": { + "mod_foregrip": ["58c157c886f774032749fb06"] + }, "55d45f484bdc2d972f8b456d": { "mod_foregrip": [ "5c1bc5af2e221602b412949b" diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index 62cc1893..6d655893 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -266,8 +266,16 @@ export class BotEquipmentModGenerator modSpawnChances.mod_sight_rear = 100; } + // Handguard mod can take a sub handguard mod + weapon has no UBGL (takes same slot) + // Force spawn chance to be 100% to ensure it gets added + if (modSlot === "mod_handguard" && modToAddTemplate._props.Slots.find(x => x._name === "mod_handguard") && !weapon.find(x => x.slotId === "mod_launcher")) + { + // Needed for handguards with lower + modSpawnChances.mod_handguard = 100; + } + // If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure stock gets added - if (modSlot === "mod_stock" && modToAddTemplate._props.Slots.find(x => x._name === "mod_stock")) + if (modSlot === "mod_stock" && modToAddTemplate._props.Slots.find(x => x._name.includes("mod_stock"))) { // Stock mod can take additional stocks, could be a locking device, force 100% chance modSpawnChances.mod_stock = 100; diff --git a/project/src/models/eft/common/tables/IBotType.ts b/project/src/models/eft/common/tables/IBotType.ts index 9de15042..1ab63357 100644 --- a/project/src/models/eft/common/tables/IBotType.ts +++ b/project/src/models/eft/common/tables/IBotType.ts @@ -82,6 +82,7 @@ export interface ModsChances mod_tactical_001: number mod_tactical_002: number mod_tactical_003: number + mod_handguard: number } export interface Difficulties