From 82231248826302ef99bf5ff7c9e2abcbaa52be46 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 29 Oct 2023 16:35:03 +0000 Subject: [PATCH] Sort `mod_barrel` after `mod_handguard` to prevent weapon gen errors with certain combinations of barrel + gas blocks causing all handgaurds to be incompatible Also force gas block to be processed AFTER barrel + handguard --- .../src/generators/BotEquipmentModGenerator.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index 6d655893..ed5ac046 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -386,13 +386,20 @@ export class BotEquipmentModGenerator const sortedKeys: string[] = []; const modRecieverKey = "mod_reciever"; const modMount001Key = "mod_mount_001"; - const modGasBLockKey = "mod_gas_block"; + const modGasBlockKey = "mod_gas_block"; const modPistolGrip = "mod_pistol_grip"; const modStockKey = "mod_stock"; const modBarrelKey = "mod_barrel"; + const modHandguardKey = "mod_handguard"; const modMountKey = "mod_mount"; const modScopeKey = "mod_scope"; + if (unsortedKeys.includes(modHandguardKey)) + { + sortedKeys.push(modHandguardKey); + unsortedKeys.splice(unsortedKeys.indexOf(modHandguardKey), 1); + } + if (unsortedKeys.includes(modBarrelKey)) { sortedKeys.push(modBarrelKey); @@ -417,10 +424,10 @@ export class BotEquipmentModGenerator unsortedKeys.splice(unsortedKeys.indexOf(modPistolGrip), 1); } - if (unsortedKeys.includes(modGasBLockKey)) + if (unsortedKeys.includes(modGasBlockKey)) { - sortedKeys.push(modGasBLockKey); - unsortedKeys.splice(unsortedKeys.indexOf(modGasBLockKey), 1); + sortedKeys.push(modGasBlockKey); + unsortedKeys.splice(unsortedKeys.indexOf(modGasBlockKey), 1); } if (unsortedKeys.includes(modStockKey))