Remove useless node sets in make_entrance
[minetest_pyramids/tsm_pyramids.git] / room.lua
blob3932eb3dbfd086df8085ed23741697a4085a6db5
1 local S = minetest.get_translator("tsm_pyramids")
3 -- ROOM LAYOUTS
5 local ROOM_WIDTH = 9
7 local room_types = {
8 -- Pillar room
10 style = "yrepeat",
11 layout = {
12 " "," "," "," "," "," "," "," "," ",
13 " ","^"," ","^"," ","^"," ","^"," ",
14 " ","c"," ","c"," ","c"," ","c"," ",
15 " "," "," "," "," "," "," "," "," ",
16 " "," "," "," "," "," "," "," "," ",
17 " "," "," "," "," "," "," "," "," ",
18 " ","c"," ","c"," ","c"," ","c"," ",
19 " ","v"," ","v"," ","v"," ","v"," ",
20 " "," "," "," "," "," "," "," "," "
22 traps = true,
24 -- Hieroglyph walls
26 style = "yrepeat",
27 layout = {
28 "s","h","h","h","h","h","h","h","s",
29 "h"," "," "," "," "," "," "," ","h",
30 "h"," "," "," "," "," "," "," ","h",
31 "h"," "," "," "," "," "," "," ","h",
32 " "," "," "," ","<"," "," "," ","h",
33 "h"," "," "," "," "," "," "," ","h",
34 "h"," "," "," "," "," "," "," ","h",
35 "h"," "," "," "," "," "," "," ","h",
36 "s","h","h","h","h","h","h","h","s"
39 -- 4 large pillars
41 style = "yrepeat",
42 layout = {
43 " "," "," "," ","v"," "," "," "," ",
44 " ","c","c"," "," "," ","c","c"," ",
45 " ","c","c"," "," "," ","c","c"," ",
46 " "," "," "," "," "," "," "," "," ",
47 " "," "," "," "," "," "," "," ","<",
48 " "," "," "," "," "," "," "," "," ",
49 " ","c","c"," "," "," ","c","c"," ",
50 " ","c","c"," "," "," ","c","c"," ",
51 " "," "," "," ","^"," "," "," "," "
54 -- hidden room
56 style = "yrepeat",
57 layout = {
58 " "," "," "," "," "," "," "," "," ",
59 " "," "," "," "," "," "," "," "," ",
60 " "," ","c","S","c","S","c"," "," ",
61 " "," ","S"," "," "," ","S"," "," ",
62 " "," ","c"," ",">"," ","c"," ","<",
63 " "," ","S"," "," "," ","S"," "," ",
64 " "," ","c","S","c","S","c"," "," ",
65 " "," "," "," "," "," "," "," "," ",
66 " "," "," "," "," "," "," "," "," "
69 -- spiral 1
71 style = "yrepeat",
72 layout = {
73 " "," "," "," "," "," "," "," "," ",
74 " ","S","S","S","S","S","S","S"," ",
75 " ","S"," "," "," "," "," ","S"," ",
76 " ","S"," ","c","c","c"," ","S"," ",
77 " ","S"," ","c","v","c"," ","S"," ",
78 "S","S"," ","c"," ","c"," ","S"," ",
79 "S","S"," ","c"," "," "," ","S"," ",
80 "v","S"," ","S","S","S","S","S"," ",
81 " ","S"," "," "," "," "," "," "," "
84 -- spiral 2
86 style = "yrepeat",
87 layout = {
88 " "," "," "," "," "," "," "," "," ",
89 " ","S","S","S","S","S","S","S"," ",
90 " "," "," ","c"," "," "," ","S"," ",
91 "S","S"," ","c"," ","c"," ","S"," ",
92 " ","S"," ","c","^","c"," ","S"," ",
93 " ","S"," ","c","c","c"," ","S"," ",
94 " ","S"," "," "," "," "," ","S"," ",
95 " ","S","S","S","S","S","S","S"," ",
96 " "," "," "," "," "," "," "," "," "
99 -- pillar mania
101 style = "yrepeat",
102 layout = {
103 " "," ","v"," ","v"," ","v"," ","v",
104 " ","c"," ","c"," ","c"," ","c"," ",
105 " "," "," "," "," "," "," "," "," ",
106 " ","c"," ","c"," ","c"," ","c"," ",
107 " "," "," "," "," "," "," "," "," ",
108 " ","c"," ","c"," ","c"," ","c"," ",
109 " "," "," "," "," "," "," "," "," ",
110 " ","c"," ","c"," ","c"," ","c"," ",
111 " "," ","^"," ","^"," ","^"," ","^",
113 --traps = true,
115 -- plusses
117 style = "yrepeat",
118 layout = {
119 "c"," "," "," "," "," "," "," ","c",
120 " "," ","c",">"," ","<","c"," "," ",
121 " ","c","s","c"," ","c","s","c"," ",
122 " "," ","c"," "," "," ","c"," "," ",
123 " "," "," "," ","<"," "," "," "," ",
124 " "," ","c"," "," "," ","c"," "," ",
125 " ","c","s","c"," ","c","s","c"," ",
126 " "," ","c",">"," ","<","c"," "," ",
127 "c"," "," "," "," "," "," "," ","c",
129 --traps = true,
131 -- diamond
133 style = "yrepeat",
134 layout = {
135 ">","s","s","c","c","c","s","s","s",
136 "s","s","c"," "," "," ","c","s","s",
137 "s","c"," "," "," "," "," ","c","s",
138 "c"," "," "," "," "," "," "," ","c",
139 " "," "," "," "," "," "," ","<","c",
140 "c"," "," "," "," "," "," "," ","c",
141 "s","c"," "," "," "," "," ","c","s",
142 "s","s","c"," "," "," ","c","s","s",
143 ">","s","s","c","c","c","s","s","s",
145 --traps = true,
147 -- square
149 style = "yrepeat",
150 layout = {
151 " "," "," "," "," "," "," "," "," ",
152 " ","S","S","S","^","S","S","S"," ",
153 " ","S","S","S","S","S","S","S"," ",
154 " ","S","S","S","S","S","S","S"," ",
155 " ","S","S","S","S","S","S",">"," ",
156 " ","S","S","S","S","S","S","S"," ",
157 " ","S","S","S","S","S","S","S"," ",
158 " ","S","S","S","v","S","S","S"," ",
159 " "," "," "," "," "," "," "," "," ",
162 -- hallway 2
164 style = "yrepeat",
165 layout = {
166 "S","S","S","S",">"," "," "," "," ",
167 "S","S","S","S","S","^","S","S"," ",
168 "S","S","S","S","S","S","S","S"," ",
169 "S","S","S","S","S","S","S","S"," ",
170 " "," "," "," "," "," "," "," "," ",
171 "S","S","S","S","S","S","S","S"," ",
172 "S","S","S","S","S","S","S","S"," ",
173 "S","S","S","S","S","v","S","S"," ",
174 "S","S","S","S",">"," "," "," "," ",
177 -- hallway 3
179 style = "yrepeat",
180 layout = {
181 "S","S","S","S","S"," "," "," "," ",
182 "S","S","S","S","c",">"," "," "," ",
183 "S","c","S","c","S","c","S"," "," ",
184 " "," "," "," "," "," "," "," "," ",
185 " "," "," "," "," "," "," "," "," ",
186 " "," "," "," "," "," "," "," "," ",
187 "S","c","S","c","S","c","S"," "," ",
188 "S","S","S","S","c",">"," "," "," ",
189 "S","S","S","S","S"," "," "," "," ",
192 -- hallway 4
194 style = "yrepeat",
195 layout = {
196 "S","S","S","S","S","v","S","S","S",
197 "S","S","S","S","S","S","S","S","S",
198 "c","S","c","S","c","S","c","S","c",
199 " "," "," "," "," "," "," "," "," ",
200 " "," "," "," "," "," "," "," ","<",
201 " "," "," "," "," "," "," "," "," ",
202 "c","S","c","S","c","S","c","S","c",
203 "S","S","S","S","S","S","S","S","S",
204 "S","S","S","S","S","^","S","S","S",
207 -- tiny
209 style = "yrepeat",
210 layout = {
211 "S","S","S","S","S","S","S","S","v",
212 "S","S","S","S","S","S","S","S"," ",
213 "S","S","S","S","S","S","S","S"," ",
214 "S","S","S"," "," "," ","S","S"," ",
215 " "," "," "," ","<"," ","S","S"," ",
216 "S","S","S"," "," "," ","S","S"," ",
217 "S","S","S","S","S","S","S","S"," ",
218 "S","S","S","S","S","S","S","S"," ",
219 "S","S","S","S","S","S","S","S","^",
222 -- small
224 style = "yrepeat",
225 layout = {
226 "S","S","S","S","S","S","S","S","S",
227 "S","S","S","S","S","S","S","S","S",
228 "S","S"," ","v"," ","v"," ","S","S",
229 "S","S",">"," "," "," ","<","S"," ",
230 " "," "," "," ","c"," "," ","S"," ",
231 "S","S",">"," "," "," ","<","S"," ",
232 "S","S"," ","^"," ","^"," ","S","S",
233 "S","S","S","S","S","S","S","S","S",
234 "S","S","S","S","S","S","S","S","S",
237 -- small 2
239 style = "yrepeat",
240 layout = {
241 " "," "," "," "," "," "," "," "," ",
242 " ","S","S","S","S","S","S","S"," ",
243 " ","S"," "," ","v"," "," ","S"," ",
244 "S","S"," "," "," "," "," ","S"," ",
245 " "," "," "," "," "," ","<","S"," ",
246 "S","S"," "," "," "," "," ","S"," ",
247 " ","S"," "," ","^"," "," ","S"," ",
248 " ","S","S","S","S","S","S","S"," ",
249 " "," "," "," "," "," "," "," "," ",
252 -- big pillar
254 style = "yrepeat",
255 layout = {
256 " "," "," "," "," "," "," "," "," ",
257 " "," "," "," "," "," "," "," "," ",
258 " "," "," "," ","^"," "," "," "," ",
259 " "," "," ","c","c","c"," "," "," ",
260 " "," ","<","c","S","c",">"," "," ",
261 " "," "," ","c","c","c"," "," "," ",
262 " "," "," "," ","v"," "," "," "," ",
263 " "," "," "," "," "," "," "," "," ",
264 " "," "," "," "," "," "," "," "," ",
266 --traps = true,
268 -- pacman
270 style = "yrepeat",
271 layout = {
272 " "," "," "," "," "," "," "," "," ",
273 " "," "," "," "," "," "," "," "," ",
274 " "," "," ","c","c","c"," "," "," ",
275 " "," ","c","c","v","c","c"," "," ",
276 " "," ","c",">"," "," "," "," "," ",
277 " "," ","c","c","^","c","c"," "," ",
278 " "," "," ","c","c","c"," "," "," ",
279 " "," "," "," "," "," "," "," "," ",
280 " "," "," "," "," "," "," "," "," ",
283 -- the wall
285 style = "yrepeat",
286 layout = {
287 "S","S","S","S","S","S","S"," ","<",
288 "c","c","c","c","c","c","S"," ","c",
289 "c"," "," "," "," "," ","c"," ","<",
290 "c"," "," "," "," "," ","c"," ","c",
291 " "," "," "," "," ","<","c"," ","<",
292 "c"," "," "," "," "," ","c"," ","c",
293 "c"," "," "," "," "," ","c"," ","<",
294 "c","c","c","c","c","c","c"," ","c",
295 "S","S","S","S","S","S","S"," ","<",
298 -- split
300 style = "yrepeat",
301 layout = {
302 " "," "," "," "," "," "," "," "," ",
303 " "," "," "," "," "," "," "," "," ",
304 " "," "," "," "," "," "," "," "," ",
305 " "," "," ","^"," ","^"," "," "," ",
306 " "," "," ","c"," ","c"," "," "," ",
307 " "," "," ","v"," ","v"," "," "," ",
308 " "," "," "," "," "," "," "," "," ",
309 " "," "," "," "," "," "," "," "," ",
310 " "," "," "," "," "," "," "," "," ",
313 -- 4 small pillars
315 style = "yrepeat",
316 layout = {
317 " "," "," "," "," "," "," "," "," ",
318 " "," "," "," ","^"," "," "," "," ",
319 " "," "," "," ","c"," "," "," "," ",
320 " "," "," "," "," "," "," "," "," ",
321 " ","<","c"," "," "," ","c",">"," ",
322 " "," "," "," "," "," "," "," "," ",
323 " "," "," "," ","c"," "," "," "," ",
324 " "," "," "," ","v"," "," "," "," ",
325 " "," "," "," "," "," "," "," "," ",
328 -- 6 pillars
330 style = "yrepeat",
331 layout = {
332 " "," "," "," "," "," "," "," "," ",
333 " "," ","^"," ","^"," ","^"," "," ",
334 " "," ","c"," ","c"," ","c"," "," ",
335 " "," "," "," "," "," "," "," "," ",
336 " "," "," "," "," "," "," "," "," ",
337 " "," "," "," "," "," "," "," "," ",
338 " "," ","c"," ","c"," ","c"," "," ",
339 " "," ","v"," ","v"," ","v"," "," ",
340 " "," "," "," "," "," "," "," "," ",
342 traps = true,
344 -- stripes
346 style = "yrepeat",
347 layout = {
348 " ","S","v","S","v","S","v","S","v",
349 " ","S"," ","S"," ","S"," ","S"," ",
350 " ","c"," ","c"," ","c"," ","c"," ",
351 " "," "," "," "," "," "," "," "," ",
352 " "," "," "," "," "," "," "," "," ",
353 " "," "," "," "," "," "," "," "," ",
354 " ","c"," ","c"," ","c"," ","c"," ",
355 " ","S"," ","S"," ","S"," ","S"," ",
356 " ","S","^","S","^","S","^","S","^",
359 -- inside
361 style = "yrepeat",
362 layout = {
363 " "," "," "," "," "," "," "," "," ",
364 " ","c"," "," "," "," "," ","c"," ",
365 " "," "," "," "," "," "," "," "," ",
366 " "," "," ","c","S","c"," "," "," ",
367 " "," "," ","S",">"," "," "," "," ",
368 " "," "," ","c","S","c"," "," "," ",
369 " "," "," "," "," "," "," "," "," ",
370 " ","c"," "," "," "," "," ","c"," ",
371 " "," "," "," "," "," "," "," "," ",
374 -- 1 chest
376 style = "yrepeat",
377 layout = {
378 " "," "," "," "," "," "," "," "," ",
379 " "," "," "," "," "," "," "," "," ",
380 " "," "," "," "," "," "," "," "," ",
381 " "," "," "," "," "," "," "," "," ",
382 " "," "," "," ","<"," "," "," "," ",
383 " "," "," "," "," "," "," "," "," ",
384 " "," "," "," "," "," "," "," "," ",
385 " "," "," "," "," "," "," "," "," ",
386 " "," "," "," "," "," "," "," "," ",
389 -- 2 chests
391 style = "yrepeat",
392 layout = {
393 " "," "," "," "," "," "," "," "," ",
394 " "," "," "," "," "," "," "," ","<",
395 " "," "," "," "," "," "," "," "," ",
396 " "," "," "," "," "," "," "," "," ",
397 " "," "," "," "," "," "," "," "," ",
398 " "," "," "," "," "," "," "," "," ",
399 " "," "," "," "," "," "," "," "," ",
400 " "," "," "," "," "," "," "," ","<",
401 " "," "," "," "," "," "," "," "," ",
403 traps = true,
405 -- X
407 style = "yrepeat",
408 layout = {
409 "c"," "," "," "," "," "," "," ","c",
410 "c","c",">"," "," "," ","<","c","c",
411 " ","c","c"," "," "," ","c","c"," ",
412 " "," ","c","c"," ","c","c"," "," ",
413 " "," "," "," "," "," "," "," "," ",
414 " "," ","c","c"," ","c","c"," "," ",
415 " ","c","c"," "," "," ","c","c"," ",
416 "c","c",">"," "," "," ","<","c","c",
417 "c"," "," "," "," "," "," "," ","c",
420 -- split 2
422 style = "yrepeat",
423 layout = {
424 "S","S","S","S","S","S","S","S","S",
425 "S","S","S"," "," "," "," "," "," ",
426 "S","S","S"," "," "," "," "," "," ",
427 "S","S","S"," "," ","^","^","^","^",
428 " "," "," "," "," ","c","c","c","c",
429 "S","S","S"," "," ","v","v","v","v",
430 "S","S","S"," "," "," "," "," "," ",
431 "S","S","S"," "," "," "," "," "," ",
432 "S","S","S","S","S","S","S","S","S",
435 -- split 3
437 style = "yrepeat",
438 layout = {
439 " "," "," "," "," "," "," "," "," ",
440 " "," "," "," "," "," "," "," "," ",
441 " "," "," "," "," "," "," "," "," ",
442 " ","^"," ","^"," ","^"," ","^"," ",
443 " ","c"," ","c"," ","c"," ","c"," ",
444 " ","v"," ","v"," ","v"," ","v"," ",
445 " "," "," "," "," "," "," "," "," ",
446 " "," "," "," "," "," "," "," "," ",
447 " "," "," "," "," "," "," "," "," ",
450 -- diamond 2
452 style = "yrepeat",
453 layout = {
454 "S","S"," "," "," "," "," ","S","S",
455 "S"," "," "," ","c"," "," "," ","S",
456 " "," ","<","S","S","S",">"," "," ",
457 " "," ","S","S","S","S","S"," "," ",
458 " ","c","S","S","S","S","S","c"," ",
459 " "," ","S","S","S","S","S"," "," ",
460 " "," ","<","S","S","S",">"," "," ",
461 "S"," "," "," ","c"," "," "," ","S",
462 "S","S"," "," "," "," "," ","S","S",
465 -- ultra pillars
467 style = "yrepeat",
468 layout = {
469 " "," "," "," "," "," "," "," "," ",
470 " ","c","^","c"," ","c","^","c"," ",
471 " ","c","c","c"," ","c","c","c"," ",
472 " ","c","c","c"," ","c","c","c"," ",
473 " "," "," "," "," "," "," "," "," ",
474 " ","c","c","c"," ","c","c","c"," ",
475 " ","c","c","c"," ","c","c","c"," ",
476 " ","c","v","c"," ","c","v","c"," ",
477 " "," "," "," "," "," "," "," "," ",
480 -- vstripes
482 style = "yrepeat",
483 layout = {
484 "S"," "," "," "," "," "," "," "," ",
485 "S"," "," ","^"," "," ","^"," "," ",
486 "S"," "," ","c"," "," ","c"," "," ",
487 "S"," "," "," "," "," "," "," "," ",
488 " "," "," ","c"," "," ","c"," "," ",
489 "S"," "," "," "," "," "," "," "," ",
490 "S"," "," ","c"," "," ","c"," "," ",
491 "S"," "," ","v"," "," ","v"," "," ",
492 "S"," "," "," "," "," "," "," "," ",
495 -- sides
497 style = "yrepeat",
498 layout = {
499 "c"," ","c"," ","c"," ","c"," ","c",
500 " "," ","v"," ","v"," ","v"," "," ",
501 "c"," "," "," "," "," "," "," ","c",
502 " "," "," "," "," "," "," "," "," ",
503 " "," "," "," "," "," "," "," ","c",
504 " "," "," "," "," "," "," "," "," ",
505 "c"," "," "," "," "," "," "," ","c",
506 " "," ","^"," ","^"," ","^"," "," ",
507 "c"," ","c"," ","c"," ","c"," ","c",
509 traps = true,
511 -- 9 pillars
513 style = "yrepeat",
514 layout = {
515 " "," "," "," "," "," "," "," "," ",
516 " "," ","^"," ","^"," ","^"," "," ",
517 " "," ","c"," ","c"," ","c"," "," ",
518 " "," "," "," "," "," "," "," "," ",
519 " "," ","c"," ","c"," ","c"," "," ",
520 " "," "," "," "," "," "," "," "," ",
521 " "," ","c"," ","c"," ","c"," "," ",
522 " "," ","v"," ","v"," ","v"," "," ",
523 " "," "," "," "," "," "," "," "," ",
525 --traps = true,
527 -- Ankh statue
529 style = "stacked",
530 layout = { {
531 " "," "," "," "," "," "," "," "," ",
532 " "," "," "," "," "," "," "," "," ",
533 " "," "," "," "," "," "," "," "," ",
534 " "," "," "," "," "," "," "," "," ",
535 " "," "," "," ","s",">"," "," "," ",
536 " "," "," "," "," "," "," "," "," ",
537 " "," "," "," "," "," "," "," "," ",
538 " "," "," "," "," "," "," "," "," ",
539 " "," "," "," "," "," "," "," "," ",
541 " "," "," "," "," "," "," "," "," ",
542 " "," "," "," "," "," "," "," "," ",
543 " "," "," "," "," "," "," "," "," ",
544 " "," "," "," ","s"," "," "," "," ",
545 " "," "," "," ","s"," "," "," "," ",
546 " "," "," "," ","s"," "," "," "," ",
547 " "," "," "," "," "," "," "," "," ",
548 " "," "," "," "," "," "," "," "," ",
549 " "," "," "," "," "," "," "," "," ",
551 " "," "," "," "," "," "," "," "," ",
552 " "," "," "," "," "," "," "," "," ",
553 " "," "," "," "," "," "," "," "," ",
554 " "," "," "," "," "," "," "," "," ",
555 " "," "," "," ","s"," "," "," "," ",
556 " "," "," "," "," "," "," "," "," ",
557 " "," "," "," "," "," "," "," "," ",
558 " "," "," "," "," "," "," "," "," ",
559 " "," "," "," "," "," "," "," "," ",
561 " "," "," "," "," "," "," "," "," ",
562 " "," "," "," "," "," "," "," "," ",
563 " "," "," "," "," "," "," "," "," ",
564 " "," "," "," ","s"," "," "," "," ",
565 " "," "," "," "," "," "," "," "," ",
566 " "," "," "," ","s"," "," "," "," ",
567 " "," "," "," "," "," "," "," "," ",
568 " "," "," "," "," "," "," "," "," ",
569 " "," "," "," "," "," "," "," "," ",
571 " "," "," "," "," "," "," "," "," ",
572 " "," "," "," "," "," "," "," "," ",
573 " "," "," "," "," "," "," "," "," ",
574 " "," "," "," "," "," "," "," "," ",
575 " "," "," "," ","s"," "," "," "," ",
576 " "," "," "," "," "," "," "," "," ",
577 " "," "," "," "," "," "," "," "," ",
578 " "," "," "," "," "," "," "," "," ",
579 " "," "," "," "," "," "," "," "," ",
581 stype = "desert_sandstone",
582 wall = {
583 "S","S","S","S","S","S","S","S","S",
584 "s","1","s","1","s","1","s","1","s",
585 "S","S","S","S","S","S","S","S","S",
586 "1","s","1","s","1","s","1","s","1",
587 "S","S","S","S","S","S","S","S","S",
590 --[[
591 -- Cactus room 1
593 style = "stacked",
594 layout_offset = -1,
595 layout_height = 5,
596 layout = {{
597 "s","s","s","s","s","s","s","s","s",
598 "s","a","a","a","a","a","a","a","s",
599 "s","a","a","a","a","a","a","a","s",
600 "s","a","a","a","a","a","a","a","s",
601 "s","a","a","a","a","a","a","a","s",
602 "s","a","a","a","a","a","a","a","s",
603 "s","a","a","a","a","a","a","a","s",
604 "s","a","a","a","a","a","a","a","s",
605 "s","s","s","s","s","s","s","s","s",
607 " "," "," "," "," "," "," "," ","<",
608 " ","C"," ","C"," ","C"," ","C"," ",
609 " "," "," "," "," "," "," "," "," ",
610 " ","C"," ","C"," ","C"," ","C"," ",
611 " "," "," "," "," "," "," "," "," ",
612 " ","C"," ","C"," ","C"," ","C"," ",
613 " "," "," "," "," "," "," "," "," ",
614 " ","C"," ","C"," ","C"," ","C"," ",
615 " "," "," "," "," "," "," "," ","<",
618 wall = {
619 "S","S","S","S","S","S","S","S","S",
620 "S","S","S","S","S","S","S","S","S",
621 "s","3","s","3","s","3","s","3","s",
622 "S","S","S","S","S","S","S","S","S",
623 "S","S","S","S","S","S","S","S","S",
625 stype = "desert_sandstone",
628 -- Cactus room 2
630 style = "stacked",
631 layout_offset = -1,
632 layout_height = 5,
633 layout = {{
634 "S","S","S","S","S","S","S","S","S",
635 "S","s","s","s","s","s","s","s","S",
636 "S","s","a","a","a","a","a","s","S",
637 "S","s","a","a","a","a","a","s","S",
638 "S","s","a","a","a","a","a","s","S",
639 "S","s","a","a","a","a","a","s","S",
640 "S","s","a","a","a","a","a","s","S",
641 "S","s","s","s","s","s","s","s","S",
642 "S","S","S","S","S","S","S","S","S",
644 " "," "," "," "," "," "," "," ","<",
645 " "," "," "," "," "," "," "," "," ",
646 " "," ","C"," ","C"," ","C"," "," ",
647 " "," "," "," "," "," "," "," "," ",
648 " "," ","C"," ","C"," ","C"," "," ",
649 " "," "," "," "," "," "," "," "," ",
650 " "," ","C"," ","C"," ","C"," "," ",
651 " "," "," "," "," "," "," "," "," ",
652 " "," "," "," "," "," "," "," ","<",
655 wall = {
656 "S","S","S","S","S","S","S","S","S",
657 "S","S","S","S","S","S","S","S","S",
658 "s","3","s","3","s","3","s","3","s",
659 "S","S","S","S","S","S","S","S","S",
660 "S","S","S","S","S","S","S","S","S",
662 stype = "desert_sandstone",
664 -- Sun room
666 style = "stacked",
667 layout_offset = 0,
668 layout_height = 8,
669 layout = {{
670 "n","s","s","s","s","s","s","s","n",
671 "s","n","s","s","s","s","s","n","s",
672 "s","s","n","n","n","n","n","s","s",
673 "s","s","n","s","s","s","n","s","s",
674 "s","s","n","s","s","s","n","s","s",
675 "s","s","n","s","s","s","n","s","s",
676 "s","s","n","n","n","n","n","s","s",
677 "s","n","s","s","s","s","s","n","s",
678 "n","s","s","s","s","s","s","s","n",
680 " "," "," "," "," "," "," "," "," ",
681 " "," "," "," "," "," "," "," "," ",
682 " "," "," "," "," "," "," "," "," ",
683 " "," "," "," "," "," "," "," "," ",
684 " "," "," "," ","<"," "," "," "," ",
685 " "," "," "," "," "," "," "," "," ",
686 " "," "," "," "," "," "," "," "," ",
687 " "," "," "," "," "," "," "," "," ",
688 " "," "," "," "," "," "," "," "," ",
690 "n","s","s","s","s","s","s","s","n",
691 "s","n","s","s","s","s","s","n","s",
692 "s","s","n","n","n","n","n","s","s",
693 "s","s","n","s","s","s","n","s","s",
694 "s","s","n","s","s","s","n","s","s",
695 "s","s","n","s","s","s","n","s","s",
696 "s","s","n","n","n","n","n","s","s",
697 "s","n","s","s","s","s","s","n","s",
698 "n","s","s","s","s","s","s","s","n",
700 wall = {
701 "S","S","S","S","S","S","S","S","S",
702 "s","3","s","3","s","3","s","3","s",
703 "S","S","S","S","S","S","S","S","S",
704 "3","s","3","s","3","s","3","s","3",
705 "S","S","S","S","S","S","S","S","S",
707 stype = "sandstone",
708 open_roof = true,
710 -- Attic
712 style = "stacked",
713 layout_height = 6,
714 layout_offset = 1,
715 layout = { {
716 " "," "," "," "," "," "," "," "," ",
717 " ","S","S","S"," ","S","S","S"," ",
718 " ","S"," "," "," "," "," ","S"," ",
719 " ","S"," "," "," "," "," ","S"," ",
720 " "," "," "," ","c",">"," "," "," ",
721 " ","S"," "," "," "," "," ","S"," ",
722 " ","S"," "," "," "," "," ","S"," ",
723 " ","S","S","S"," ","S","S","S"," ",
724 " "," "," "," "," "," "," "," "," ",
726 " "," "," "," "," "," "," "," "," ",
727 " ","S","S","S"," ","S","S","S"," ",
728 " ","S"," "," "," "," "," ","S"," ",
729 " ","S"," "," "," "," "," ","S"," ",
730 " "," "," "," ","c"," "," "," "," ",
731 " ","S"," "," "," "," "," ","S"," ",
732 " ","S"," "," "," "," "," ","S"," ",
733 " ","S","S","S"," ","S","S","S"," ",
734 " "," "," "," "," "," "," "," "," ",
736 " "," "," "," "," "," "," "," "," ",
737 " ","S","S","S"," ","S","S","S"," ",
738 " ","S"," "," "," "," "," ","S"," ",
739 " ","S"," "," "," "," "," ","S"," ",
740 " "," "," "," ","c"," "," "," "," ",
741 " ","S"," "," "," "," "," ","S"," ",
742 " ","S"," "," "," "," "," ","S"," ",
743 " ","S","S","S"," ","S","S","S"," ",
744 " "," "," "," "," "," "," "," "," ",
746 "s","s","s","s","s","s","s","s","s",
747 "s","S","S","S","S","S","S","S","s",
748 "s","S","s","s","s","s","s","S","s",
749 "s","S","s","s","s","s","s","S","s",
750 "s","S","s","s","s","s","s","S","s",
751 "s","S","s","s","s","s","s","S","s",
752 "s","S","s","s","s","s","s","S","s",
753 "s","S","S","S","S","S","S","S","c",
754 "s","s","s","s","s","s","s","s","s",
756 "S","S","S","S","S","S","S","S","S",
757 "S","S","S","S","v","S","S","S","S",
758 "S","S"," "," "," "," "," ","S","S",
759 "S","S"," "," "," "," "," ","S","S",
760 "S",">"," "," "," "," "," ","<","S",
761 "S","S"," "," "," "," "," ","S","S",
762 "S","S"," "," "," "," "," ","S","S",
763 "S","S","S","S","^","S","S","S","S",
764 "S","S","S","S","S","S","S","S","S",
766 "S","S","S","S","S","S","S","S","S",
767 "S","S","S","S","S","S","S","S","S",
768 "S","S"," "," "," "," "," ","S","S",
769 "S","S"," "," "," "," "," ","S","S",
770 "S","S"," "," "," "," "," ","S","S",
771 "S","S"," "," "," "," "," ","S","S",
772 "S","S"," "," "," "," "," ","S","S",
773 "S","S","S","S","S","S","S","S","S",
774 "S","S","S","S","S","S","S","S","S",
779 local layout_traps
780 local layout_traps_template = {
781 "S","S","S","S","S","S","S","S","S",
782 "?","?","?","?","?","?","?","?","S",
783 "?","?","?","?","?","?","?","?","S",
784 "?","?","?","?","?","?","?","?","S",
785 "?","?","?","?","?","?","?","?","S", -- << entrance on left side
786 "?","?","?","?","?","?","?","?","S",
787 "?","?","?","?","?","?","?","?","S",
788 "?","?","?","?","?","?","?","?","S",
789 "S","S","S","S","S","S","S","S","S"
792 local code_sandstone = {
793 [" "] = "air",
794 ["c"] = "default:sandstone",
795 ["s"] = "default:sandstone",
796 ["n"] = "default:desert_sandstone",
797 ["h"] = "default:sandstone",
798 ["S"] = "default:sandstonebrick",
799 ["1"] = "tsm_pyramids:deco_stone1",
800 ["2"] = "tsm_pyramids:deco_stone2",
801 ["3"] = "tsm_pyramids:deco_stone3",
802 ["^"] = "default:chest",
803 ["<"] = "default:chest",
804 [">"] = "default:chest",
805 ["v"] = "default:chest",
806 ["~"] = "default:lava_source",
807 ["t"] = "tsm_pyramids:trap",
808 ["C"] = "default:large_cactus_seedling",
809 ["a"] = "default:sand",
811 local code_desert_sandstone = table.copy(code_sandstone)
812 code_desert_sandstone["c"] = "default:desert_sandstone"
813 code_desert_sandstone["s"] = "default:desert_sandstone"
814 code_desert_sandstone["n"] = "default:sandstone"
815 code_desert_sandstone["h"] = "default:desert_sandstone"
816 code_desert_sandstone["1"] = "tsm_pyramids:deco_stone4"
817 code_desert_sandstone["2"] = "tsm_pyramids:deco_stone5"
818 code_desert_sandstone["3"] = "tsm_pyramids:deco_stone6"
819 code_desert_sandstone["S"] = "default:desert_sandstone_brick"
820 code_desert_sandstone["t"] = "tsm_pyramids:desert_trap"
821 code_desert_sandstone["a"] = "default:desert_sand"
823 local code_desert_stone = table.copy(code_sandstone)
824 code_desert_stone["c"] = "default:desert_stone_block"
825 code_desert_stone["s"] = "default:desert_stone_block"
826 code_desert_stone["n"] = "default:desert_stone_block"
827 code_desert_stone["h"] = "default:desert_stone_block"
828 code_desert_stone["1"] = "default:desert_stone_block"
829 code_desert_stone["2"] = "default:desert_stone_block"
830 code_desert_stone["3"] = "default:desert_stone_block"
831 code_desert_stone["S"] = "default:desert_stonebrick"
832 code_desert_stone["t"] = "air"
833 code_desert_stone["a"] = "default:desert_sand"
835 local function replace(str, iy, code_table, deco, column_style)
836 if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end
837 if str == "h" then
838 local r = math.random(0,3)
839 if r > 0 then
840 str = deco[r]
841 else
842 str = "c"
844 elseif column_style == 1 or column_style == 2 then
845 if iy == 0 and str == "c" then str = deco[1] end
846 if iy == 3 and str == "c" then str = deco[2] end
847 elseif column_style == 3 then
848 if iy == 0 and str == "c" then str = deco[1] end
849 if iy == 2 and str == "c" then str = deco[2] end
850 elseif column_style == 4 then
851 if iy == 2 and str == "c" then str = deco[1] end
853 return code_table[str]
856 local function replace2(str, iy, depth, code_table)
857 if iy == depth then
858 -- Sandstone at the bottom-most layer
859 str = "s"
860 elseif iy == depth-1 then
861 -- Brick at the layer above
862 str = "S"
863 elseif iy == 0 and str == "~" then
864 -- Trap stones at the top layer
865 str = "t"
866 elseif iy < depth-3 and str == "~" then
867 -- Air below the trap stones
868 str = " "
870 -- Everything else is untouched (will stay pyramid material)
872 return code_table[str]
875 local function get_flat_index(x, y, width)
876 return 1 + x + y * width
879 local function rotate_layout_single(layout, width)
880 local size = width*width
881 local new_layout = {}
882 for x=0, width-1 do
883 for y=0, width-1 do
884 local symbol = layout[get_flat_index((width-1) - y, x, width)]
885 -- Rotate chest
886 if symbol == "^" then
887 symbol = "<"
888 elseif symbol == "<" then
889 symbol = "v"
890 elseif symbol == "v" then
891 symbol = ">"
892 elseif symbol == ">" then
893 symbol = "^"
895 new_layout[get_flat_index(x, y, width)] = symbol
898 return new_layout
901 local function rotate_layout(layout, width, rotations)
902 local new_layout = table.copy(layout)
903 for r=1, rotations do
904 new_layout = rotate_layout_single(new_layout, width)
906 return new_layout
909 -- pos: Position to spawn pyramid
910 -- stype: Sand type ("sandstone" or "desert")
911 -- room_id: Room layout identified (see list of rooms above)
912 -- rotations: Number of times to rotate the room (0-3)
913 function tsm_pyramids.make_room(pos, stype, room_id, rotations)
914 local code_table = code_sandstone
915 if stype == "desert_sandstone" then
916 code_table = code_desert_sandstone
917 elseif stype == "desert_stone" then
918 code_table = code_desert_stone
920 -- Select random deco block
921 local deco_ids = {"1", "2", "3"}
922 local deco = {}
923 for i=1, 3 do
924 local r = math.random(1, #deco_ids)
925 table.insert(deco, deco_ids[r])
926 table.remove(deco_ids, r)
928 local hole = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
929 if room_id == nil then
930 room_id = math.random(1, #room_types)
932 local room
933 if room_id < 1 or room_id > #room_types then
934 return false, S("Incorrect room type ID: @1", room_id)
936 local room = table.copy(room_types[room_id])
937 local tries = 0
938 while tries < #room_types do
939 if room.stype and room.stype ~= stype then
940 room_id = room_id + 1
941 if room_id > #room_types then
942 room_id = 1
944 room = table.copy(room_types[room_id])
945 else
946 break
948 tries = tries + 1
950 local chests = {}
951 local column_style
952 if stype == "desert_stone" then
953 column_style = 0
954 else
955 column_style = math.random(0,4)
957 -- Custom room walls
958 if room.wall then
959 for iy=0,4,1 do
960 for ie=0,8,1 do
961 local nn = code_table[room.wall[iy*9+ie+1]]
962 minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z-1}, {name=nn})
963 minetest.set_node({x=hole.x-1, y=hole.y-iy, z=hole.z+ie}, {name=nn})
965 minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z+9}, {name=nn})
966 minetest.set_node({x=hole.x+9, y=hole.y-iy, z=hole.z+ie}, {name=nn})
970 local layout
971 -- Place the room nodes
972 if room.style == "yrepeat" then
973 layout = rotate_layout(room.layout, ROOM_WIDTH, rotations)
974 for iy=0,4,1 do
975 for ix=0,8,1 do
976 for iz=0,8,1 do
977 local n_str = layout[ix*9+iz+1]
978 local p2 = 0
979 if n_str == "<" then
980 p2 = 0
981 elseif n_str == ">" then
982 p2 = 2
983 elseif n_str == "^" then
984 p2 = 1
985 elseif n_str == "v" then
986 p2 = 3
988 local cpos = {x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}
989 local nn = replace(n_str, iy, code_table, deco, column_style)
990 minetest.set_node(cpos, {name=nn, param2=p2})
991 if nn == "default:chest" then
992 table.insert(chests, cpos)
997 elseif room.style == "stacked" then
998 local layout_list = room.layout
999 local layout
1000 local layout_offset = room.layout_offset
1001 local layout_height = room.layout_height
1002 if not layout_offset then
1003 layout_offset = 0
1005 if not layout_height then
1006 layout_height = 5
1008 for iy=0,layout_height-1,1 do
1009 layout = nil
1010 if layout_list[layout_height-iy] then
1011 layout = rotate_layout(layout_list[layout_height-iy], ROOM_WIDTH, rotations)
1013 for ix=0,8,1 do
1014 for iz=0,8,1 do
1015 local n_str
1016 if layout then
1017 n_str = layout[ix*9+iz+1]
1018 else
1019 n_str = " "
1021 local p2 = 0
1022 if n_str == "<" then
1023 p2 = 0
1024 elseif n_str == ">" then
1025 p2 = 2
1026 elseif n_str == "^" then
1027 p2 = 1
1028 elseif n_str == "v" then
1029 p2 = 3
1031 local cpos = {x=hole.x+ix,y=hole.y-iy+layout_offset,z=hole.z+iz}
1032 local nn = code_table[n_str]
1033 minetest.set_node(cpos, {name=nn, param2=p2})
1034 if nn == "default:chest" then
1035 table.insert(chests, cpos)
1040 else
1041 minetest.log("error", "Invalid pyramid room style! room type ID="..r)
1043 local sanded = room.flood_sand ~= false and stype ~= "desert_stone" and math.random(1,8) == 1
1044 if #chests > 0 then
1045 -- Make at least 8 attempts to fill chests
1046 local filled = 0
1047 while filled < 8 do
1048 for c=1, #chests do
1049 tsm_pyramids.fill_chest(chests[c], stype, sanded)
1050 filled = filled + 1
1054 if room.traps then
1055 tsm_pyramids.make_traps(pos, stype, rotations, layout)
1057 if sanded then
1058 tsm_pyramids.flood_sand(pos, stype)
1060 return true, nil, sanded
1063 local shuffle_traps = function(chance, layout_room)
1064 layout_traps = table.copy(layout_traps_template)
1065 for a=1, #layout_traps do
1066 -- Delete trap if this space of the room is occupied
1067 if layout_room[a] ~= " " then
1068 layout_traps[a] = "S"
1069 -- Randomly turn tile into a trap, or not
1070 elseif layout_traps[a] == "?" then
1071 -- percentage for a trap
1072 if math.random(1,100) <= chance then
1073 layout_traps[a] = "~"
1074 else
1075 layout_traps[a] = "S"
1081 function tsm_pyramids.make_traps(pos, stype, rotations, layout_room)
1082 local code_table = code_sandstone
1083 if stype == "desert_sandstone" then
1084 code_table = code_desert_sandstone
1085 elseif stype == "desert_stone" then
1086 code_table = code_desert_stone
1088 shuffle_traps(math.random(10,100), layout_room)
1089 local hole = {x=pos.x+7,y=pos.y, z=pos.z+7}
1090 local layout = rotate_layout(layout_traps, ROOM_WIDTH, rotations)
1091 -- Depth is total depth of trap area:
1092 -- * top layer with trap stones
1093 -- * followed by air layers
1094 -- * followed by 2 layer of lava
1095 -- * and 2 layers of sandstone/brick at the bottom (to prevent lava escaping)
1096 -- The depth of air between trap stones and lava layer is <depth> - 4
1097 local depth = 7
1098 local wmin, wmax = -1,9
1099 for iy=0,depth,1 do
1100 for ix=wmin,wmax,1 do
1101 for iz=wmin,wmax,1 do
1102 local n_str
1103 if ix == wmin or ix == wmax or iz == wmin or iz == wmax then
1104 -- Walls around room
1105 if iy == depth then
1106 n_str = code_table["s"]
1107 else
1108 n_str = code_table["S"]
1110 minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=n_str})
1111 else
1112 -- Walls below room
1113 n_str = layout[ix*9+iz+1]
1114 minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace2(n_str, iy, depth, code_table)})
1121 function tsm_pyramids.flood_sand(pos, stype)
1122 local set_to_sand = {}
1123 local nn = "default:sand"
1124 if stype == "desert_sandstone" or stype == "desert_stone" then
1125 nn = "default:desert_sand"
1127 local hole = {x=pos.x+7,y=pos.y+1, z=pos.z+7}
1128 local maxh = math.random(1,4)
1129 local chance = math.random(1,7)
1130 for ix=0,8,1 do
1131 for iz=0,8,1 do
1132 if math.random(1,chance) == 1 then
1133 local h = math.random(1,maxh)
1134 for iy=0,h,1 do
1135 local p = {x=hole.x+ix,y=hole.y+iy,z=hole.z+iz}
1136 if minetest.get_node(p).name == "air" then
1137 table.insert(set_to_sand, p)
1143 minetest.bulk_set_node(set_to_sand, {name=nn})