Guarantee 1 chest with treasures
[minetest_pyramids/tsm_pyramids.git] / room.lua
bloba9991d9fda1f98f2d6400e32cab28d1744d39033
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 " "," "," "," ","^"," "," "," "," "
53 traps = true,
55 -- hidden room
57 style = "yrepeat",
58 layout = {
59 " "," "," "," "," "," "," "," "," ",
60 " "," "," "," "," "," "," "," "," ",
61 " "," ","c","S","c","S","c"," "," ",
62 " "," ","S"," "," "," ","S"," "," ",
63 " "," ","c"," ",">"," ","c"," ","<",
64 " "," ","S"," "," "," ","S"," "," ",
65 " "," ","c","S","c","S","c"," "," ",
66 " "," "," "," "," "," "," "," "," ",
67 " "," "," "," "," "," "," "," "," "
70 -- spiral 1
72 style = "yrepeat",
73 layout = {
74 " "," "," "," "," "," "," "," "," ",
75 " ","S","S","S","S","S","S","S"," ",
76 " ","S"," "," "," "," "," ","S"," ",
77 " ","S"," ","c","c","c"," ","S"," ",
78 " ","S"," ","c","v","c"," ","S"," ",
79 "S","S"," ","c"," ","c"," ","S"," ",
80 "S","S"," ","c"," "," "," ","S"," ",
81 "v","S"," ","S","S","S","S","S"," ",
82 " ","S"," "," "," "," "," "," "," "
85 -- spiral 2
87 style = "yrepeat",
88 layout = {
89 " "," "," "," "," "," "," "," "," ",
90 " ","S","S","S","S","S","S","S"," ",
91 " "," "," ","c"," "," "," ","S"," ",
92 "S","S"," ","c"," ","c"," ","S"," ",
93 " ","S"," ","c","^","c"," ","S"," ",
94 " ","S"," ","c","c","c"," ","S"," ",
95 " ","S"," "," "," "," "," ","S"," ",
96 " ","S","S","S","S","S","S","S"," ",
97 " "," "," "," "," "," "," "," "," "
100 -- pillar mania
102 style = "yrepeat",
103 layout = {
104 " "," ","v"," ","v"," ","v"," ","v",
105 " ","c"," ","c"," ","c"," ","c"," ",
106 " "," "," "," "," "," "," "," "," ",
107 " ","c"," ","c"," ","c"," ","c"," ",
108 " "," "," "," "," "," "," "," "," ",
109 " ","c"," ","c"," ","c"," ","c"," ",
110 " "," "," "," "," "," "," "," "," ",
111 " ","c"," ","c"," ","c"," ","c"," ",
112 " "," ","^"," ","^"," ","^"," ","^",
114 traps = true,
116 -- plusses
118 style = "yrepeat",
119 layout = {
120 "c"," "," "," "," "," "," "," ","c",
121 " "," ","c",">"," ","<","c"," "," ",
122 " ","c","s","c"," ","c","s","c"," ",
123 " "," ","c"," "," "," ","c"," "," ",
124 " "," "," "," ","<"," "," "," "," ",
125 " "," ","c"," "," "," ","c"," "," ",
126 " ","c","s","c"," ","c","s","c"," ",
127 " "," ","c",">"," ","<","c"," "," ",
128 "c"," "," "," "," "," "," "," ","c",
130 traps = true,
132 -- diamond
134 style = "yrepeat",
135 layout = {
136 ">","s","s","c","c","c","s","s","s",
137 "s","s","c"," "," "," ","c","s","s",
138 "s","c"," "," "," "," "," ","c","s",
139 "c"," "," "," "," "," "," "," ","c",
140 " "," "," "," "," "," "," ","<","c",
141 "c"," "," "," "," "," "," "," ","c",
142 "s","c"," "," "," "," "," ","c","s",
143 "s","s","c"," "," "," ","c","s","s",
144 ">","s","s","c","c","c","s","s","s",
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"," "," "," "," ",
191 traps = true,
193 -- hallway 4
195 style = "yrepeat",
196 layout = {
197 "S","S","S","S","S","v","S","S","S",
198 "S","S","S","S","S","S","S","S","S",
199 "c","S","c","S","c","S","c","S","c",
200 " "," "," "," "," "," "," "," "," ",
201 " "," "," "," "," "," "," "," ","<",
202 " "," "," "," "," "," "," "," "," ",
203 "c","S","c","S","c","S","c","S","c",
204 "S","S","S","S","S","S","S","S","S",
205 "S","S","S","S","S","^","S","S","S",
208 -- tiny
210 style = "yrepeat",
211 layout = {
212 "S","S","S","S","S","S","S","S","v",
213 "S","S","S","S","S","S","S","S"," ",
214 "S","S","S","S","S","S","S","S"," ",
215 "S","S","S"," "," "," ","S","S"," ",
216 " "," "," "," ","<"," ","S","S"," ",
217 "S","S","S"," "," "," ","S","S"," ",
218 "S","S","S","S","S","S","S","S"," ",
219 "S","S","S","S","S","S","S","S"," ",
220 "S","S","S","S","S","S","S","S","^",
223 -- small
225 style = "yrepeat",
226 layout = {
227 "S","S","S","S","S","S","S","S","S",
228 "S","S","S","S","S","S","S","S","S",
229 "S","S"," ","v"," ","v"," ","S","S",
230 "S","S",">"," "," "," ","<","S"," ",
231 " "," "," "," ","c"," "," ","S"," ",
232 "S","S",">"," "," "," ","<","S"," ",
233 "S","S"," ","^"," ","^"," ","S","S",
234 "S","S","S","S","S","S","S","S","S",
235 "S","S","S","S","S","S","S","S","S",
238 -- small 2
240 style = "yrepeat",
241 layout = {
242 " "," "," "," "," "," "," "," "," ",
243 " ","S","S","S","S","S","S","S"," ",
244 " ","S"," "," ","v"," "," ","S"," ",
245 "S","S"," "," "," "," "," ","S"," ",
246 " "," "," "," "," "," ","<","S"," ",
247 "S","S"," "," "," "," "," ","S"," ",
248 " ","S"," "," ","^"," "," ","S"," ",
249 " ","S","S","S","S","S","S","S"," ",
250 " "," "," "," "," "," "," "," "," ",
253 -- big pillar
255 style = "yrepeat",
256 layout = {
257 " "," "," "," "," "," "," "," "," ",
258 " "," "," "," "," "," "," "," "," ",
259 " "," "," "," ","^"," "," "," "," ",
260 " "," "," ","c","c","c"," "," "," ",
261 " "," ","<","c","S","c",">"," "," ",
262 " "," "," ","c","c","c"," "," "," ",
263 " "," "," "," ","v"," "," "," "," ",
264 " "," "," "," "," "," "," "," "," ",
265 " "," "," "," "," "," "," "," "," ",
267 traps = true,
269 -- pacman
271 style = "yrepeat",
272 layout = {
273 " "," "," "," "," "," "," "," "," ",
274 " "," "," "," "," "," "," "," "," ",
275 " "," "," ","c","c","c"," "," "," ",
276 " "," ","c","c","v","c","c"," "," ",
277 " "," ","c",">"," "," "," "," "," ",
278 " "," ","c","c","^","c","c"," "," ",
279 " "," "," ","c","c","c"," "," "," ",
280 " "," "," "," "," "," "," "," "," ",
281 " "," "," "," "," "," "," "," "," ",
283 traps = true,
285 -- the wall
287 style = "yrepeat",
288 layout = {
289 "S","S","S","S","S","S","S"," ","<",
290 "s","c","s","c","s","c","s"," ","c",
291 "c"," "," "," "," "," ","c"," ","<",
292 "s"," "," "," "," "," ","s"," ","c",
293 " "," "," "," "," ","<","c"," ","<",
294 "s"," "," "," "," "," ","s"," ","c",
295 "c"," "," "," "," "," ","c"," ","<",
296 "s","c","s","c","s","c","s"," ","c",
297 "S","S","S","S","S","S","S"," ","<",
299 traps = true,
301 -- split
303 style = "yrepeat",
304 layout = {
305 " "," "," "," "," "," "," "," "," ",
306 " "," "," "," "," "," "," "," "," ",
307 " "," "," "," "," "," "," "," "," ",
308 " "," "," ","^"," ","^"," "," "," ",
309 " "," "," ","c"," ","c"," "," "," ",
310 " "," "," ","v"," ","v"," "," "," ",
311 " "," "," "," "," "," "," "," "," ",
312 " "," "," "," "," "," "," "," "," ",
313 " "," "," "," "," "," "," "," "," ",
315 traps = true,
317 -- 4 small pillars
319 style = "yrepeat",
320 layout = {
321 " "," "," "," "," "," "," "," "," ",
322 " "," "," "," ","^"," "," "," "," ",
323 " "," "," "," ","c"," "," "," "," ",
324 " "," "," "," "," "," "," "," "," ",
325 " ","<","c"," "," "," ","c",">"," ",
326 " "," "," "," "," "," "," "," "," ",
327 " "," "," "," ","c"," "," "," "," ",
328 " "," "," "," ","v"," "," "," "," ",
329 " "," "," "," "," "," "," "," "," ",
331 traps = true,
333 -- 6 pillars
335 style = "yrepeat",
336 layout = {
337 " "," "," "," "," "," "," "," "," ",
338 " "," ","^"," ","^"," ","^"," "," ",
339 " "," ","c"," ","c"," ","c"," "," ",
340 " "," "," "," "," "," "," "," "," ",
341 " "," "," "," "," "," "," "," "," ",
342 " "," "," "," "," "," "," "," "," ",
343 " "," ","c"," ","c"," ","c"," "," ",
344 " "," ","v"," ","v"," ","v"," "," ",
345 " "," "," "," "," "," "," "," "," ",
347 traps = true,
349 -- stripes
351 style = "yrepeat",
352 layout = {
353 " ","S","v","S","v","S","v","S","v",
354 " ","S"," ","S"," ","S"," ","S"," ",
355 " ","c"," ","c"," ","c"," ","c"," ",
356 " "," "," "," "," "," "," "," "," ",
357 " "," "," "," "," "," "," "," "," ",
358 " "," "," "," "," "," "," "," "," ",
359 " ","c"," ","c"," ","c"," ","c"," ",
360 " ","S"," ","S"," ","S"," ","S"," ",
361 " ","S","^","S","^","S","^","S","^",
363 traps = true,
365 -- inside
367 style = "yrepeat",
368 layout = {
369 " "," "," "," "," "," "," "," "," ",
370 " ","c"," "," "," "," "," ","c"," ",
371 " "," "," "," "," "," "," "," "," ",
372 " "," "," ","c","S","c"," "," "," ",
373 " "," "," ","S",">"," "," "," "," ",
374 " "," "," ","c","S","c"," "," "," ",
375 " "," "," "," "," "," "," "," "," ",
376 " ","c"," "," "," "," "," ","c"," ",
377 " "," "," "," "," "," "," "," "," ",
380 -- 1 chest
382 style = "yrepeat",
383 layout = {
384 " "," "," "," "," "," "," "," "," ",
385 " "," "," "," "," "," "," "," "," ",
386 " "," "," "," "," "," "," "," "," ",
387 " "," "," "," "," "," "," "," "," ",
388 " "," "," "," ","<"," "," "," "," ",
389 " "," "," "," "," "," "," "," "," ",
390 " "," "," "," "," "," "," "," "," ",
391 " "," "," "," "," "," "," "," "," ",
392 " "," "," "," "," "," "," "," "," ",
394 traps = true,
396 -- 2 chests
398 style = "yrepeat",
399 layout = {
400 " "," "," "," "," "," "," "," "," ",
401 " "," "," "," "," "," "," "," ","<",
402 " "," "," "," "," "," "," "," "," ",
403 " "," "," "," "," "," "," "," "," ",
404 " "," "," "," "," "," "," "," "," ",
405 " "," "," "," "," "," "," "," "," ",
406 " "," "," "," "," "," "," "," "," ",
407 " "," "," "," "," "," "," "," ","<",
408 " "," "," "," "," "," "," "," "," ",
410 traps = true,
412 -- X
414 style = "yrepeat",
415 layout = {
416 "c"," "," "," "," "," "," "," ","c",
417 "c","c",">"," "," "," ","<","c","c",
418 " ","c","c"," "," "," ","c","c"," ",
419 " "," ","c","c"," ","c","c"," "," ",
420 " "," "," "," "," "," "," "," "," ",
421 " "," ","c","c"," ","c","c"," "," ",
422 " ","c","c"," "," "," ","c","c"," ",
423 "c","c",">"," "," "," ","<","c","c",
424 "c"," "," "," "," "," "," "," ","c",
427 -- split 2
429 style = "yrepeat",
430 layout = {
431 "S","S","S","S","S","S","S","S","S",
432 "S","S","S"," "," "," "," "," "," ",
433 "S","S","S"," "," "," "," "," "," ",
434 "S","S","S"," "," ","^","^","^","^",
435 " "," "," "," "," ","c","c","c","c",
436 "S","S","S"," "," ","v","v","v","v",
437 "S","S","S"," "," "," "," "," "," ",
438 "S","S","S"," "," "," "," "," "," ",
439 "S","S","S","S","S","S","S","S","S",
442 -- split 3
444 style = "yrepeat",
445 layout = {
446 " "," "," "," "," "," "," "," "," ",
447 " "," "," "," "," "," "," "," "," ",
448 " "," "," "," "," "," "," "," "," ",
449 " ","^"," ","^"," ","^"," ","^"," ",
450 " ","c"," ","c"," ","c"," ","c"," ",
451 " ","v"," ","v"," ","v"," ","v"," ",
452 " "," "," "," "," "," "," "," "," ",
453 " "," "," "," "," "," "," "," "," ",
454 " "," "," "," "," "," "," "," "," ",
456 traps = true,
458 -- diamond 2
460 style = "yrepeat",
461 layout = {
462 "S","S"," "," "," "," "," ","S","S",
463 "S"," "," "," ","c"," "," "," ","S",
464 " "," ","<","S","S","S",">"," "," ",
465 " "," ","S","S","S","S","S"," "," ",
466 " ","c","S","S","S","S","S","c"," ",
467 " "," ","S","S","S","S","S"," "," ",
468 " "," ","<","S","S","S",">"," "," ",
469 "S"," "," "," ","c"," "," "," ","S",
470 "S","S"," "," "," "," "," ","S","S",
472 traps = true,
474 -- ultra pillars
476 style = "yrepeat",
477 layout = {
478 " "," "," "," "," "," "," "," "," ",
479 " ","c","^","c"," ","c","^","c"," ",
480 " ","c","c","c"," ","c","c","c"," ",
481 " ","c","c","c"," ","c","c","c"," ",
482 " "," "," "," "," "," "," "," "," ",
483 " ","c","c","c"," ","c","c","c"," ",
484 " ","c","c","c"," ","c","c","c"," ",
485 " ","c","v","c"," ","c","v","c"," ",
486 " "," "," "," "," "," "," "," "," ",
489 -- vstripes
491 style = "yrepeat",
492 layout = {
493 "S"," "," "," "," "," "," "," "," ",
494 "S"," "," ","^"," "," ","^"," "," ",
495 "S"," "," ","c"," "," ","c"," "," ",
496 "S"," "," "," "," "," "," "," "," ",
497 " "," "," ","c"," "," ","c"," "," ",
498 "S"," "," "," "," "," "," "," "," ",
499 "S"," "," ","c"," "," ","c"," "," ",
500 "S"," "," ","v"," "," ","v"," "," ",
501 "S"," "," "," "," "," "," "," "," ",
503 traps = true,
505 -- sides
507 style = "yrepeat",
508 layout = {
509 "c"," ","c"," ","c"," ","c"," ","c",
510 " "," ","v"," ","v"," ","v"," "," ",
511 "c"," "," "," "," "," "," "," ","c",
512 " "," "," "," "," "," "," "," "," ",
513 " "," "," "," "," "," "," "," ","c",
514 " "," "," "," "," "," "," "," "," ",
515 "c"," "," "," "," "," "," "," ","c",
516 " "," ","^"," ","^"," ","^"," "," ",
517 "c"," ","c"," ","c"," ","c"," ","c",
519 traps = true,
521 -- 9 pillars
523 style = "yrepeat",
524 layout = {
525 " "," "," "," "," "," "," "," "," ",
526 " "," ","^"," ","^"," ","^"," "," ",
527 " "," ","c"," ","c"," ","c"," "," ",
528 " "," "," "," "," "," "," "," "," ",
529 " "," ","c"," ","c"," ","c"," "," ",
530 " "," "," "," "," "," "," "," "," ",
531 " "," ","c"," ","c"," ","c"," "," ",
532 " "," ","v"," ","v"," ","v"," "," ",
533 " "," "," "," "," "," "," "," "," ",
535 traps = true,
537 -- Ankh statue
539 style = "stacked",
540 layout = { {
541 " "," "," "," "," "," "," "," "," ",
542 " "," "," "," "," "," "," "," "," ",
543 " "," "," "," "," "," "," "," "," ",
544 " "," "," "," "," "," "," "," "," ",
545 " "," "," "," ","s",">"," "," "," ",
546 " "," "," "," "," "," "," "," "," ",
547 " "," "," "," "," "," "," "," "," ",
548 " "," "," "," "," "," "," "," "," ",
549 " "," "," "," "," "," "," "," "," ",
551 " "," "," "," "," "," "," "," "," ",
552 " "," "," "," "," "," "," "," "," ",
553 " "," "," "," "," "," "," "," "," ",
554 " "," "," "," ","s"," "," "," "," ",
555 " "," "," "," ","s"," "," "," "," ",
556 " "," "," "," ","s"," "," "," "," ",
557 " "," "," "," "," "," "," "," "," ",
558 " "," "," "," "," "," "," "," "," ",
559 " "," "," "," "," "," "," "," "," ",
561 " "," "," "," "," "," "," "," "," ",
562 " "," "," "," "," "," "," "," "," ",
563 " "," "," "," "," "," "," "," "," ",
564 " "," "," "," "," "," "," "," "," ",
565 " "," "," "," ","s"," "," "," "," ",
566 " "," "," "," "," "," "," "," "," ",
567 " "," "," "," "," "," "," "," "," ",
568 " "," "," "," "," "," "," "," "," ",
569 " "," "," "," "," "," "," "," "," ",
571 " "," "," "," "," "," "," "," "," ",
572 " "," "," "," "," "," "," "," "," ",
573 " "," "," "," "," "," "," "," "," ",
574 " "," "," "," ","s"," "," "," "," ",
575 " "," "," "," "," "," "," "," "," ",
576 " "," "," "," ","s"," "," "," "," ",
577 " "," "," "," "," "," "," "," "," ",
578 " "," "," "," "," "," "," "," "," ",
579 " "," "," "," "," "," "," "," "," ",
581 " "," "," "," "," "," "," "," "," ",
582 " "," "," "," "," "," "," "," "," ",
583 " "," "," "," "," "," "," "," "," ",
584 " "," "," "," "," "," "," "," "," ",
585 " "," "," "," ","s"," "," "," "," ",
586 " "," "," "," "," "," "," "," "," ",
587 " "," "," "," "," "," "," "," "," ",
588 " "," "," "," "," "," "," "," "," ",
589 " "," "," "," "," "," "," "," "," ",
591 stype = "desert_sandstone",
592 wall = {
593 "S","S","S","S","S","S","S","S","S",
594 "s","1","s","1","s","1","s","1","s",
595 "S","S","S","S","S","S","S","S","S",
596 "1","s","1","s","1","s","1","s","1",
597 "S","S","S","S","S","S","S","S","S",
600 --[[
601 -- Cactus room 1
603 style = "stacked",
604 layout_offset = -1,
605 layout_height = 5,
606 layout = {{
607 "s","s","s","s","s","s","s","s","s",
608 "s","a","a","a","a","a","a","a","s",
609 "s","a","a","a","a","a","a","a","s",
610 "s","a","a","a","a","a","a","a","s",
611 "s","a","a","a","a","a","a","a","s",
612 "s","a","a","a","a","a","a","a","s",
613 "s","a","a","a","a","a","a","a","s",
614 "s","a","a","a","a","a","a","a","s",
615 "s","s","s","s","s","s","s","s","s",
617 " "," "," "," "," "," "," "," ","<",
618 " ","C"," ","C"," ","C"," ","C"," ",
619 " "," "," "," "," "," "," "," "," ",
620 " ","C"," ","C"," ","C"," ","C"," ",
621 " "," "," "," "," "," "," "," "," ",
622 " ","C"," ","C"," ","C"," ","C"," ",
623 " "," "," "," "," "," "," "," "," ",
624 " ","C"," ","C"," ","C"," ","C"," ",
625 " "," "," "," "," "," "," "," ","<",
628 wall = {
629 "S","S","S","S","S","S","S","S","S",
630 "S","S","S","S","S","S","S","S","S",
631 "s","3","s","3","s","3","s","3","s",
632 "S","S","S","S","S","S","S","S","S",
633 "S","S","S","S","S","S","S","S","S",
635 stype = "desert_sandstone",
638 -- Cactus room 2
640 style = "stacked",
641 layout_offset = -1,
642 layout_height = 5,
643 layout = {{
644 "S","S","S","S","S","S","S","S","S",
645 "S","s","s","s","s","s","s","s","S",
646 "S","s","a","a","a","a","a","s","S",
647 "S","s","a","a","a","a","a","s","S",
648 "S","s","a","a","a","a","a","s","S",
649 "S","s","a","a","a","a","a","s","S",
650 "S","s","a","a","a","a","a","s","S",
651 "S","s","s","s","s","s","s","s","S",
652 "S","S","S","S","S","S","S","S","S",
654 " "," "," "," "," "," "," "," ","<",
655 " "," "," "," "," "," "," "," "," ",
656 " "," ","C"," ","C"," ","C"," "," ",
657 " "," "," "," "," "," "," "," "," ",
658 " "," ","C"," ","C"," ","C"," "," ",
659 " "," "," "," "," "," "," "," "," ",
660 " "," ","C"," ","C"," ","C"," "," ",
661 " "," "," "," "," "," "," "," "," ",
662 " "," "," "," "," "," "," "," ","<",
665 wall = {
666 "S","S","S","S","S","S","S","S","S",
667 "S","S","S","S","S","S","S","S","S",
668 "s","3","s","3","s","3","s","3","s",
669 "S","S","S","S","S","S","S","S","S",
670 "S","S","S","S","S","S","S","S","S",
672 stype = "desert_sandstone",
674 -- Sun room
676 style = "stacked",
677 layout_offset = 0,
678 layout_height = 8,
679 layout = {{
680 "n","s","s","s","s","s","s","s","n",
681 "s","n","s","s","s","s","s","n","s",
682 "s","s","n","n","n","n","n","s","s",
683 "s","s","n","s","s","s","n","s","s",
684 "s","s","n","s","s","s","n","s","s",
685 "s","s","n","s","s","s","n","s","s",
686 "s","s","n","n","n","n","n","s","s",
687 "s","n","s","s","s","s","s","n","s",
688 "n","s","s","s","s","s","s","s","n",
690 " "," "," "," "," "," "," "," "," ",
691 " "," "," "," "," "," "," "," "," ",
692 " "," "," "," "," "," "," "," "," ",
693 " "," "," "," "," "," "," "," "," ",
694 " "," "," "," ","<"," "," "," "," ",
695 " "," "," "," "," "," "," "," "," ",
696 " "," "," "," "," "," "," "," "," ",
697 " "," "," "," "," "," "," "," "," ",
698 " "," "," "," "," "," "," "," "," ",
700 "n","s","s","s","s","s","s","s","n",
701 "s","n","s","s","s","s","s","n","s",
702 "s","s","n","n","n","n","n","s","s",
703 "s","s","n","s","s","s","n","s","s",
704 "s","s","n","s","s","s","n","s","s",
705 "s","s","n","s","s","s","n","s","s",
706 "s","s","n","n","n","n","n","s","s",
707 "s","n","s","s","s","s","s","n","s",
708 "n","s","s","s","s","s","s","s","n",
710 wall = {
711 "S","S","S","S","S","S","S","S","S",
712 "s","3","s","3","s","3","s","3","s",
713 "S","S","S","S","S","S","S","S","S",
714 "3","s","3","s","3","s","3","s","3",
715 "S","S","S","S","S","S","S","S","S",
717 stype = "sandstone",
718 open_roof = true,
720 -- Attic
722 style = "stacked",
723 layout_height = 6,
724 layout_offset = 1,
725 layout = { {
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 " "," "," "," "," "," "," "," "," ",
747 " ","S","S","S"," ","S","S","S"," ",
748 " ","S"," "," "," "," "," ","S"," ",
749 " ","S"," "," "," "," "," ","S"," ",
750 " "," "," "," ","c"," "," "," "," ",
751 " ","S"," "," "," "," "," ","S"," ",
752 " ","S"," "," "," "," "," ","S"," ",
753 " ","S","S","S"," ","S","S","S"," ",
754 " "," "," "," "," "," "," "," "," ",
756 "s","s","s","s","s","s","s","s","s",
757 "s","S","S","S","S","S","S","S","s",
758 "s","S","s","s","s","s","s","S","s",
759 "s","S","s","s","s","s","s","S","s",
760 "s","S","s","s","s","s","s","S","s",
761 "s","S","s","s","s","s","s","S","s",
762 "s","S","s","s","s","s","s","S","s",
763 "s","S","S","S","S","S","S","S","c",
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","v","S","S","S","S",
768 "S","S"," "," "," "," "," ","S","S",
769 "S","S"," "," "," "," "," ","S","S",
770 "S",">"," "," "," "," "," ","<","S",
771 "S","S"," "," "," "," "," ","S","S",
772 "S","S"," "," "," "," "," ","S","S",
773 "S","S","S","S","^","S","S","S","S",
774 "S","S","S","S","S","S","S","S","S",
776 "S","S","S","S","S","S","S","S","S",
777 "S","S","S","S","S","S","S","S","S",
778 "S","S"," "," "," "," "," ","S","S",
779 "S","S"," "," "," "," "," ","S","S",
780 "S","S"," "," "," "," "," ","S","S",
781 "S","S"," "," "," "," "," ","S","S",
782 "S","S"," "," "," "," "," ","S","S",
783 "S","S","S","S","S","S","S","S","S",
784 "S","S","S","S","S","S","S","S","S",
789 local layout_traps
790 local layout_traps_template = {
791 "S","S","S","S","S","S","S","S","S",
792 "?","?","?","?","?","?","?","?","S",
793 "?","?","?","?","?","?","?","?","S",
794 "?","?","?","?","?","?","?","?","S",
795 "?","?","?","?","?","?","?","?","S", -- << entrance on left side
796 "?","?","?","?","?","?","?","?","S",
797 "?","?","?","?","?","?","?","?","S",
798 "?","?","?","?","?","?","?","?","S",
799 "S","S","S","S","S","S","S","S","S"
802 local code_sandstone = {
803 [" "] = "air",
804 ["c"] = "default:sandstone",
805 ["s"] = "default:sandstone",
806 ["n"] = "default:desert_sandstone",
807 ["h"] = "default:sandstone",
808 ["S"] = "default:sandstonebrick",
809 ["1"] = "tsm_pyramids:deco_stone1",
810 ["2"] = "tsm_pyramids:deco_stone2",
811 ["3"] = "tsm_pyramids:deco_stone3",
812 ["^"] = "default:chest",
813 ["<"] = "default:chest",
814 [">"] = "default:chest",
815 ["v"] = "default:chest",
816 ["~"] = "default:lava_source",
817 ["t"] = "tsm_pyramids:trap",
818 ["C"] = "default:large_cactus_seedling",
819 ["a"] = "default:sand",
821 local code_desert_sandstone = table.copy(code_sandstone)
822 code_desert_sandstone["c"] = "default:desert_sandstone"
823 code_desert_sandstone["s"] = "default:desert_sandstone"
824 code_desert_sandstone["n"] = "default:sandstone"
825 code_desert_sandstone["h"] = "default:desert_sandstone"
826 code_desert_sandstone["1"] = "tsm_pyramids:deco_stone4"
827 code_desert_sandstone["2"] = "tsm_pyramids:deco_stone5"
828 code_desert_sandstone["3"] = "tsm_pyramids:deco_stone6"
829 code_desert_sandstone["S"] = "default:desert_sandstone_brick"
830 code_desert_sandstone["t"] = "tsm_pyramids:desert_trap"
831 code_desert_sandstone["a"] = "default:desert_sand"
833 local code_desert_stone = table.copy(code_sandstone)
834 code_desert_stone["c"] = "default:desert_stone_block"
835 code_desert_stone["s"] = "default:desert_stone_block"
836 code_desert_stone["n"] = "default:desert_stone_block"
837 code_desert_stone["h"] = "default:desert_stone_block"
838 code_desert_stone["1"] = "default:desert_stone_block"
839 code_desert_stone["2"] = "default:desert_stone_block"
840 code_desert_stone["3"] = "default:desert_stone_block"
841 code_desert_stone["S"] = "default:desert_stonebrick"
842 code_desert_stone["t"] = "air"
843 code_desert_stone["a"] = "default:desert_sand"
845 local function replace(str, iy, code_table, deco, column_style)
846 if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end
847 if str == "h" then
848 local r = math.random(0,3)
849 if r > 0 then
850 str = deco[r]
851 else
852 str = "c"
854 elseif column_style == 1 or column_style == 2 then
855 if iy == 0 and str == "c" then str = deco[1] end
856 if iy == 3 and str == "c" then str = deco[2] end
857 elseif column_style == 3 then
858 if iy == 0 and str == "c" then str = deco[1] end
859 if iy == 2 and str == "c" then str = deco[2] end
860 elseif column_style == 4 then
861 if iy == 2 and str == "c" then str = deco[1] end
863 return code_table[str]
866 local function replace2(str, iy, depth, code_table)
867 if iy == depth then
868 -- Sandstone at the bottom-most layer
869 str = "s"
870 elseif iy == depth-1 then
871 -- Brick at the layer above
872 str = "S"
873 elseif iy == 0 and str == "~" then
874 -- Trap stones at the top layer
875 str = "t"
876 elseif iy < depth-3 and str == "~" then
877 -- Air below the trap stones
878 str = " "
880 -- Everything else is untouched (will stay pyramid material)
882 return code_table[str]
885 local function get_flat_index(x, y, width)
886 return 1 + x + y * width
889 local function rotate_layout_single(layout, width)
890 local size = width*width
891 local new_layout = {}
892 for x=0, width-1 do
893 for y=0, width-1 do
894 local symbol = layout[get_flat_index((width-1) - y, x, width)]
895 -- Rotate chest
896 if symbol == "^" then
897 symbol = "<"
898 elseif symbol == "<" then
899 symbol = "v"
900 elseif symbol == "v" then
901 symbol = ">"
902 elseif symbol == ">" then
903 symbol = "^"
905 new_layout[get_flat_index(x, y, width)] = symbol
908 return new_layout
911 local function rotate_layout(layout, width, rotations)
912 local new_layout = table.copy(layout)
913 for r=1, rotations do
914 new_layout = rotate_layout_single(new_layout, width)
916 return new_layout
919 -- pos: Position to spawn pyramid
920 -- stype: Sand type ("sandstone" or "desert")
921 -- room_id: Room layout identified (see list of rooms above)
922 -- rotations: Number of times to rotate the room (0-3)
923 function tsm_pyramids.make_room(pos, stype, room_id, rotations)
924 local code_table = code_sandstone
925 if stype == "desert_sandstone" then
926 code_table = code_desert_sandstone
927 elseif stype == "desert_stone" then
928 code_table = code_desert_stone
930 -- Select random deco block
931 local deco_ids = {"1", "2", "3"}
932 local deco = {}
933 for i=1, 3 do
934 local r = math.random(1, #deco_ids)
935 table.insert(deco, deco_ids[r])
936 table.remove(deco_ids, r)
938 local hole = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
939 if room_id == nil then
940 room_id = math.random(1, #room_types)
942 local room
943 if room_id < 1 or room_id > #room_types then
944 return false, S("Incorrect room type ID: @1", room_id)
946 local room = table.copy(room_types[room_id])
947 local tries = 0
948 while tries < #room_types do
949 if room.stype and room.stype ~= stype then
950 room_id = room_id + 1
951 if room_id > #room_types then
952 room_id = 1
954 room = table.copy(room_types[room_id])
955 else
956 break
958 tries = tries + 1
960 local chests = {}
961 local column_style
962 if stype == "desert_stone" then
963 column_style = 0
964 else
965 column_style = math.random(0,4)
967 -- Custom room walls
968 if room.wall then
969 for iy=0,4,1 do
970 for ie=0,8,1 do
971 local nn = code_table[room.wall[iy*9+ie+1]]
972 minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z-1}, {name=nn})
973 minetest.set_node({x=hole.x-1, y=hole.y-iy, z=hole.z+ie}, {name=nn})
975 minetest.set_node({x=hole.x+ie, y=hole.y-iy, z=hole.z+9}, {name=nn})
976 minetest.set_node({x=hole.x+9, y=hole.y-iy, z=hole.z+ie}, {name=nn})
980 local layout
981 -- Place the room nodes
982 if room.style == "yrepeat" then
983 layout = rotate_layout(room.layout, ROOM_WIDTH, rotations)
984 for iy=0,4,1 do
985 for ix=0,8,1 do
986 for iz=0,8,1 do
987 local n_str = layout[ix*9+iz+1]
988 local p2 = 0
989 if n_str == "<" then
990 p2 = 0
991 elseif n_str == ">" then
992 p2 = 2
993 elseif n_str == "^" then
994 p2 = 1
995 elseif n_str == "v" then
996 p2 = 3
998 local cpos = {x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}
999 local nn = replace(n_str, iy, code_table, deco, column_style)
1000 minetest.set_node(cpos, {name=nn, param2=p2})
1001 if nn == "default:chest" then
1002 table.insert(chests, cpos)
1007 elseif room.style == "stacked" then
1008 local layout_list = room.layout
1009 local layout
1010 local layout_offset = room.layout_offset
1011 local layout_height = room.layout_height
1012 if not layout_offset then
1013 layout_offset = 0
1015 if not layout_height then
1016 layout_height = 5
1018 for iy=0,layout_height-1,1 do
1019 layout = nil
1020 if layout_list[layout_height-iy] then
1021 layout = rotate_layout(layout_list[layout_height-iy], ROOM_WIDTH, rotations)
1023 for ix=0,8,1 do
1024 for iz=0,8,1 do
1025 local n_str
1026 if layout then
1027 n_str = layout[ix*9+iz+1]
1028 else
1029 n_str = " "
1031 local p2 = 0
1032 if n_str == "<" then
1033 p2 = 0
1034 elseif n_str == ">" then
1035 p2 = 2
1036 elseif n_str == "^" then
1037 p2 = 1
1038 elseif n_str == "v" then
1039 p2 = 3
1041 local cpos = {x=hole.x+ix,y=hole.y-iy+layout_offset,z=hole.z+iz}
1042 local nn = code_table[n_str]
1043 minetest.set_node(cpos, {name=nn, param2=p2})
1044 if nn == "default:chest" then
1045 table.insert(chests, cpos)
1050 else
1051 minetest.log("error", "Invalid pyramid room style! room type ID="..r)
1053 local sanded = room.flood_sand ~= false and stype ~= "desert_stone" and math.random(1,8) == 1
1054 if #chests > 0 then
1055 -- Make at least 8 attempts to fill chests
1056 local filled = 0
1057 local chests_with_treasure = 0
1058 while filled < 8 do
1059 for c=1, #chests do
1060 local has_treasure = tsm_pyramids.fill_chest(chests[c], stype, sanded, 30)
1061 if has_treasure then
1062 chests_with_treasure = chests_with_treasure + 1
1064 filled = filled + 1
1067 -- If no chests were filled with treasure so far, fill a random chest guaranteed
1068 if chests_with_treasure == 0 then
1069 tsm_pyramids.fill_chests(chests[math.random(1, #chests)], stype, sanded, 100)
1072 if room.traps and math.random(1,4) then
1073 tsm_pyramids.make_traps(pos, stype, rotations, layout)
1075 if sanded then
1076 tsm_pyramids.flood_sand(pos, stype)
1078 return true, nil, sanded
1081 local shuffle_traps = function(chance, layout_room)
1082 layout_traps = table.copy(layout_traps_template)
1083 for a=1, #layout_traps do
1084 -- Delete trap if this space of the room is occupied
1085 if layout_room[a] ~= " " then
1086 layout_traps[a] = "S"
1087 -- Randomly turn tile into a trap, or not
1088 elseif layout_traps[a] == "?" then
1089 -- percentage for a trap
1090 if math.random(1,100) <= chance then
1091 layout_traps[a] = "~"
1092 else
1093 layout_traps[a] = "S"
1099 function tsm_pyramids.make_traps(pos, stype, rotations, layout_room)
1100 local code_table = code_sandstone
1101 if stype == "desert_sandstone" then
1102 code_table = code_desert_sandstone
1103 elseif stype == "desert_stone" then
1104 code_table = code_desert_stone
1106 shuffle_traps(math.random(10,100), layout_room)
1107 local hole = {x=pos.x+7,y=pos.y, z=pos.z+7}
1108 local layout = rotate_layout(layout_traps, ROOM_WIDTH, rotations)
1109 -- Depth is total depth of trap area:
1110 -- * top layer with trap stones
1111 -- * followed by air layers
1112 -- * followed by 2 layer of lava
1113 -- * and 2 layers of sandstone/brick at the bottom (to prevent lava escaping)
1114 -- The depth of air between trap stones and lava layer is <depth> - 4
1115 local depth = 7
1116 local wmin, wmax = -1,9
1117 for iy=0,depth,1 do
1118 for ix=wmin,wmax,1 do
1119 for iz=wmin,wmax,1 do
1120 local n_str
1121 if ix == wmin or ix == wmax or iz == wmin or iz == wmax then
1122 -- Walls around room
1123 if iy == depth then
1124 n_str = code_table["s"]
1125 else
1126 n_str = code_table["S"]
1128 minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=n_str})
1129 else
1130 -- Walls below room
1131 n_str = layout[ix*9+iz+1]
1132 minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace2(n_str, iy, depth, code_table)})
1139 function tsm_pyramids.flood_sand(pos, stype)
1140 local set_to_sand = {}
1141 local nn = "default:sand"
1142 if stype == "desert_sandstone" or stype == "desert_stone" then
1143 nn = "default:desert_sand"
1145 local hole = {x=pos.x+7,y=pos.y+1, z=pos.z+7}
1146 local maxh = math.random(1,4)
1147 local chance = math.random(1,7)
1148 for ix=0,8,1 do
1149 for iz=0,8,1 do
1150 if math.random(1,chance) == 1 then
1151 local h = math.random(1,maxh)
1152 for iy=0,h,1 do
1153 local p = {x=hole.x+ix,y=hole.y+iy,z=hole.z+iz}
1154 if minetest.get_node(p).name == "air" then
1155 table.insert(set_to_sand, p)
1161 minetest.bulk_set_node(set_to_sand, {name=nn})