1 local room
= {"a","a","a","a","a","a","a","a","a",
2 "a","c","a","c","a","c","a","c","a",
3 "a","s","a","s","a","s","a","s","a",
4 "a","a","a","a","a","a","a","a","a",
5 "a","a","a","a","a","a","a","a","a",
6 "a","a","a","a","a","a","a","a","a",
7 "a","s","a","s","a","s","a","s","a",
8 "a","c","a","c","a","c","a","c","a",
9 "a","a","a","a","a","a","a","a","a"}
11 local trap
= {"b","b","b","b","b","b","b","b","b",
12 "l","b","l","b","l","b","l","b","b",
13 "l","b","l","b","l","b","l","b","b",
14 "l","b","l","l","l","b","l","l","b",
15 "l","l","b","l","b","l","l","b","b",
16 "l","b","l","l","l","l","l","l","b",
17 "l","b","l","b","l","b","l","b","b",
18 "l","b","l","b","l","b","l","b","b",
19 "b","b","b","b","b","b","b","b","b"}
21 local code_sandstone
= {
23 ["1"] = "deco_stone1",
24 ["2"] = "deco_stone2",
25 ["3"] = "deco_stone3",
27 ["b"] = "sandstonebrick",
29 ["l"] = "lava_source",
32 local code_desert
= table.copy(code_sandstone
)
33 code_desert
["s"] = "desert_sandstone"
34 code_desert
["1"] = "deco_stone4"
35 code_desert
["2"] = "deco_stone5"
36 code_desert
["3"] = "deco_stone6"
37 code_desert
["b"] = "desert_sandstone_brick"
38 code_desert
["t"] = "desert_trap"
40 local function replace(str
, iy
, code_table
, deco
)
41 local out
= "default:"
42 if iy
< 4 and str
== "c" then str
= "a" end
43 if iy
== 0 and str
== "s" then out
= "tsm_pyramids:" str
= deco
[1] end
44 if iy
== 3 and str
== "s" then out
= "tsm_pyramids:" str
= deco
[2] end
45 if str
== "a" then out
= "" end
46 return out
..code_table
[str
]
49 local function replace2(str
, iy
, code_table
)
50 local out
= "default:"
51 if iy
== 0 and str
== "l" then out
= "tsm_pyramids:" str
= "t"
52 elseif iy
< 3 and str
== "l" then str
= "a" end
54 if str
== "a" then out
= "" end
55 return out
..code_table
[str
]
58 function pyramids
.make_room(pos
, stype
)
59 local code_table
= code_sandstone
60 if stype
== "desert" then
61 code_table
= code_desert
63 -- Select random deco block
64 local deco_ids
= {"1", "2", "3"}
67 local r
= math
.random(1, #deco_ids
)
68 table.insert(deco
, deco_ids
[r
])
69 table.remove(deco_ids
, r
)
71 local hole
= {x
=pos
.x
+7,y
=pos
.y
+5, z
=pos
.z
+7}
75 local n_str
= room
[tonumber(ix
*9+iz
+1)]
78 if ix
< 3 then p2
= 1 else p2
= 3 end
79 pyramids
.fill_chest({x
=hole
.x
+ix
,y
=hole
.y
-iy
,z
=hole
.z
+iz
})
81 minetest
.set_node({x
=hole
.x
+ix
,y
=hole
.y
-iy
,z
=hole
.z
+iz
}, {name
=replace(n_str
, iy
, code_table
, deco
), param2
=p2
})
87 function pyramids
.make_traps(pos
, stype
)
88 local code_table
= code_sandstone
89 if stype
== "desert" then
90 code_table
= code_desert
92 local hole
= {x
=pos
.x
+7,y
=pos
.y
, z
=pos
.z
+7}
96 local n_str
= trap
[tonumber(ix
*9+iz
+1)]
98 minetest
.set_node({x
=hole
.x
+ix
,y
=hole
.y
-iy
,z
=hole
.z
+iz
}, {name
=replace2(n_str
, iy
, code_table
), param2
=p2
})