backwards-compatible registrations

This commit is contained in:
tour 2025-07-01 01:20:08 +02:00
parent fb8403c7f4
commit 966099d3c1
3 changed files with 83 additions and 12 deletions

7
TODO.txt Normal file
View File

@ -0,0 +1,7 @@
sounds
painted doors
How to test backwards compatibility:
/eval pos = here
/eval for name, _ in pairs(core.registered_nodes) do if name:find("hidden_door") then core.set_node(pos, {name=name}) pos = pos + vector.new(1,0,0) end end

View File

@ -2,4 +2,4 @@ name = hidden_doors
title = hidden doors
description = adds doors which look like walls
depends = doors
optional_depends = default, stairs
optional_depends = default, stairs, darkage, moreblocks

View File

@ -1,16 +1,14 @@
local register = {}
if core.get_modpath("default") or true then
if core.get_modpath("default") then
for _, name in ipairs({
-- stones
"stone",
"cobble",
"stonebrick",
"stone_block",
"mossycobble",
"desert_stone",
"desert_cobble",
"desert_stonebrick",
"desert_stone_block",
"sandstone",
"sandstonebrick",
@ -22,7 +20,6 @@ if core.get_modpath("default") or true then
"silver_sandstone_brick",
"silver_sandstone_block",
"obsidian",
"obsidianbrick",
"obsidian_block",
"brick",
-- trees
@ -37,12 +34,6 @@ if core.get_modpath("default") or true then
"pine_wood",
"acacia_wood",
"aspen_wood",
-- metal
"bronzeblock",
"copperblock",
"goldblock",
"steelblock",
"tinblock",
-- other
"dirt",
"ice",
@ -54,8 +45,81 @@ if core.get_modpath("default") or true then
"desert_sand",
"permafrost"
}) do
register[("hidden_doors:default_%s"):format(name)] = ("default:%s"):format(name)
register[("hidden_door_%s"):format(name)] = ("default:%s"):format(name)
end
for _, name in ipairs({
"stone_brick",
"bronze_block",
"copper_block",
"gold_block",
"steel_block",
"tin_block",
"obsidian_brick",
}) do
register[("hidden_door_%s"):format(name)] = ("default:%s"):format(name:gsub("_", ""))
end
register["hidden_door_desert_stone_brick"] = "default:desert_stonebrick"
end
if core.get_modpath("darkage") then
for _, name in ipairs({
"adobe",
"basalt",
"basalt_rubble",
"basalt_brick",
"basalt_block",
"gneiss",
"gneiss_rubble",
"gneiss_brick",
"gneiss_block",
"marble",
"marble_tile",
"ors",
"ors_rubble",
"ors_brick",
"ors_block",
"serpentine",
"shale",
"schist",
"slate",
"slate_rubble",
"slate_tile",
"slate_block",
"slate_brick",
"tuff",
"tuff_bricks",
"tuff_rubble",
"rhyolitic_tuff",
"rhyolitic_tuff_bricks",
"old_tuff_bricks",
"rhyolitic_tuff_rubble"
}) do
register[("hidden_door_%s"):format(name)] = ("darkage:%s"):format(name)
end
end
if core.get_modpath("moreblocks") then
for _, name in ipairs({
"cactus_brick",
"circle_stone_bricks",
"coal_stone",
"cobble_compressed",
"copperpatina",
"empty_shelf",
"grey_bricks",
"iron_stone",
"iron_stone_bricks",
"plankstone",
"split_stone_tile",
"stone_tile",
"tar",
"wood_tile_full"
}) do
register[("hidden_door_%s"):format(name)] = ("moreblocks:%s"):format(name)
end
register["hidden_door_jungletree_top"] = "moreblocks:all_faces_jungle_tree"
register["hidden_door_tree_top"] = "moreblocks:all_faces_tree"
end
for doorname, nodename in pairs(register) do