aboutsummaryrefslogtreecommitdiff
path: root/scripts/tiles.js
diff options
context:
space:
mode:
authorMetroWind <chris.corsair@gmail.com>2025-08-31 17:11:55 -0700
committerMetroWind <chris.corsair@gmail.com>2025-08-31 17:11:55 -0700
commit897268c771b3ab39944761666b8511f0a69baf4b (patch)
tree10d4f3e67ae3d74a1819b24091dab10c743cc704 /scripts/tiles.js
parent58446021aaef002422c52c7d6c4b1a860d116de5 (diff)
Add all rooms. (Except for internal wall. Need to figure out how they work.)
Diffstat (limited to 'scripts/tiles.js')
-rw-r--r--scripts/tiles.js271
1 files changed, 262 insertions, 9 deletions
diff --git a/scripts/tiles.js b/scripts/tiles.js
index f35887a..2ed5691 100644
--- a/scripts/tiles.js
+++ b/scripts/tiles.js
@@ -1,12 +1,231 @@
1// TODO: how does internal walls & ladder work??
1const TILES = [ 2const TILES = [
2 null,
3 { 3 {
4 id: "null",
5 name: "Nothing",
6 bg: null,
7 inner_svg: null,
8 }, {
4 id: "blank", 9 id: "blank",
5 name: "black", 10 name: "Generic",
6 inner_svg: null, 11 inner_svg: null,
7 }, { 12 }, {
13 id: "corridor_ns",
14 name: "Corridor N-S",
15 bg: null,
16 inner_svg: h("rect", {
17 x: CELL_SIZE / 4, y: 0, width: CELL_SIZE / 2, height: CELL_SIZE,
18 fill: "white"}),
19 }, {
20 id: "corridor_we",
21 name: "Corridor W-E",
22 bg: null,
23 inner_svg: h("rect", {
24 y: CELL_SIZE / 4, x: 0, height: CELL_SIZE / 2, width: CELL_SIZE,
25 fill: "white"}),
26 }, {
27 id: "corridor_ne",
28 name: "Corridor N-E",
29 bg: null,
30 inner_svg: h("path", {
31 d: `M ${CELL_SIZE * 0.5} 0 \
32A ${CELL_SIZE * 0.5} ${CELL_SIZE * 0.5} 0 0 0 \
33${CELL_SIZE} ${CELL_SIZE * 0.5}`,
34 stroke: "white", "stroke-width": CELL_SIZE * 0.5}),
35 }, {
36 id: "corridor_se",
37 name: "Corridor S-E",
38 bg: null,
39 inner_svg: h("path", {
40 d: `M ${CELL_SIZE * 0.5} ${CELL_SIZE} \
41A ${CELL_SIZE * 0.5} ${CELL_SIZE * 0.5} 0 0 1 \
42${CELL_SIZE} ${CELL_SIZE * 0.5}`,
43 stroke: "white", "stroke-width": CELL_SIZE * 0.5}),
44 }, {
45 id: "corridor_sw",
46 name: "Corridor S-W",
47 bg: null,
48 inner_svg: h("path", {
49 d: `M ${CELL_SIZE * 0.5} ${CELL_SIZE} \
50A ${CELL_SIZE * 0.5} ${CELL_SIZE * 0.5} 0 0 0 \
510 ${CELL_SIZE * 0.5}`,
52 stroke: "white", "stroke-width": CELL_SIZE * 0.5}),
53 }, {
54 id: "corridor_nw",
55 name: "Corridor N-W",
56 bg: null,
57 inner_svg: h("path", {
58 d: `M ${CELL_SIZE * 0.5} 0 \
59A ${CELL_SIZE * 0.5} ${CELL_SIZE * 0.5} 0 0 1 \
600 ${CELL_SIZE * 0.5}`,
61 stroke: "white", "stroke-width": CELL_SIZE * 0.5}),
62 }, {
63 id: "corridor_3n",
64 name: "Three-way corridor 1",
65 bg: null,
66 inner_svg:
67 h(preact.Fragment, {},
68 h("rect", {
69 y: CELL_SIZE / 4, x: 0, height: CELL_SIZE / 2, width: CELL_SIZE,
70 fill: "white"}),
71 h("rect", {
72 x: CELL_SIZE / 4, y: 0, width: CELL_SIZE * 0.5,
73 height: CELL_SIZE * 0.5, fill: "white"})),
74 }, {
75 id: "corridor_3e",
76 name: "Three-way corridor 2",
77 bg: null,
78 inner_svg:
79 h(preact.Fragment, {},
80 h("rect", {
81 x: CELL_SIZE / 4, y: 0, width: CELL_SIZE / 2, height: CELL_SIZE,
82 fill: "white"}),
83 h("rect", {
84 y: CELL_SIZE / 4, x: CELL_SIZE * 0.5, height: CELL_SIZE / 2,
85 width: CELL_SIZE * 0.5, fill: "white"}))
86 }, {
87 id: "corridor_3s",
88 name: "Three-way corridor 3",
89 bg: null,
90 inner_svg:
91 h(preact.Fragment, {},
92 h("rect", {
93 y: CELL_SIZE / 4, x: 0, height: CELL_SIZE / 2, width: CELL_SIZE,
94 fill: "white"}),
95 h("rect", {
96 x: CELL_SIZE / 4, y: CELL_SIZE * 0.5, width: CELL_SIZE * 0.5,
97 height: CELL_SIZE * 0.5, fill: "white"})),
98 }, {
99 id: "corridor_3e",
100 name: "Three-way corridor 4",
101 bg: null,
102 inner_svg:
103 h(preact.Fragment, {},
104 h("rect", {
105 x: CELL_SIZE / 4, y: 0, width: CELL_SIZE / 2, height: CELL_SIZE,
106 fill: "white"}),
107 h("rect", {
108 y: CELL_SIZE / 4, x: 0, height: CELL_SIZE / 2,
109 width: CELL_SIZE * 0.5, fill: "white"}))
110 }, {
111 id: "stair_up",
112 name: "Stair up",
113 inner_svg:
114 h(preact.Fragment, {},
115 h("polygon", {
116 points: `5, ${CELL_SIZE} \
1175, ${5 + (CELL_SIZE - 5) / 3 * 2} \
118${5 + (CELL_SIZE - 5) / 3}, ${5 + (CELL_SIZE - 5) / 3 * 2} \
119${5 + (CELL_SIZE - 5) / 3}, ${5 + (CELL_SIZE - 5) / 3} \
120${5 + (CELL_SIZE - 5) / 3 * 2}, ${5 + (CELL_SIZE - 5) / 3} \
121${5 + (CELL_SIZE - 5) / 3 * 2}, 5 \
122${CELL_SIZE}, 5 \
123${CELL_SIZE}, ${CELL_SIZE}`,
124 fill: "black", "stroke-width": 0}),
125 h("line", {x1: 3, y1: CELL_SIZE - 15, x2: CELL_SIZE - 15, y2: 3,
126 stroke: "black", "stroke-width": 2}),
127 h("polyline", {points: `${CELL_SIZE - 15 - 6}, 3 \
128${CELL_SIZE - 15}, 3 \
129${CELL_SIZE - 15}, ${3 + 6}`,
130 stroke: "black", "stroke-width": 2})),
131
132 }, {
133 id: "stair_down",
134 name: "Stair down",
135 inner_svg:
136 h(preact.Fragment, {},
137 h("polygon", {
138 points: `5, ${CELL_SIZE} \
1395, ${5 + (CELL_SIZE - 5) / 3 * 2} \
140${5 + (CELL_SIZE - 5) / 3}, ${5 + (CELL_SIZE - 5) / 3 * 2} \
141${5 + (CELL_SIZE - 5) / 3}, ${5 + (CELL_SIZE - 5) / 3} \
142${5 + (CELL_SIZE - 5) / 3 * 2}, ${5 + (CELL_SIZE - 5) / 3} \
143${5 + (CELL_SIZE - 5) / 3 * 2}, 5 \
144${CELL_SIZE}, 5 \
145${CELL_SIZE}, ${CELL_SIZE}`,
146 fill: "black", "stroke-width": 0}),
147 h("line", {x1: 3, y1: CELL_SIZE - 15, x2: CELL_SIZE - 15, y2: 3,
148 stroke: "black", "stroke-width": 2}),
149 h("polyline", {points: `3, ${CELL_SIZE - 15 - 6} \
1503, ${CELL_SIZE - 15} \
151${3 + 6}, ${CELL_SIZE - 15}`,
152 stroke: "black", "stroke-width": 2})),
153
154 }, {
155 id: "tech",
156 name: "Technology room",
157 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
158 "font-family": "monospace", "font-weight": "bold",
159 "font-size": 32, "text-anchor": "middle",
160 "dominant-baseline": "middle", fill: "#c0c0c0", },
161 "T"),
162 }, {
163 id: "industry",
164 name: "Industrial room",
165 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
166 "font-family": "monospace", "font-weight": "bold",
167 "font-size": 32, "text-anchor": "middle",
168 "dominant-baseline": "middle", fill: "#c0c0c0", },
169 "I"),
170 }, {
171 id: "biology",
172 name: "Biological room",
173 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
174 "font-family": "monospace", "font-weight": "bold",
175 "font-size": 32, "text-anchor": "middle",
176 "dominant-baseline": "middle", fill: "#c0c0c0", },
177 "B"),
178 }, {
179 id: "appearance",
180 name: "Appearance modifier",
181 inner_svg: h("g", {"fill": "black", "stroke-width": 0,
182 "transform": "translate(2.921 1.0547)"},
183 h("path", {d: "m28.151 27.442 4e-3 -5e-3c-2.0135-2.2928-4.2222-1.0005-6.0958-0.27575-1.651 0.721-3.213 1.402-4.92 0.749-0.871-0.33-1.423-0.809-1.645-1.419-0.184-0.502-0.135-1.045-0.028-1.488l1.228 0.22c0.619 0.109 1.218-0.307 1.326-0.925l1.508-8.447c3.688-0.714 6.474-3.955 6.474-7.851 0-4.419-3.582-8-8-8-2.524 0-4.772 1.173-6.239 3h-7.763v9h7.079c0.565 0.977 1.34 1.813 2.25 2.474l-1.556 8.71c-0.11 0.618 0.306 1.216 0.925 1.326l1.081 0.191c-0.15 0.686-0.201 1.527 0.099 2.362 0.394 1.104 1.287 1.931 2.647 2.451 2.365 0.899 4.412 6e-3 6.218-0.78 1.475-0.6585 2.9852-1.5128 4.1748-0.11225l6e-3 -7e-3c0.15 0.136 0.35 0.218 0.566 0.218 0.473 0 0.854-0.382 0.854-0.852 0-0.203-0.072-0.391-0.193-0.539zm-10.151-23.442c2.206 0 4 1.794 4 4 0 2.205-1.794 4-4 4s-4-1.795-4-4c0-2.206 1.794-4 4-4z"}),
184 h("circle", {cx: 18, cy: 8, r: 2}),
185 h("path", {d: "m 0,4.001 v 6.997 C 0,11.552 0.448,12 1.001,12 H 3 V 3 H 1.001 C 0.448,3 0,3.448 0,4.001 Z"})),
186 }, {
187 id: "construction",
188 name: "Construction specialist’s room",
189 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
190 "font-family": "monospace", "font-weight": "bold",
191 "font-size": 32, "text-anchor": "middle",
192 "dominant-baseline": "middle", fill: "black",},
193 "C"),
194 }, {
195 id: "science",
196 name: "Scientist’s room",
197 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
198 "font-family": "monospace", "font-weight": "bold",
199 "font-size": 32, "text-anchor": "middle",
200 "dominant-baseline": "middle", fill: "black",},
201 "S"),
202 }, {
203 id: "agricultural",
204 name: "Agricultural specialist’s room",
205 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
206 "font-family": "monospace", "font-weight": "bold",
207 "font-size": 32, "text-anchor": "middle",
208 "dominant-baseline": "middle", fill: "black",},
209 "A"),
210 }, {
211 id: "exocrafter",
212 name: "Exocraft specialist’s room",
213 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
214 "font-family": "monospace", "font-weight": "bold",
215 "font-size": 32, "text-anchor": "middle",
216 "dominant-baseline": "middle", fill: "black",},
217 "E"),
218 }, {
219 id: "trade",
220 name: "Galaxtic trade",
221 inner_svg: h("text", {x: CELL_SIZE * 0.5, y: CELL_SIZE * 0.5, dy: 3,
222 "font-family": "monospace", "font-weight": "bold",
223 "font-size": 28, "text-anchor": "middle",
224 "dominant-baseline": "middle", fill: "black",},
225 "$"),
226 }, {
8 id: "teleporter", 227 id: "teleporter",
9 name: "teleporter", 228 name: "Teleporter",
10 inner_svg: h("circle", { 229 inner_svg: h("circle", {
11 "cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5, 230 "cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5,
12 "r": (CELL_SIZE - 10) * 0.5, "stroke": "black", 231 "r": (CELL_SIZE - 10) * 0.5, "stroke": "black",
@@ -14,7 +233,7 @@ const TILES = [
14 }), 233 }),
15 }, { 234 }, {
16 id: "fleet_command", 235 id: "fleet_command",
17 name: "fleet command", 236 name: "Fleet command",
18 inner_svg: h("polyline", { 237 inner_svg: h("polyline", {
19 "points": `3, ${CELL_SIZE} \ 238 "points": `3, ${CELL_SIZE} \
203, ${CELL_SIZE - 15} \ 2393, ${CELL_SIZE - 15} \
@@ -28,7 +247,7 @@ ${CELL_SIZE - 3}, ${CELL_SIZE}`,
28 }), 247 }),
29 }, { 248 }, {
30 id: "scanner", 249 id: "scanner",
31 name: "scanner", 250 name: "Scanner",
32 inner_svg: 251 inner_svg:
33 h(preact.Fragment, {}, 252 h(preact.Fragment, {},
34 h("circle", {"cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5, 253 h("circle", {"cx": CELL_SIZE * 0.5, "cy": CELL_SIZE * 0.5,
@@ -55,7 +274,7 @@ ${CELL_SIZE - 3}, ${CELL_SIZE}`,
55 ), 274 ),
56 }, { 275 }, {
57 id: "extractor", 276 id: "extractor",
58 name: "stellar extractor", 277 name: "Stellar extractor",
59 inner_svg: 278 inner_svg:
60 h(preact.Fragment, {}, 279 h(preact.Fragment, {},
61 h("circle", {"cx": CELL_SIZE * 0.5, "cy": 21, 280 h("circle", {"cx": CELL_SIZE * 0.5, "cy": 21,
@@ -72,7 +291,7 @@ ${CELL_SIZE * 0.5 + 4}, 20`,
72 ), 291 ),
73 }, { 292 }, {
74 id: "storage", 293 id: "storage",
75 name: "storage", 294 name: "Storage",
76 inner_svg: 295 inner_svg:
77 h(preact.Fragment, {}, 296 h(preact.Fragment, {},
78 h("rect", {"x": 4, "y": 4, "width": CELL_SIZE - 8, 297 h("rect", {"x": 4, "y": 4, "width": CELL_SIZE - 8,
@@ -85,10 +304,44 @@ ${CELL_SIZE * 0.5 + 4}, 20`,
85 ), 304 ),
86 }, { 305 }, {
87 id: "plant", 306 id: "plant",
88 name: "double cultivation chamber", 307 name: "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", 308 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}), 309 "fill": "black", "stroke-width": 0}),
91 } 310 }, {
311 id: "refiner",
312 name: "Refiner",
313 inner_svg:
314 h(preact.Fragment, {},
315 h("polyline", {
316 points: `5, 5 \
317${CELL_SIZE * 0.5}, 5 \
318${CELL_SIZE * 0.5}, ${CELL_SIZE - 5} \
3195, ${CELL_SIZE - 5}`, fill: "transparent", stroke: "black", "stroke-width": 2}),
320 h("line", {x1: 5, y1: CELL_SIZE * 0.5, x2: CELL_SIZE - 5,
321 y2: CELL_SIZE * 0.5, stroke: "black", "stroke-width": 2}),
322 h("circle", {cx: 5, cy: CELL_SIZE * 0.5, r: 3, fill: "black",
323 "stroke-width": 0}),
324 h("circle", {cx: CELL_SIZE - 5, cy: CELL_SIZE * 0.5, r: 3,
325 fill: "black", "stroke-width": 0}),
326 h("circle", {cx: 5, cy: 5, r: 3, fill: "black", "stroke-width": 0}),
327 h("circle", {cx: 5, cy: CELL_SIZE - 5, r: 3, fill: "black",
328 "stroke-width": 0}),
329 ),
330 }, {
331 id: "nutrition",
332 name: "Nutrition",
333 inner_svg:
334 h("path", {
335 d: "M 11 10 C 11.2727 7.45014 13.3891 5.34782 16 5.34782 C 18.6108 5.30432 20.7272 7.40664 20.7272 10 L 21.9091 10 C 24.5199 10.0435 26.6363 12.1457 26.6363 14.7392 C 26.6363 16.8978 24.5199 19 21.9091 19 L 21 19 L 21 23 L 11 23 L 11 19 L 10.0909 19 C 7.48012 19.4347 5.36364 17.3325 5.36364 14.7392 C 5.36364 12.1457 7.48012 10.0435 10.0909 10.0435 Z M 9.29722 7.73927 C 10.2581 4.98084 12.8962 3 16 3 C 19.1037 3 21.7419 4.98084 22.7028 7.73929 C 26.2454 8.1312 29 11.1157 29 14.7392 C 28.9091 18.229 26.3537 21.1263 23 21.6852 L 23 28.826 L 21.9091 30 L 10.0909 30 L 9 28.826 L 9 21.6852 C 5.55544 21.1263 3 18.229 3 14.7392 C 3 11.1157 5.7546 8.1312 9.29722 7.73927 Z M 11 27.6521 L 11 25 L 21 25 L 21 27.6521 Z",
336 fill: "black", "stroke-width": 0, "fill-rule": "evenodd"}),
337 }, {
338 id: "exocraft",
339 name: "Exocraft materialiser",
340 inner_svg: h("path", {d: "m 11.71,23.3 h 9.95 m -9.95,0 c 0,1.37 -1.11,2.49 -2.49,2.49 -1.37,0 -2.49,-1.11 -2.49,-2.49 m 4.98,0 c 0,-1.37 -1.11,-2.49 -2.49,-2.49 -1.37,0 -2.49,1.11 -2.49,2.49 m 14.93,0 c 0,1.37 1.11,2.49 2.49,2.49 1.37,0 2.49,-1.11 2.49,-2.49 m -4.98,0 c 0,-1.37 1.11,-2.49 2.49,-2.49 1.37,0 2.49,1.11 2.49,2.49 M 14.2,8.37 v 7.47 m -7.47,0 0.41,-2.47 C 7.44,11.59 7.59,10.7 8.03,10.04 8.42,9.45 8.97,8.98 9.61,8.7 10.34,8.37 11.24,8.37 13.04,8.37 h 4.19 c 1.17,0 1.75,0 2.28,0.16 0.47,0.14 0.91,0.38 1.29,0.69 0.43,0.35 0.75,0.84 1.4,1.81 l 3.2,4.81 M 6.74,23.3 H 6.24 c -0.7,0 -1.05,0 -1.31,-0.14 C 4.69,23.05 4.5,22.86 4.38,22.62 4.25,22.36 4.25,22.01 4.25,21.31 v -1.49 c 0,-1.39 0,-2.09 0.27,-2.62 0.24,-0.47 0.62,-0.85 1.09,-1.09 0.53,-0.27 1.23,-0.27 2.62,-0.27 h 14.93 c 0.92,0 1.39,0 1.77,0.06 2.13,0.34 3.8,2.01 4.14,4.14 0.06,0.39 0.06,0.85 0.06,1.77 0,0.23 0,0.35 -0.02,0.44 -0.08,0.53 -0.5,0.95 -1.03,1.03 -0.1,0.02 -0.21,0.02 -0.44,0.02 H 26.64",
341 "stroke": "black",
342 "fill": "transparent", "stroke-width": 2.48853,
343 }),
344 },
92]; 345];
93 346
94const TILE_MAP = Object.fromEntries(TILES.slice(1).map(t => [t.id, t])); 347const TILE_MAP = Object.fromEntries(TILES.slice(1).map(t => [t.id, t]));