Set up puzzle seals to be able to dig a staircase shaft through the slade layer. TODO: the puzzle to guard the trigger.

This commit is contained in:
FaceDeer 2019-11-30 21:59:01 -07:00
parent ff44fb87c2
commit 91e2da49c8
3 changed files with 120 additions and 25 deletions

View File

@ -399,8 +399,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
-- puzzle shaft
local puzzle_init = nil
-- puzzle seal
local puzzle_seal = nil
if pit_uninitialized and minp.x == shaft.location.x and minp.z == shaft.location.z then
local index2d = mapgen_helper.index2d(emin, emax, minp.x + 3, minp.z + 3)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
@ -408,20 +408,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
local floor_height = math.floor(abs_cave * floor_mult + median + floor_displace + wave)
local underside_height = math.floor(y_min + math.abs(wave) / 5)
local shaftwallmin = {x=minp.x, y=math.max(underside_height-3, minp.y), z=minp.z}
local shaftwallmax = {x=minp.x+4, y=math.min(floor_height, maxp.y), z=minp.z+4}
for wall_vi in area:iterp(shaftwallmin, shaftwallmax) do
data[wall_vi] = c_slade_block
end
local puzzle_seal_y = floor_height
if puzzle_seal_y < maxp.y and puzzle_seal_y > minp.y then
for seal_vi in area:iter(minp.x+1, puzzle_seal_y, minp.z+1, minp.x+3, puzzle_seal_y+2, minp.z+3) do
data[seal_vi] = c_air
end
puzzle_init = {x=minp.x+2, y=puzzle_seal_y, z=minp.z+2}
if floor_height < maxp.y and floor_height > minp.y then
for plat_vi in area:iter(minp.x, floor_height-6, minp.z, minp.x+6, floor_height, minp.z+6) do
data[plat_vi] = c_slade_block
end
puzzle_seal = {x=minp.x+3, y=floor_height+1, z=minp.z+3}
end
end
@ -435,8 +427,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
--write it to world
vm:write_to_map()
if puzzle_init ~= nil then
minetest.set_node(puzzle_init, {name="df_underworld_items:puzzle_seal"})
if puzzle_seal ~= nil then
minetest.place_schematic({x=puzzle_seal.x-3, y=puzzle_seal.y, z=puzzle_seal.z-3}, df_underworld_items.seal_temple_schem, 0, {}, true)
minetest.set_node(puzzle_seal, {name="df_underworld_items:puzzle_seal"})
end
if bones_loot_path then

View File

