ships.Function.getShipSlots - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / getShipSlots
getShipSlots(
symbol):ShipSlots|null
Defined in: src/ships/ships.ts:239
A hull's slot layout as a self-contained ShipSlots, ready to feed enumerateSlots.
string
The internal identifier, e.g. "Anaconda". Leading/trailing
whitespace and case are ignored.
ShipSlots | null
The hull's slot layout, or null if no hull with that symbol is carried.
This is a projection of the slot-bearing fields already on Ship, all four of
which every carried hull has, so a symbol that resolves always has a layout.
This is the read-only layout, for your own outfitting UI (feed it to
enumerateSlots). To assemble and edit an actual build — fit modules, engineer
them, read jump range — start a ShipLoadout instead and use its live
slots() / slots('core') views.
If symbol is present and not a string. A nullish
symbol is a miss, answered the way an unrecognised one is.
import { getShipSlots } from '@elite-dangerous-almanac/core/ships/ships';
getShipSlots('anaconda')?.hardpoints;
// -> [{ size: 4 }, { size: 3 }, { size: 3 }, { size: 3 }, { size: 2 }, ...]
getShipSlots('LakonMiner')?.hardpoints[0];
// -> { size: 3, restriction: 'mining', name: 'LargeMiningHardpoint1' }
getShipSlots('Anaconda')?.optional?.at(-2); // -> { size: 1, name: 'Slot14_Size1' }
getShipSlots('Sidewinder')?.optional?.at(-2); // -> { size: 1 } — the rules fit