Skip to content

Commit

Permalink
Show empty aux slot on flex mounts with one aux mounted
Browse files Browse the repository at this point in the history
Remaining fix for #712
  • Loading branch information
Eranziel committed Jul 10, 2024
1 parent 2d678fb commit 7dae2eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/module/helpers/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
<div class="${EntryType.MECH_WEAPON} ref slot drop-settable card flexrow"
data-path="${weapon_path}"
data-accept-types="${EntryType.MECH_WEAPON}">
<img class="ref-icon" src="${TypeIcon(EntryType.MECH_WEAPON)}"></img>
<span class="major">Insert ${size ? size : "any"} weapon</span>
<span class="major">Insert ${slotSize} weapon</span>
</div>`;
} else {
return mechWeaponDisplay(weapon_path, mod_path, options);
Expand Down
17 changes: 16 additions & 1 deletion src/module/helpers/loadout.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7dae2eb

Please sign in to comment.