diff options
author | MetroWind <chris.corsair@gmail.com> | 2025-09-27 13:05:27 -0700 |
---|---|---|
committer | MetroWind <chris.corsair@gmail.com> | 2025-09-27 13:05:27 -0700 |
commit | 81b539d6a63dd4921686fb50f05daf1b1d725e3b (patch) | |
tree | 5d6d832d73f7f946ebf40924221ffcda980f9837 /button-maker/scripts/tiles.js | |
parent | 925b5fcea3b85df08eea6574caf76639018a1937 (diff) |
Add button maker. Support basic editing.
Diffstat (limited to 'button-maker/scripts/tiles.js')
-rw-r--r-- | button-maker/scripts/tiles.js | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/button-maker/scripts/tiles.js b/button-maker/scripts/tiles.js new file mode 100644 index 0000000..f35887a --- /dev/null +++ b/button-maker/scripts/tiles.js | |||
@@ -0,0 +1,94 @@ | |||
1 | const TILES = [ | ||
2 | null, | ||
3 | { | ||
4 | id: "blank", | ||
5 | name: "black", | ||
6 | inner_svg: null, | ||
7 | }, { | ||
8 | id: "teleporter", | ||
9 | name: "teleporter", | ||
10 | inner_svg: h("circle", { | ||
11 | "cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5, | ||
12 | "r": (CELL_SIZE - 10) * 0.5, "stroke": "black", | ||
13 | "fill": "transparent", "stroke-width": 6, | ||
14 | }), | ||
15 | }, { | ||
16 | id: "fleet_command", | ||
17 | name: "fleet command", | ||
18 | inner_svg: h("polyline", { | ||
19 | "points": `3, ${CELL_SIZE} \ | ||
20 | 3, ${CELL_SIZE - 15} \ | ||
21 | 13, ${CELL_SIZE - 25} \ | ||
22 | 13, ${CELL_SIZE - 5} \ | ||
23 | ${CELL_SIZE - 13}, ${CELL_SIZE - 5} \ | ||
24 | ${CELL_SIZE - 13}, ${CELL_SIZE - 25} \ | ||
25 | ${CELL_SIZE - 3}, ${CELL_SIZE - 15} \ | ||
26 | ${CELL_SIZE - 3}, ${CELL_SIZE}`, | ||
27 | "fill": "black", "stroke-width": 0, | ||
28 | }), | ||
29 | }, { | ||
30 | id: "scanner", | ||
31 | name: "scanner", | ||
32 | inner_svg: | ||
33 | h(preact.Fragment, {}, | ||
34 | h("circle", {"cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5, | ||
35 | "r": CELL_SIZE * 0.5 - 2, "fill": "transparent", | ||
36 | "stroke": "black", "stroke-width": 2}), | ||
37 | h("circle", {"cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5, | ||
38 | "r": CELL_SIZE * 0.25, "fill": "transparent", | ||
39 | "stroke": "black", "stroke-width": 2}), | ||
40 | h("line", {"x1": 2, "y1": CELL_SIZE * 0.5, | ||
41 | "x2": CELL_SIZE - 2, "y2": CELL_SIZE * 0.5, | ||
42 | "stroke": "black", "stroke-width": 2}), | ||
43 | h("line", {"y1": 2, "x1": CELL_SIZE * 0.5, | ||
44 | "y2": CELL_SIZE - 2, "x2": CELL_SIZE * 0.5, | ||
45 | "stroke": "black", "stroke-width": 2}), | ||
46 | h("line", {"x1": CELL_SIZE * 0.5, "y1": CELL_SIZE * 0.5, | ||
47 | "x2": CELL_SIZE * 0.5 + (CELL_SIZE * 0.5 - 2) * Math.cos(Math.PI / 6), | ||
48 | "y2": CELL_SIZE * 0.5 - (CELL_SIZE * 0.5 - 2) * Math.sin(Math.PI / 6), | ||
49 | "stroke": "black", "stroke-width": 2}), | ||
50 | h("circle", {"cx": 22, "cy": 6, "r": 2, "fill": "black", | ||
51 | "stroke-width": 0}), | ||
52 | h("circle", {"cx": 10, "cy": 22, "r": 4, "fill": "black", | ||
53 | "stroke-width": 0}), | ||
54 | |||
55 | ), | ||
56 | }, { | ||
57 | id: "extractor", | ||
58 | name: "stellar extractor", | ||
59 | inner_svg: | ||
60 | h(preact.Fragment, {}, | ||
61 | h("circle", {"cx": CELL_SIZE * 0.5, "cy": 21, | ||
62 | "r": 10, "fill": "black", "stroke-width": 0}), | ||
63 | h("polygon", {"points": `${CELL_SIZE * 0.5 - 4}, 20 \ | ||
64 | ${CELL_SIZE * 0.5 - 4}, 10 \ | ||
65 | ${CELL_SIZE * 0.5 - 8}, 10 \ | ||
66 | ${CELL_SIZE * 0.5}, 3 \ | ||
67 | ${CELL_SIZE * 0.5 + 8}, 10 \ | ||
68 | ${CELL_SIZE * 0.5 + 4}, 10 \ | ||
69 | ${CELL_SIZE * 0.5 + 4}, 20`, | ||
70 | "stroke": "black", "stroke-width": 2, | ||
71 | "fill": "white"}), | ||
72 | ), | ||
73 | }, { | ||
74 | id: "storage", | ||
75 | name: "storage", | ||
76 | inner_svg: | ||
77 | h(preact.Fragment, {}, | ||
78 | h("rect", {"x": 4, "y": 4, "width": CELL_SIZE - 8, | ||
79 | "height": CELL_SIZE - 8, "rx": 2, "ry": 2, | ||
80 | "fill": "black", "stroke-width": 0}), | ||
81 | h("line", {"x1": 4, "y1": 14, "x2": CELL_SIZE - 4, "y2": 14, | ||
82 | "stroke": "white", "stroke-width": 2}), | ||
83 | h("rect", {"x": CELL_SIZE * 0.5 - 4, "y": 10, "width": 8, "height": 8, | ||
84 | "fill": "white", "stroke-width": 0}), | ||
85 | ), | ||
86 | }, { | ||
87 | id: "plant", | ||
88 | name: "double cultivation chamber", | ||
89 | inner_svg: h("path", {"d": "m3.02 17.7a13 13 0 0013 13 13 13 0 00-13-13m13 13a13 13 0 0013-13 13 13 0 00-13 13m8.66-27.4v7.21a8.66 8.66 0 01-8.66 8.66 8.66 8.66 0 01-8.66-8.66v-7.21c1.07 0 2.12.173 3.12.563.793.332 1.5.821 2.09 1.44l3.43-3.43 3.43 3.43c.591-.622 1.3-1.11 2.09-1.44.996-.388 2.05-.563 3.12-.563z", | ||
90 | "fill": "black", "stroke-width": 0}), | ||
91 | } | ||
92 | ]; | ||
93 | |||
94 | const TILE_MAP = Object.fromEntries(TILES.slice(1).map(t => [t.id, t])); | ||