ships.TypeAlias.LoadoutSlot - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

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

Type Alias: LoadoutSlot

LoadoutSlot = BuildSlot & object

Defined in: src/ships/loadout-slot.ts:64

A point-in-time, deeply frozen view of one hull mount.

The view is detached from its ShipLoadout; after an edit that changes the build, call ShipLoadout.slots again for the current view. Mutations and candidate filtering stay on ShipLoadout and take the slot key, leaving this value serializable and free of lifecycle rules.

Type Declaration

immovableReason?

readonly optional immovableReason?: ImmovableReason

Machine-readable reason the mount cannot currently be emptied: cargoHatch for the built-in hatch, requiredSlot for a core or armour mount, or moduleLimit when removing a fitted allowance-increasing module would leave too many limited modules. Absent when removable is true.

module

readonly module: FittedModule | null

Frozen fitted-module snapshot, or null when this mount is empty.

name

readonly name: string

Human-readable label, e.g. "Frame Shift Drive".

removable

readonly removable: boolean

Whether ShipLoadout.removeModule may empty this mount.

Examples

Walking a build's mounts. Slot keys come from the game and are not derivable from position, so read the slot's key rather than composing one.

import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
import type { LoadoutEvent } from '@elite-dangerous-almanac/core/ships/slef';

declare const event: LoadoutEvent;

// Figures below are one build's — a Federal Corvette.
const build = ShipLoadout.fromLoadout(event);

build.slots().length; // -> 38   every mount on the hull
build.slots('hardpoint').length; // -> 7

const first = build.slots('hardpoint')[0];
first?.key; // -> 'HugeHardpoint1'      what ShipLoadout.setModule takes
first?.name; // -> 'Huge Hardpoint 1'   what a UI shows
first?.size; // -> 4
first?.module?.symbol; // -> 'hpt_beamlaser_gimbal_huge'; undefined when the mount is empty

The view is a snapshot, not a handle — re-read it after an edit.

import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
import { HARDPOINT_MODULES } from '@elite-dangerous-almanac/core/ships/modules-hardpoint';
import { getModuleBySymbol } from '@elite-dangerous-almanac/core/ships/modules';

const build = ShipLoadout.empty('Sidewinder');
const before = build.slots('hardpoint')[0];
before?.key; // -> 'SmallHardpoint1'
before?.module; // -> null

const pulse = getModuleBySymbol('Hpt_PulseLaser_Fixed_Small', HARDPOINT_MODULES);
if (pulse) build.setModule('SmallHardpoint1', pulse);

before?.module; // -> still null — `before` describes the build as it was
build.slots('hardpoint')[0]?.module?.symbol; // -> 'Hpt_PulseLaser_Fixed_Small'
⚠️ **GitHub.com Fallback** ⚠️