1 local S
= minetest
.get_translator("tsm_pyramids")
12 " "," "," "," "," "," "," "," "," ",
13 " ","^"," ","^"," ","^"," ","^"," ",
14 " ","s"," ","s"," ","s"," ","s"," ",
15 " "," "," "," "," "," "," "," "," ",
16 " "," "," "," "," "," "," "," "," ",
17 " "," "," "," "," "," "," "," "," ",
18 " ","s"," ","s"," ","s"," ","s"," ",
19 " ","v"," ","v"," ","v"," ","v"," ",
20 " "," "," "," "," "," "," "," "," "
28 "s","s","s","s","s","s","s","s","s",
29 "s"," "," "," "," "," "," "," ","s",
30 "s"," "," "," "," "," "," "," ","s",
31 "s"," "," "," "," "," "," "," ","s",
32 " "," "," "," ","<"," "," "," ","s",
33 "s"," "," "," "," "," "," "," ","s",
34 "s"," "," "," "," "," "," "," ","s",
35 "s"," "," "," "," "," "," "," ","s",
36 "s","s","s","s","s","s","s","s","s"
43 " "," "," "," ","v"," "," "," "," ",
44 " ","s","s"," "," "," ","s","s"," ",
45 " ","s","s"," "," "," ","s","s"," ",
46 " "," "," "," "," "," "," "," "," ",
47 " "," "," "," "," "," "," "," ","<",
48 " "," "," "," "," "," "," "," "," ",
49 " ","s","s"," "," "," ","s","s"," ",
50 " ","s","s"," "," "," ","s","s"," ",
51 " "," "," "," ","^"," "," "," "," "
58 " "," "," "," "," "," "," "," "," ",
59 " "," "," "," "," "," "," "," "," ",
60 " "," ","s","S","s","S","s"," "," ",
61 " "," ","S"," "," "," ","S"," "," ",
62 " "," ","s"," ",">"," ","s"," ","<",
63 " "," ","S"," "," "," ","S"," "," ",
64 " "," ","s","S","s","S","s"," "," ",
65 " "," "," "," "," "," "," "," "," ",
66 " "," "," "," "," "," "," "," "," "
73 " "," "," "," "," "," "," "," "," ",
74 " ","S","S","S","S","S","S","S"," ",
75 " ","S"," "," "," "," "," ","S"," ",
76 " ","S"," ","s","s","s"," ","S"," ",
77 " ","S"," ","s","v","s"," ","S"," ",
78 "S","S"," ","s"," ","s"," ","S"," ",
79 "S","S"," ","s"," "," "," ","S"," ",
80 "v","S"," ","S","S","S","S","S"," ",
81 " ","S"," "," "," "," "," "," "," "
88 " "," "," "," "," "," "," "," "," ",
89 " ","S","S","S","S","S","S","S"," ",
90 " "," "," ","s"," "," "," ","S"," ",
91 "S","S"," ","s"," ","s"," ","S"," ",
92 " ","S"," ","s","^","s"," ","S"," ",
93 " ","S"," ","s","s","s"," ","S"," ",
94 " ","S"," "," "," "," "," ","S"," ",
95 " ","S","S","S","S","S","S","S"," ",
96 " "," "," "," "," "," "," "," "," "
103 " "," ","v"," ","v"," ","v"," ","v",
104 " ","s"," ","s"," ","s"," ","s"," ",
105 " "," "," "," "," "," "," "," "," ",
106 " ","s"," ","s"," ","s"," ","s"," ",
107 " "," "," "," "," "," "," "," "," ",
108 " ","s"," ","s"," ","s"," ","s"," ",
109 " "," "," "," "," "," "," "," "," ",
110 " ","s"," ","s"," ","s"," ","s"," ",
111 " "," ","^"," ","^"," ","^"," ","^",
119 "s"," "," "," "," "," "," "," ","s",
120 " "," ","s",">"," ","<","s"," "," ",
121 " ","s","s","s"," ","s","s","s"," ",
122 " "," ","s"," "," "," ","s"," "," ",
123 " "," "," "," ","<"," "," "," "," ",
124 " "," ","s"," "," "," ","s"," "," ",
125 " ","s","s","s"," ","s","s","s"," ",
126 " "," ","s",">"," ","<","s"," "," ",
127 "s"," "," "," "," "," "," "," ","s",
135 ">","s","s","s","s","s","s","s","s",
136 "s","s","s"," "," "," ","s","s","s",
137 "s","s"," "," "," "," "," ","s","s",
138 "s"," "," "," "," "," "," "," ","s",
139 " "," "," "," "," "," "," ","<","s",
140 "s"," "," "," "," "," "," "," ","s",
141 "s","s"," "," "," "," "," ","s","s",
142 "s","s","s"," "," "," ","s","s","s",
143 ">","s","s","s","s","s","s","s","s",
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 " "," "," "," "," "," "," "," "," ",
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",">"," "," "," "," ",
181 "S","S","S","S","S"," "," "," "," ",
182 "S","S","S","S","s",">"," "," "," ",
183 "S","s","S","s","S","s","S"," "," ",
184 " "," "," "," "," "," "," "," "," ",
185 " "," "," "," "," "," "," "," "," ",
186 " "," "," "," "," "," "," "," "," ",
187 "S","s","S","s","S","s","S"," "," ",
188 "S","S","S","S","s",">"," "," "," ",
189 "S","S","S","S","S"," "," "," "," ",
196 "S","S","S","S","S","v","S","S","S",
197 "S","S","S","S","S","S","S","S","S",
198 "s","S","s","S","s","S","s","S","s",
199 " "," "," "," "," "," "," "," "," ",
200 " "," "," "," "," "," "," "," ","<",
201 " "," "," "," "," "," "," "," "," ",
202 "s","S","s","S","s","S","s","S","s",
203 "S","S","S","S","S","S","S","S","S",
204 "S","S","S","S","S","^","S","S","S",
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","^",
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 " "," "," "," ","s"," "," ","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",
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 " "," "," "," "," "," "," "," "," ",
256 " "," "," "," "," "," "," "," "," ",
257 " "," "," "," "," "," "," "," "," ",
258 " "," "," "," ","^"," "," "," "," ",
259 " "," "," ","s","s","s"," "," "," ",
260 " "," ","<","s","S","s",">"," "," ",
261 " "," "," ","s","s","s"," "," "," ",
262 " "," "," "," ","v"," "," "," "," ",
263 " "," "," "," "," "," "," "," "," ",
264 " "," "," "," "," "," "," "," "," ",
272 " "," "," "," "," "," "," "," "," ",
273 " "," "," "," "," "," "," "," "," ",
274 " "," "," ","s","s","s"," "," "," ",
275 " "," ","s","s","v","s","s"," "," ",
276 " "," ","s",">"," "," "," "," "," ",
277 " "," ","s","s","^","s","s"," "," ",
278 " "," "," ","s","s","s"," "," "," ",
279 " "," "," "," "," "," "," "," "," ",
280 " "," "," "," "," "," "," "," "," ",
287 "S","S","S","S","S","S","S"," ","<",
288 "s","s","s","s","s","S","S"," ","s",
289 "s"," "," "," "," ","s","S"," ","<",
290 "s"," "," "," "," ","s","S"," ","s",
291 " "," "," "," ","<","s","S"," ","<",
292 "s"," "," "," "," ","s","S"," ","s",
293 "s"," "," "," "," ","s","S"," ","<",
294 "s","s","s","s","s","s","S"," ","s",
295 "S","S","S","S","S","S","S"," ","<",
302 " "," "," "," "," "," "," "," "," ",
303 " "," "," "," "," "," "," "," "," ",
304 " "," "," "," "," "," "," "," "," ",
305 " "," "," ","^"," ","^"," "," "," ",
306 " "," "," ","s"," ","s"," "," "," ",
307 " "," "," ","v"," ","v"," "," "," ",
308 " "," "," "," "," "," "," "," "," ",
309 " "," "," "," "," "," "," "," "," ",
310 " "," "," "," "," "," "," "," "," ",
317 " "," "," "," "," "," "," "," "," ",
318 " "," "," "," ","^"," "," "," "," ",
319 " "," "," "," ","s"," "," "," "," ",
320 " "," "," "," "," "," "," "," "," ",
321 " ","<","s"," "," "," ","s",">"," ",
322 " "," "," "," "," "," "," "," "," ",
323 " "," "," "," ","s"," "," "," "," ",
324 " "," "," "," ","v"," "," "," "," ",
325 " "," "," "," "," "," "," "," "," ",
332 " "," "," "," "," "," "," "," "," ",
333 " "," ","^"," ","^"," ","^"," "," ",
334 " "," ","s"," ","s"," ","s"," "," ",
335 " "," "," "," "," "," "," "," "," ",
336 " "," "," "," "," "," "," "," "," ",
337 " "," "," "," "," "," "," "," "," ",
338 " "," ","s"," ","s"," ","s"," "," ",
339 " "," ","v"," ","v"," ","v"," "," ",
340 " "," "," "," "," "," "," "," "," ",
348 " ","S","v","S","v","S","v","S","v",
349 " ","S"," ","S"," ","S"," ","S"," ",
350 " ","s"," ","s"," ","s"," ","s"," ",
351 " "," "," "," "," "," "," "," "," ",
352 " "," "," "," "," "," "," "," "," ",
353 " "," "," "," "," "," "," "," "," ",
354 " ","s"," ","s"," ","s"," ","s"," ",
355 " ","S"," ","S"," ","S"," ","S"," ",
356 " ","S","^","S","^","S","^","S","^",
363 " "," "," "," "," "," "," "," "," ",
364 " ","s"," "," "," "," "," ","s"," ",
365 " "," "," "," "," "," "," "," "," ",
366 " "," "," ","s","S","s"," "," "," ",
367 " "," "," ","S",">"," "," "," "," ",
368 " "," "," ","s","S","s"," "," "," ",
369 " "," "," "," "," "," "," "," "," ",
370 " ","s"," "," "," "," "," ","s"," ",
371 " "," "," "," "," "," "," "," "," ",
378 " "," "," "," "," "," "," "," "," ",
379 " "," "," "," "," "," "," "," "," ",
380 " "," "," "," "," "," "," "," "," ",
381 " "," "," "," "," "," "," "," "," ",
382 " "," "," "," ","<"," "," "," "," ",
383 " "," "," "," "," "," "," "," "," ",
384 " "," "," "," "," "," "," "," "," ",
385 " "," "," "," "," "," "," "," "," ",
386 " "," "," "," "," "," "," "," "," ",
393 " "," "," "," "," "," "," "," "," ",
394 " "," "," "," "," "," "," "," ","<",
395 " "," "," "," "," "," "," "," "," ",
396 " "," "," "," "," "," "," "," "," ",
397 " "," "," "," "," "," "," "," "," ",
398 " "," "," "," "," "," "," "," "," ",
399 " "," "," "," "," "," "," "," "," ",
400 " "," "," "," "," "," "," "," ","<",
401 " "," "," "," "," "," "," "," "," ",
409 "s"," "," "," "," "," "," "," ","s",
410 "s","s",">"," "," "," ","<","s","s",
411 " ","s","s"," "," "," ","s","s"," ",
412 " "," ","s","s"," ","s","s"," "," ",
413 " "," "," "," "," "," "," "," "," ",
414 " "," ","s","s"," ","s","s"," "," ",
415 " ","s","s"," "," "," ","s","s"," ",
416 "s","s",">"," "," "," ","<","s","s",
417 "s"," "," "," "," "," "," "," ","s",
424 "S","S","S","S","S","S","S","S","S",
425 "S","S","S"," "," "," "," "," "," ",
426 "S","S","S"," "," "," "," "," "," ",
427 "S","S","S"," "," ","^","^","^","^",
428 " "," "," "," "," ","s","s","s","s",
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",
439 " "," "," "," "," "," "," "," "," ",
440 " "," "," "," "," "," "," "," "," ",
441 " "," "," "," "," "," "," "," "," ",
442 " ","^"," ","^"," ","^"," ","^"," ",
443 " ","s"," ","s"," ","s"," ","s"," ",
444 " ","v"," ","v"," ","v"," ","v"," ",
445 " "," "," "," "," "," "," "," "," ",
446 " "," "," "," "," "," "," "," "," ",
447 " "," "," "," "," "," "," "," "," ",
454 "S","S"," "," "," "," "," ","S","S",
455 "S"," "," "," ","s"," "," "," ","S",
456 " "," ","<","S","S","S",">"," "," ",
457 " "," ","S","S","S","S","S"," "," ",
458 " ","s","S","S","S","S","S","s"," ",
459 " "," ","S","S","S","S","S"," "," ",
460 " "," ","<","S","S","S",">"," "," ",
461 "S"," "," "," ","s"," "," "," ","S",
462 "S","S"," "," "," "," "," ","S","S",
469 " "," "," "," "," "," "," "," "," ",
470 " ","s","^","s"," ","s","^","s"," ",
471 " ","s","s","s"," ","s","s","s"," ",
472 " ","s","s","s"," ","s","s","s"," ",
473 " "," "," "," "," "," "," "," "," ",
474 " ","s","s","s"," ","s","s","s"," ",
475 " ","s","s","s"," ","s","s","s"," ",
476 " ","s","v","s"," ","s","v","s"," ",
477 " "," "," "," "," "," "," "," "," ",
484 "S"," "," "," "," "," "," "," "," ",
485 "S"," "," ","^"," "," ","^"," "," ",
486 "S"," "," ","s"," "," ","s"," "," ",
487 "S"," "," "," "," "," "," "," "," ",
488 " "," "," ","s"," "," ","s"," "," ",
489 "S"," "," "," "," "," "," "," "," ",
490 "S"," "," ","s"," "," ","s"," "," ",
491 "S"," "," ","v"," "," ","v"," "," ",
492 "S"," "," "," "," "," "," "," "," ",
499 "s"," ","s"," ","s"," ","s"," ","s",
500 " "," ","v"," ","v"," ","v"," "," ",
501 "s"," "," "," "," "," "," "," ","s",
502 " "," "," "," "," "," "," "," "," ",
503 " "," "," "," "," "," "," "," ","s",
504 " "," "," "," "," "," "," "," "," ",
505 "s"," "," "," "," "," "," "," ","s",
506 " "," ","^"," ","^"," ","^"," "," ",
507 "s"," ","s"," ","s"," ","s"," ","s",
515 " "," "," "," "," "," "," "," "," ",
516 " "," ","^"," ","^"," ","^"," "," ",
517 " "," ","s"," ","s"," ","s"," "," ",
518 " "," "," "," "," "," "," "," "," ",
519 " "," ","s"," ","s"," ","s"," "," ",
520 " "," "," "," "," "," "," "," "," ",
521 " "," ","s"," ","s"," ","s"," "," ",
522 " "," ","v"," ","v"," ","v"," "," ",
523 " "," "," "," "," "," "," "," "," ",
533 local layout_traps_template
= {
534 "S","S","S","S","S","S","S","S","S",
535 "?","S","?","S","?","S","?","S","S",
536 "?","S","?","S","?","S","?","S","S",
537 "?","?","?","?","?","?","?","?","S",
538 "?","?","?","?","?","?","?","?","S", -- << entrance on left side
539 "?","?","?","?","?","?","?","?","S",
540 "?","S","?","S","?","S","?","S","S",
541 "?","S","?","S","?","S","?","S","S",
542 "S","S","S","S","S","S","S","S","S"
545 local code_sandstone
= {
547 ["s"] = "default:sandstone",
548 ["S"] = "default:sandstonebrick",
549 ["1"] = "tsm_pyramids:deco_stone1",
550 ["2"] = "tsm_pyramids:deco_stone2",
551 ["3"] = "tsm_pyramids:deco_stone3",
552 ["^"] = "default:chest",
553 ["<"] = "default:chest",
554 [">"] = "default:chest",
555 ["v"] = "default:chest",
556 ["~"] = "default:lava_source",
557 ["t"] = "tsm_pyramids:trap",
559 local code_desert_sandstone
= table.copy(code_sandstone
)
560 code_desert_sandstone
["s"] = "default:desert_sandstone"
561 code_desert_sandstone
["1"] = "tsm_pyramids:deco_stone4"
562 code_desert_sandstone
["2"] = "tsm_pyramids:deco_stone5"
563 code_desert_sandstone
["3"] = "tsm_pyramids:deco_stone6"
564 code_desert_sandstone
["S"] = "default:desert_sandstone_brick"
565 code_desert_sandstone
["t"] = "tsm_pyramids:desert_trap"
567 local code_desert_stone
= table.copy(code_sandstone
)
568 code_desert_stone
["s"] = "default:desert_stone_block"
569 code_desert_stone
["1"] = "default:desert_stone_block"
570 code_desert_stone
["2"] = "default:desert_stone_block"
571 code_desert_stone
["3"] = "default:desert_stone_block"
572 code_desert_stone
["S"] = "default:desert_stonebrick"
573 code_desert_stone
["t"] = "air"
575 local function replace(str
, iy
, code_table
, deco
, column_style
)
576 if iy
< 4 and (str
== "<" or str
== ">" or str
== "^" or str
== "v") then str
= " " end
577 if column_style
== 1 or column_style
== 2 then
578 if iy
== 0 and str
== "s" then str
= deco
[1] end
579 if iy
== 3 and str
== "s" then str
= deco
[2] end
580 elseif column_style
== 3 then
581 if iy
== 0 and str
== "s" then str
= deco
[1] end
582 if iy
== 2 and str
== "s" then str
= deco
[2] end
583 elseif column_style
== 4 then
584 if iy
== 2 and str
== "s" then str
= deco
[1] end
586 return code_table
[str
]
589 local function replace2(str
, iy
, code_table
)
590 if iy
== 0 and str
== "~" then str
= "t"
591 elseif iy
< 3 and str
== "~" then str
= " " end
593 return code_table
[str
]
596 local function get_flat_index(x
, y
, width
)
597 return 1 + x
+ y
* width
600 local function rotate_layout_single(layout
, width
)
601 local size
= width
*width
602 local new_layout
= {}
605 local symbol
= layout
[get_flat_index((width
-1) - y
, x
, width
)]
607 if symbol
== "^" then
609 elseif symbol
== "<" then
611 elseif symbol
== "v" then
613 elseif symbol
== ">" then
616 new_layout
[get_flat_index(x
, y
, width
)] = symbol
622 local function rotate_layout(layout
, width
, rotations
)
623 local new_layout
= table.copy(layout
)
624 for r
=1, rotations
do
625 new_layout
= rotate_layout_single(new_layout
, width
)
630 -- pos: Position to spawn pyramid
631 -- stype: Sand type ("sandstone" or "desert")
632 -- room_id: Room layout identified (see list of rooms above)
633 -- rotations: Number of times to rotate the room (0-3)
634 function tsm_pyramids
.make_room(pos
, stype
, room_id
, rotations
)
635 local code_table
= code_sandstone
636 if stype
== "desert_sandstone" then
637 code_table
= code_desert_sandstone
638 elseif stype
== "desert_stone" then
639 code_table
= code_desert_stone
641 -- Select random deco block
642 local deco_ids
= {"1", "2", "3"}
645 local r
= math
.random(1, #deco_ids
)
646 table.insert(deco
, deco_ids
[r
])
647 table.remove(deco_ids
, r
)
649 local hole
= {x
=pos
.x
+7,y
=pos
.y
+5, z
=pos
.z
+7}
650 if room_id
== nil then
651 room_id
= math
.random(1, #room_types
)
654 if room_id
< 1 or room_id
> #room_types
then
655 return false, S("Incorrect room type ID: @1", room_id
)
657 local room
= table.copy(room_types
[room_id
])
660 local layout
= rotate_layout(room
.layout
, ROOM_WIDTH
, rotations
)
661 if stype
== "desert_stone" then
664 column_style
= math
.random(0,4)
666 if room
.style
== "yrepeat" then
670 local n_str
= layout
[tonumber(ix
*9+iz
+1)]
674 elseif n_str
== ">" then
676 elseif n_str
== "^" then
678 elseif n_str
== "v" then
681 local cpos
= {x
=hole
.x
+ix
,y
=hole
.y
-iy
,z
=hole
.z
+iz
}
682 local nn
= replace(n_str
, iy
, code_table
, deco
, column_style
)
683 minetest
.set_node(cpos
, {name
=nn
, param2
=p2
})
684 if nn
== "default:chest" then
685 table.insert(chests
, cpos
)
691 minetest
.log("error", "Invalid pyramid room style! room type ID="..r
)
693 local sanded
= room
.flood_sand
~= false and stype
~= "desert_stone" and math
.random(1,8) == 1
695 -- Make at least 8 attempts to fill chests
699 tsm_pyramids
.fill_chest(chests
[c
], stype
, sanded
)
705 tsm_pyramids
.make_traps(pos
, stype
, rotations
)
708 tsm_pyramids
.flood_sand(pos
, stype
)
710 return true, nil, sanded
713 local shuffle_traps
= function(chance
)
714 layout_traps
= table.copy(layout_traps_template
)
715 for a
=1, #layout_traps
do
716 if layout_traps
[a
] == "?" then
717 if math
.random(1,100) <= chance
then
718 layout_traps
[a
] = "~"
720 layout_traps
[a
] = "S"
726 function tsm_pyramids
.make_traps(pos
, stype
, rotations
)
727 local code_table
= code_sandstone
728 if stype
== "desert_sandstone" then
729 code_table
= code_desert_sandstone
730 elseif stype
== "desert_stone" then
731 code_table
= code_desert_stone
733 shuffle_traps(math
.random(10,100))
734 local hole
= {x
=pos
.x
+7,y
=pos
.y
, z
=pos
.z
+7}
735 local layout
= rotate_layout(layout_traps
, ROOM_WIDTH
, rotations
)
739 local n_str
= layout
[tonumber(ix
*9+iz
+1)]
741 minetest
.set_node({x
=hole
.x
+ix
,y
=hole
.y
-iy
,z
=hole
.z
+iz
}, {name
=replace2(n_str
, iy
, code_table
), param2
=p2
})
747 function tsm_pyramids
.flood_sand(pos
, stype
)
748 local set_to_sand
= {}
749 local nn
= "default:sand"
750 if stype
== "desert_sandstone" or stype
== "desert_stone" then
751 nn
= "default:desert_sand"
753 local hole
= {x
=pos
.x
+7,y
=pos
.y
+1, z
=pos
.z
+7}
754 local maxh
= math
.random(1,4)
755 local chance
= math
.random(1,7)
758 if math
.random(1,chance
) == 1 then
759 local h
= math
.random(1,maxh
)
761 local p
= {x
=hole
.x
+ix
,y
=hole
.y
+iy
,z
=hole
.z
+iz
}
762 if minetest
.get_node(p
).name
== "air" then
763 table.insert(set_to_sand
, p
)
769 minetest
.bulk_set_node(set_to_sand
, {name
=nn
})