Reference · Rockets, variants, parts and the fit check
shipPartsfunction
A ship's parts for the registry: one entry for each place, named <ship>-<place>-<module>, with a record that carries its joints and, for a module hung beside or on a port, where it stands.
Import it
import { shipParts } from "@johnmorrisdotca/uchusen-rockets";
Definition
function shipParts(ship: string, list: ShipList, options?: ModuleOptions, rocket?: string, variant?: string): ShipParts
Parameters
| Name | Type | Description |
|---|---|---|
ship | string | The ship's id, as its rocket and variant will name it. |
list | ShipList | The ship's list of places. |
options (optional) | ModuleOptions | What to draw, for every module. |
rocket (optional) | string | The rocket the parts belong to. Left out: the ship's id. |
variant (optional) | string | The variant the parts are true for. Left out: the ship's id. |
Returns
ShipParts
The entries, the slot names in stacking order, the slot-to-part ids, and the assembly.
Examples
import { shipParts } from "@johnmorrisdotca/uchusen-rockets";
const parts = shipParts("demo", [{ module: "engine-fusion-3" }, { module: "tank-cryo-12" }]);
console.log(parts.slots, parts.assembly.ok);[ 'engine-fusion-3-1', 'tank-cryo-12-2' ] trueWhat it prints (run when this page was built)