Add desert stone pyramids (still a bit buggy)

This commit is contained in:
Wuzzy 2019-08-20 20:16:11 +02:00
parent 9b9e4c1f50
commit 783a5d8666
2 changed files with 35 additions and 16 deletions

View File

@ -35,7 +35,7 @@ end
function tsm_pyramids.fill_chest(pos, stype, flood_sand)
minetest.after(2, function()
local sand = "default:sand"
if stype == "desert" then
if stype == "desert_sandstone" or stype == "desert_stone" then
sand = "default:desert_sand"
end
local n = minetest.get_node(pos)
@ -262,7 +262,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
if sand == "default:desert_sand" then
-- Desert sandstone pyramid
minetest.after(0.8, make, p2, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert")
minetest.after(0.8, make, p2, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert_sandstone")
else
-- Sandstone pyramid
minetest.after(0.8, make, p2, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone")
@ -295,7 +295,7 @@ minetest.register_chatcommand("spawnpyramid", {
end
local pos = player:get_pos()
pos = vector.round(pos)
local s = math.random(1,2)
local s = math.random(1,3)
local r = tonumber(param)
local room_id
if r then
@ -303,10 +303,13 @@ minetest.register_chatcommand("spawnpyramid", {
end
local ok, msg
pos = vector.add(pos, {x=-11, y=-1, z=0})
s = 3
if s == 1 then
ok, msg = make(pos, "default:sandstonebrick", "default:sandstone", "default:sandstone", "default:sand", "sandstone", room_id)
elseif s == 2 then
ok, msg = make(pos, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert_sandstone", room_id)
else
ok, msg = make(pos, "default:desert_sandstone_brick", "default:desert_sandstone", "default:desert_stone", "default:desert_sand", "desert", room_id)
ok, msg = make(pos, "default:desert_stonebrick", "default:desert_stone_block", "default:desert_stone", "default:desert_sand", "desert_stone", room_id)
end
if ok then
return true, S("Pyramid generated at @1.", minetest.pos_to_string(pos))

View File

@ -554,13 +554,22 @@ local code_sandstone = {
["~"] = "lava_source",
["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["S"] = "desert_sandstone_brick"
code_desert["t"] = "desert_trap"
local code_desert_sandstone = table.copy(code_sandstone)
code_desert_sandstone["s"] = "desert_sandstone"
code_desert_sandstone["1"] = "deco_stone4"
code_desert_sandstone["2"] = "deco_stone5"
code_desert_sandstone["3"] = "deco_stone6"
code_desert_sandstone["S"] = "desert_sandstone_brick"
code_desert_sandstone["t"] = "desert_trap"
local code_desert_stone = table.copy(code_sandstone)
code_desert_stone["s"] = "desert_stone_block"
code_desert_stone["1"] = "desert_stone_block"
code_desert_stone["2"] = "desert_stone_block"
code_desert_stone["3"] = "desert_stone_block"
code_desert_stone["S"] = "desert_stonebrick"
-- TODO: test
code_desert_stone["t"] = "air"
local function replace(str, iy, code_table, deco, column_style)
local out = "default:"
@ -589,8 +598,10 @@ end
function tsm_pyramids.make_room(pos, stype, room_id)
local code_table = code_sandstone
if stype == "desert" then
code_table = code_desert
if stype == "desert_sandstone" then
code_table = code_desert_sandstone
elseif stype == "desert_stone" then
code_table = code_desert_stone
end
-- Select random deco block
local deco_ids = {"1", "2", "3"}
@ -611,6 +622,9 @@ function tsm_pyramids.make_room(pos, stype, room_id)
local room = room_types[room_id]
local chests = {}
local column_style = math.random(0,4)
if stype == "desert_stone" then
column_style = 0
end
if room.style == "yrepeat" then
for iy=0,4,1 do
for ix=0,8,1 do
@ -673,8 +687,10 @@ end
function tsm_pyramids.make_traps(pos, stype)
local code_table = code_sandstone
if stype == "desert" then
code_table = code_desert
if stype == "desert_sandstone" then
code_table = code_desert_sandstone
elseif stype == "desert_stone" then
code_table = code_desert_stone
end
shuffle_traps(math.random(10,100))
local hole = {x=pos.x+7,y=pos.y, z=pos.z+7}
@ -692,7 +708,7 @@ end
function tsm_pyramids.flood_sand(pos, stype)
local set_to_sand = {}
local nn = "default:sand"
if stype == "desert" then
if stype == "desert_sandstone" or stype == "desert_stone" then
nn = "default:desert_sand"
end
local hole = {x=pos.x+7,y=pos.y+1, z=pos.z+7}