Don't generate terrain before dungeon.
This commit is contained in:
parent
77a6129e00
commit
be7d7a1976
4 changed files with 65 additions and 20 deletions
43
dungeon.lua
43
dungeon.lua
|
@ -196,7 +196,9 @@ newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|||
|
||||
local ready = meta:get_string('formspec')
|
||||
if treasures and ready == '' then
|
||||
meta:set_string("formspec", '0')
|
||||
if math.random(10) == 1 and fun_caves.dungeon_spawns and #fun_caves.dungeon_spawns > 0 then
|
||||
meta:set_string("formspec", '')
|
||||
minetest.remove_node(pos)
|
||||
|
||||
local desc = fun_caves.dungeon_spawns[math.random(#fun_caves.dungeon_spawns)]
|
||||
|
@ -205,7 +207,9 @@ newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|||
return
|
||||
end
|
||||
|
||||
local obj = minetest.add_entity(pos, desc.name)
|
||||
local mpos = table.copy(pos)
|
||||
mpos.y = mpos.y + 1
|
||||
local obj = minetest.add_entity(mpos, desc.name)
|
||||
if not obj then
|
||||
return
|
||||
end
|
||||
|
@ -234,8 +238,10 @@ newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|||
end
|
||||
minetest.chat_send_player(player_name, minetest.colorize('#FF0000', 'You\'ve been poisoned!'))
|
||||
fun_caves.set_status(player_name, 'poisoned', 2 ^ math.random(8), {damage = 1})
|
||||
meta:set_string("formspec", '')
|
||||
return
|
||||
elseif minetest.get_modpath('tnt') and math.random(20) == 1 then
|
||||
meta:set_string("formspec", '')
|
||||
minetest.set_node(pos, {name = 'tnt:tnt_burning'})
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if timer then
|
||||
|
@ -536,7 +542,7 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm
|
|||
elseif ry == (cell_size - 1) and (cy < (cells_y - 1) or not centered_in) then
|
||||
data[ivm] = node['fun_caves:dungeon_floor_2']
|
||||
elseif content[cx][cy][cz] == 'room' then
|
||||
if math.random(1000) == 1 and data[ivm - area.ystride] == node['fun_caves:dungeon_floor_1'] then
|
||||
if ry == 1 and math.random(50) == 1 and data[ivm - area.ystride] == node['fun_caves:dungeon_floor_1'] then
|
||||
data[ivm] = node['fun_caves:coffer']
|
||||
else
|
||||
data[ivm] = node['air']
|
||||
|
@ -557,6 +563,39 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm
|
|||
end
|
||||
end
|
||||
|
||||
for z = minp.z + 1, maxp.z - 1 do
|
||||
for y = minp.y + 1, maxp.y - 1 do
|
||||
local ivm = area:index(minp.x + 1, y, z)
|
||||
for x = minp.x + 1, maxp.x - 1 do
|
||||
local height = (y - minp.y) % cell_size
|
||||
if data[ivm] == node['fun_caves:dungeon_wall_1'] and (x - minp.x) % 2 == 0 and (z - minp.z) % 2 == 0 and (height == 4 or (height == 2 and math.random(5) == 1)) then
|
||||
local dir = math.random(4)
|
||||
local ivm2 = ivm
|
||||
local p2 = 3
|
||||
if dir == 1 then
|
||||
ivm2 = ivm2 + 1
|
||||
elseif dir == 2 then
|
||||
ivm2 = ivm2 - 1
|
||||
p2 = 2
|
||||
elseif dir == 3 then
|
||||
ivm2 = ivm2 + area.zstride
|
||||
p2 = 5
|
||||
elseif dir == 4 then
|
||||
ivm2 = ivm2 - area.zstride
|
||||
p2 = 4
|
||||
end
|
||||
|
||||
if data[ivm2] == node['air'] then
|
||||
data[ivm2] = node['default:torch']
|
||||
p2data[ivm2] = p2
|
||||
end
|
||||
end
|
||||
|
||||
ivm = ivm + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 0, #data do
|
||||
if data[i] == 'stairway' then
|
||||
data[i] = node['air']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue