Spawn desert sandstone pyramids

This commit is contained in:
Wuzzy 2018-05-25 00:23:05 +02:00
parent 4a8dab67db
commit a069c026fd
3 changed files with 44 additions and 29 deletions

View File

@ -87,7 +87,7 @@ local function make_entrance(pos, brick)
end end
end end
local function make(pos, brick, sandstone, stone, sand) local function make(pos, brick, sandstone, stone, sand, ptype)
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")") minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
for iy=0,10,1 do for iy=0,10,1 do
for ix=iy,22-iy,1 do for ix=iy,22-iy,1 do
@ -104,7 +104,7 @@ local function make(pos, brick, sandstone, stone, sand)
end end
end end
pyramids.make_room(pos) pyramids.make_room(pos, ptype)
minetest.after(2, pyramids.make_traps, pos) minetest.after(2, pyramids.make_traps, pos)
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17}) add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17})
make_entrance({x=pos.x,y=pos.y, z=pos.z}, brick) make_entrance({x=pos.x,y=pos.y, z=pos.z}, brick)
@ -192,12 +192,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
if sand == "default:desert_sand" then if sand == "default:desert_sand" then
if minetest.get_modpath("sandplus") then if minetest.get_modpath("sandplus") then
minetest.after(0.8, make, p2, "sandplus:desert_sandstonebrick", "sandplus:desert_sandstone", "default:desert_stone", "default:desert_sand") minetest.after(0.8, make, p2, "sandplus:desert_sandstonebrick", "sandplus:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert")
else else
minetest.after(0.8, make, p2, "default:sandstonebrick", "default:sandstone", "default:desert_stone", "default:desert_sand") minetest.after(0.8, make, p2, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert")
end end
else else
minetest.after(0.8, make, p2, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand") minetest.after(0.8, make, p2, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone")
end end
end end
end) end)

View File

@ -8,7 +8,7 @@ end
local img = { local img = {
"eye", "men", "sun", "eye", "men", "sun",
"scarab", "ankh", "cactus" "ankh", "scarab", "cactus"
} }
local desc = { local desc = {
S("Sandstone with Eye Engraving"), S("Sandstone with Man Engraving"), S("Sandstone with Sun Engraving"), S("Sandstone with Eye Engraving"), S("Sandstone with Man Engraving"), S("Sandstone with Sun Engraving"),

View File

@ -18,37 +18,48 @@ local trap = {"b","b","b","b","b","b","b","b","b",
"l","b","l","b","l","b","l","b","b", "l","b","l","b","l","b","l","b","b",
"b","b","b","b","b","b","b","b","b"} "b","b","b","b","b","b","b","b","b"}
local code = {} local code_sandstone = {
code["s"] = "sandstone" ["s"] = "sandstone",
code["eye"] = "deco_stone1" ["1"] = "deco_stone1",
code["men"] = "deco_stone2" ["2"] = "deco_stone2",
code["sun"] = "deco_stone3" ["3"] = "deco_stone3",
code["c"] = "chest" ["c"] = "chest",
code["b"] = "sandstonebrick" ["b"] = "sandstonebrick",
code["a"] = "air" ["a"] = "air",
code["l"] = "lava_source" ["l"] = "lava_source",
code["t"] = "trap" ["t"] = "trap",
}
local code_desert = table.copy(code_sandstone)
code_desert["s"] = "desert_sandstone"
code_desert["1"] = "deco_stone4"
code_desert["2"] = "deco_stone5"
code_desert["3"] = "deco_stone6"
code_desert["b"] = "desert_sandstone_brick"
local function replace(str,iy) local function replace(str, iy, code_table)
local out = "default:" local out = "default:"
if iy < 4 and str == "c" then str = "a" end if iy < 4 and str == "c" then str = "a" end
if iy == 0 and str == "s" then out = "tsm_pyramids:" str = "sun" end if iy == 0 and str == "s" then out = "tsm_pyramids:" str = "3" end
if iy == 3 and str == "s" then out = "tsm_pyramids:" str = "men" end if iy == 3 and str == "s" then out = "tsm_pyramids:" str = "2" end
if str == "a" then out = "" end if str == "a" then out = "" end
return out..code[str] return out..code_table[str]
end end
local function replace2(str,iy) local function replace2(str, iy, code_table)
local out = "default:" local out = "default:"
if iy == 0 and str == "l" then out = "tsm_pyramids:" str = "t" if iy == 0 and str == "l" then out = "tsm_pyramids:" str = "t"
elseif iy < 3 and str == "l" then str = "a" end elseif iy < 3 and str == "l" then str = "a" end
if str == "a" then out = "" end if str == "a" then out = "" end
return out..code[str] return out..code_table[str]
end end
function pyramids.make_room(pos) function pyramids.make_room(pos, stype)
local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7} local code_table = code_sandstone
if stype == "desert" then
code_table = code_desert
end
local hole = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
for iy=0,4,1 do for iy=0,4,1 do
for ix=0,8,1 do for ix=0,8,1 do
for iz=0,8,1 do for iz=0,8,1 do
@ -56,22 +67,26 @@ function pyramids.make_room(pos)
local p2 = 0 local p2 = 0
if n_str == "c" then if n_str == "c" then
if ix < 3 then p2 = 1 else p2 = 3 end if ix < 3 then p2 = 1 else p2 = 3 end
pyramids.fill_chest({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}) pyramids.fill_chest({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz})
end end
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy), param2=p2}) minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace(n_str, iy, code_table), param2=p2})
end end
end end
end end
end end
function pyramids.make_traps(pos) function pyramids.make_traps(pos, stype)
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7} local code_table = code_sandstone
if stype == "desert" then
code_table = code_desert
end
local hole = {x=pos.x+7,y=pos.y, z=pos.z+7}
for iy=0,4,1 do for iy=0,4,1 do
for ix=0,8,1 do for ix=0,8,1 do
for iz=0,8,1 do for iz=0,8,1 do
local n_str = trap[tonumber(ix*9+iz+1)] local n_str = trap[tonumber(ix*9+iz+1)]
local p2 = 0 local p2 = 0
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2}) minetest.set_node({x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}, {name=replace2(n_str, iy, code_table), param2=p2})
end end
end end
end end