Skip to content
Source
Sign inSign up
samwillis/neonbricks
Open History to see the last commit

starter.ts

48 lines1.5 KB

1import type { Part } from "./types";
2export function starter(id: () => string): Part[] {
3 const list: Part[] = [];
4 const add = (
5 key: string,
6 color: string,
7 x: number,
8 y: number,
9 z: number,
10 rotation = 0,
11 ) =>
12 list.push({
13 id: id(),
14 key,
15 color,
16 position: { x: x * 6, y: y * 2, z: z * 6 },
17 rotation,
18 revision: 1,
19 });
20 // A rover with real clearance around its wheels, plus a small mechanic's bench.
21 for (const z of [-2, 2]) {
22 add("axle-6", "#b9aa88", -3, 3, z, 1);
23 add("wheel", "#3c4445", -3, 0, z - 1, 1);
24 add("wheel", "#3c4445", 2, 0, z - 1, 1);
25 }
26 add("plate-2x4", "#289b74", -1, 5, -2);
27 add("brick-1x4", "#289b74", -1, 6, -2);
28 add("brick-1x4", "#289b74", 0, 6, -2);
29 add("plate-2x4", "#edbc46", -1, 9, -2);
30 add("slope-2x2", "#edbc46", -1, 10, 0);
31 add("tile-2x2", "#eee8dc", -1, 10, -2);
32 add("brick-1x1", "#d9594e", -1, 11, -2);
33 add("brick-1x1", "#d9594e", 0, 11, -2);
34 add("plate-2x4", "#72a6c8", 5, 0, -4);
35 add("brick-1x1", "#72a6c8", 5, 1, -4);
36 add("brick-1x1", "#72a6c8", 6, 1, -4);
37 add("brick-1x1", "#72a6c8", 5, 1, -1);
38 add("brick-1x1", "#72a6c8", 6, 1, -1);
39 add("plate-2x4", "#b9aa88", 5, 4, -4);
40 add("beam-3", "#d9594e", 5, 5, -4);
41 add("gear-12", "#edbc46", 5, 5, -2);
42 add("round", "#eee8dc", 6, 5, -1);
43 // A few spare components on the workbench surface.
44 add("brick-2x2", "#d9594e", -6, 0, 4);
45 add("plate-1x4", "#72a6c8", -3, 0, 5, 1);
46 add("gear-20", "#b9aa88", 4, 0, 4);
47 return list;