@ -10,7 +10,7 @@ minetest.register_node("df_primordial_items:jungle_leaves", {
drawtype = "plantlike",
walkable = false,
waving = 2,
visual_scale = 1.2,
visual_scale = 1.4,
tiles = {"dfcaverns_jungle_leaves_01.png"},
inventory_image = "dfcaverns_jungle_leaves_01.png",
wield_image = "dfcaverns_jungle_leaves_01.png",
@ -41,7 +41,7 @@ minetest.register_node("df_primordial_items:jungle_leaves_glowing", {
drawtype = "plantlike",
walkable = false,
waving = 2,
visual_scale = 1.2,
visual_scale = 1.4,
tiles = {"dfcaverns_jungle_leaves_02.png"},
inventory_image = "dfcaverns_jungle_leaves_02.png",
wield_image = "dfcaverns_jungle_leaves_02.png",

View File

@ -2,6 +2,8 @@
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local invulnerable = df_underworld_items.config.invulnerable_slade and not minetest.settings:get_bool("creative_mode")
local get_formspec = function(pos, completion)
completion = completion or 0.5
local formspec =
@ -29,8 +31,9 @@ local puzzle_seal_def = {
mesh = "underworld_seal.obj",
tiles = {"dfcaverns_slade_block.png", "dfcaverns_slade_block.png^dfcaverns_seal.png", "dfcaverns_slade_block.png"},
paramtype = "light",
paramtype2 = "facedir",
light_source = 12,
groups = {immortal=1, stone=1, level=3, slade=1, cracky=1, pit_plasma_resistant=1, mese_radiation_shield=1, not_in_creative_inventory=1},
groups = {stone=1, level=3, slade=1, pit_plasma_resistant=1, mese_radiation_shield=1, not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults({ footstep = { name = "bedrock2_step", gain = 1 } }),
selection_box = {
type = "fixed",
@ -42,13 +45,50 @@ local puzzle_seal_def = {
},
is_ground_content = false,
on_blast = function() end,
on_rotate = function() return false end,
on_construct = function(pos)
ensure_inventory(pos)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
minetest.get_node_timer(pos):start(1)
--ensure_inventory(pos) -- needed because mapgen doesn't call on_construct
local player_name = clicker:get_player_name()
minetest.show_formspec(player_name, "df_underworld_items_puzzle_seal:"..minetest.pos_to_string(pos)..":"..player_name, get_formspec(pos))
--local player_name = clicker:get_player_name()
--minetest.show_formspec(player_name, "df_underworld_items_puzzle_seal:"..minetest.pos_to_string(pos)..":"..player_name, get_formspec(pos))
end,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
local below_node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
if below_node.name == "ignore" then
minetest.get_node_timer(pos):start(1)
return
end
if minetest.get_item_group(below_node.name, "slade") == 0 then
minetest.set_node(pos, {name="air"})
return
end
local rot = node.param2
if rot == 0 then
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 0, {}, true)
node.param2 = 1
elseif rot == 1 then
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 90, {}, true)
node.param2 = 2
elseif rot == 2 then
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 180, {}, true)
node.param2 = 3
elseif rot == 3 then
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 270, {}, true)
node.param2 = 0
else
return
end
minetest.set_node(pos, {name="air"})
local newpos = {x=pos.x, y=pos.y-2, z=pos.z}
minetest.set_node(newpos, node)
minetest.get_node_timer(newpos):start(1)
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
end,
@ -58,6 +98,26 @@ local puzzle_seal_def = {
end,
}
if invulnerable then
puzzle_seal_def.groups.immortal = 1
else
puzzle_seal_def.groups.cracky = 3
end
minetest.register_node("df_underworld_items:puzzle_seal", puzzle_seal_def)
local n1 = { name = "df_underworld_items:slade_block" }
local n5 = { name = "default:meselamp" }
local n6 = { name = "air", prob = 0 } -- ceiling pieces to leave in place
local n8 = { name = "df_underworld_items:puzzle_seal" }
local n3 = { name = "air"}
local n2 = n3
local n4 = n3
local n7 = n3
local n9 = n3
local n10 = n1
local n11 = n3
if minetest.get_modpath("stairs") then
local stair_groups = {level = 3, mese_radiation_shield=1, pit_plasma_resistant=1, slade=1}
if invulnerable then
@ -66,14 +126,56 @@ if minetest.get_modpath("stairs") then
stair_groups.cracky = 3
end
stairs.register_stair(
stairs.register_stair_and_slab(
"slade_block",
"df_underworld_items:slade_block",
stair_groups,
{"dfcaverns_slade_block.png"},
S("Slade Block Stair"),
S("Slade Block Slab"),
default.node_sound_stone_defaults({ footstep = { name = "bedrock2_step", gain = 1 } })
)
n2 = { name = "stairs:stair_slade_block", param2 = 3 }
n4 = { name = "stairs:stair_slade_block", param2 = 1 }
n7 = { name = "stairs:stair_slade_block", param2 = 2 }
n9 = { name = "stairs:stair_slade_block" }
n10 = { name = "stairs:slab_slade_block", param2 = 21 }
n11 = { name = "stairs:slab_slade_block", param2 = 1 }
end
minetest.register_node("df_underworld_items:puzzle_seal", puzzle_seal_def)
df_underworld_items.seal_temple_schem = {
size = {y = 6, x = 7, z = 7},
data = {
n1, n2, n3, n3, n3, n4, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3,
n3, n3, n3, n1, n5, n3, n3, n3, n3, n3, n5, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6, n6, n6, n6, n7, n3, n3, n3, n3, n3, n7, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6,
n6, n6, n3, n3, n3, n6, n6, n3, n3, n3, n8, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n3, n3, n3, n6, n6, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6, n6,
n6, n3, n3, n3, n6, n6, n9, n3, n3, n3, n3, n3, n9, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n1, n2, n3,
n3, n3, n4, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3,
n1, n5, n3, n3, n3, n3, n3, n5, n6, n6, n6, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6,
}
}
df_underworld_items.seal_stair_schem = {
size = {y = 2, x = 7, z = 7},
data = {
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n10,
n3, n3, n3, n1, n1, n3, n11, n1, n10, n3, n1, n1, n11, n3, n3, n3, n3,
n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3,
n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3,
n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
}
}