Randomize column engravings

This commit is contained in:
Wuzzy 2019-08-20 05:16:29 +02:00
parent 2407c70523
commit 51bf3783ff
1 changed files with 12 additions and 4 deletions

View File

@ -562,11 +562,18 @@ code_desert["3"] = "deco_stone6"
code_desert["S"] = "desert_sandstone_brick" code_desert["S"] = "desert_sandstone_brick"
code_desert["t"] = "desert_trap" code_desert["t"] = "desert_trap"
local function replace(str, iy, code_table, deco) local function replace(str, iy, code_table, deco, column_style)
local out = "default:" local out = "default:"
if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end if iy < 4 and (str == "<" or str == ">" or str == "^" or str == "v") then str = " " end
if iy == 0 and str == "s" then out = "tsm_pyramids:" str = deco[1] end if column_style == 1 or column_style == 2 then
if iy == 3 and str == "s" then out = "tsm_pyramids:" str = deco[2] end if iy == 0 and str == "s" then out = "tsm_pyramids:" str = deco[1] end
if iy == 3 and str == "s" then out = "tsm_pyramids:" str = deco[2] end
elseif column_style == 3 then
if iy == 0 and str == "s" then out = "tsm_pyramids:" str = deco[1] end
if iy == 2 and str == "s" then out = "tsm_pyramids:" str = deco[2] end
elseif column_style == 4 then
if iy == 2 and str == "s" then out = "tsm_pyramids:" str = deco[1] end
end
if str == " " then out = "" end if str == " " then out = "" end
return out..code_table[str] return out..code_table[str]
end end
@ -603,6 +610,7 @@ function tsm_pyramids.make_room(pos, stype, room_id)
end end
local room = room_types[room_id] local room = room_types[room_id]
local chests = {} local chests = {}
local column_style = math.random(0,4)
if room.style == "yrepeat" then if room.style == "yrepeat" then
for iy=0,4,1 do for iy=0,4,1 do
for ix=0,8,1 do for ix=0,8,1 do
@ -619,7 +627,7 @@ function tsm_pyramids.make_room(pos, stype, room_id)
p2 = 3 p2 = 3
end end
local cpos = {x=hole.x+ix,y=hole.y-iy,z=hole.z+iz} local cpos = {x=hole.x+ix,y=hole.y-iy,z=hole.z+iz}
local nn = replace(n_str, iy, code_table, deco) local nn = replace(n_str, iy, code_table, deco, column_style)
minetest.set_node(cpos, {name=nn, param2=p2}) minetest.set_node(cpos, {name=nn, param2=p2})
if nn == "default:chest" then if nn == "default:chest" then
table.insert(chests, cpos) table.insert(chests, cpos)