From 7dae2eb25fa5287715aa90a4955e6e464bc783a5 Mon Sep 17 00:00:00 2001 From: Eranziel Date: Wed, 10 Jul 2024 17:13:49 -0600 Subject: [PATCH] Show empty aux slot on flex mounts with one aux mounted Remaining fix for #712 --- src/module/helpers/item.ts | 7 ++++++- src/module/helpers/loadout.ts | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/module/helpers/item.ts b/src/module/helpers/item.ts index 18391375..89af4d17 100644 --- a/src/module/helpers/item.ts +++ b/src/module/helpers/item.ts @@ -619,12 +619,17 @@ export function mechLoadoutWeaponSlot( let weapon: LancerMECH_WEAPON | null = resolveHelperDotpath(options, weapon_path); if (!weapon) { // Make an empty ref. Note that it still has path stuff if we are going to be dropping things here + const slotSize = size + ? size === FittingSize.Flex + ? `${FittingSize.Main} || ${FittingSize.Auxiliary}` + : size + : "any"; return `
- Insert ${size ? size : "any"} weapon + Insert ${slotSize} weapon
`; } else { return mechWeaponDisplay(weapon_path, mod_path, options); diff --git a/src/module/helpers/loadout.ts b/src/module/helpers/loadout.ts index 6dcd9de0..d298e1a6 100644 --- a/src/module/helpers/loadout.ts +++ b/src/module/helpers/loadout.ts @@ -1,5 +1,5 @@ import type { HelperOptions } from "handlebars"; -import { EntryType, SystemType } from "../enums"; +import { EntryType, FittingSize, MountType, SystemType, WeaponSize } from "../enums"; import { inc_if, resolveHelperDotpath, @@ -146,6 +146,21 @@ function weaponMount(mount_path: string, options: HelperOptions): string { options ) ); + // Add an empty aux slot for flex mounts with 1 aux + if ( + mount.type === "Flex" && + mount.slots.length === 1 && + mount.slots[0].weapon?.value?.system.size === WeaponSize.Aux + ) { + slots.push( + mechLoadoutWeaponSlot( + `${mount_path}.slots.1.weapon.value`, + `${mount_path}.slots.1.mod.value`, + FittingSize.Auxiliary, + options + ) + ); + } let err = mech.loadoutHelper.validateMount(mount) ?? ""; // FLEX mount: Don't show the empty aux if a main is equipped.