ships.Function.enumerateSlots - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships / enumerateSlots

Function: enumerateSlots()

enumerateSlots(layout): BuildSlot[]

Defined in: src/ships/slots.ts:483

Expand a hull's ShipSlots layout into keyed BuildSlots, in outfitting-panel order: hardpoints, utility mounts, armour, the seven core internals, then the optional internals, then the cargo hatch.

The keys are journal-compatible, so the same key identifies a mount whether the build was assembled from scratch or loaded from a SLEF export — SLEF being the journal's own Loadout event in an envelope, its Slot strings are these.

Parameters

layout

ShipSlots

The hull's slot layout.

Returns

BuildSlot[]

Every mount the hull offers, as BuildSlots.

Remarks

Unrestricted optionals are numbered Slot01_SizeN, Slot02_SizeN, … with no gaps, and hardpoints 1, 2, 3 within each size class. Some hulls disagree, and no rule derives what they do instead, so a mount on one of them carries its own OptionalSlotSpec.name / HardpointSlotSpec.name and that wins:

Hull What the game names it
Anaconda Slot13_Size2, Slot14_Size1 — no 11 or 12
Type-9 Heavy starts at Slot00_Size8; then jumps Slot08Slot11
Type-10 Defender, Federal Dropship, Vulture a gap before the last mounts
Type-7 Transporter the number 09 twice, and five suffixes misreport the size
Keelback, Asp Scout one suffix misreports the size
Type-8 Transporter SmallHardpoint2 then SmallHardpoint4
Caspian Explorer mediums run 6, 5, 1, 2, 3, 4 — out of order, not just gapped

The Panther Clipper Mk II, Type-11 Prospector and Lynx Highliner also carry explicit names that match the derived keys. The Lynx's Slot02_Size5 follows three PassengerNN mounts because a restricted passenger mount consumes no SlotNN number. A hull that names any mount of a kind names all of them, so a derived key and a name never compete for the same string.

Example

import { getShipSlots } from '@elite-dangerous-almanac/core/ships/ships';
import { enumerateSlots } from '@elite-dangerous-almanac/core/ships/slots';

enumerateSlots(getShipSlots('Anaconda')!).filter((s) => s.kind === 'hardpoint');
// -> [{ key: 'HugeHardpoint1', size: 4, ... }, { key: 'LargeHardpoint1', size: 3, ... }, ...]
enumerateSlots(getShipSlots('Anaconda')!)
    .filter((s) => s.kind === 'optional' && !s.restriction)
    .at(-1)?.key; // -> 'Slot14_Size1', not 'Slot12_Size1'
⚠️ **GitHub.com Fallback** ⚠️