mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-22 16:10:18 +01:00
use table.copy instead of own clone node
This commit is contained in:
parent
b28f1314da
commit
7e7b2bcabb
@ -89,28 +89,19 @@ end
|
|||||||
-- 3d-ify default mtg wood and steel doors and trap doors
|
-- 3d-ify default mtg wood and steel doors and trap doors
|
||||||
|
|
||||||
if minetest.get_modpath("doors") then
|
if minetest.get_modpath("doors") then
|
||||||
local function clone_node(name)
|
|
||||||
local node2 = {}
|
|
||||||
local node = minetest.registered_nodes[name]
|
|
||||||
for k,v in pairs(node) do
|
|
||||||
node2[k]=v
|
|
||||||
end
|
|
||||||
return node2
|
|
||||||
end
|
|
||||||
|
|
||||||
local def
|
local def
|
||||||
for _,mat in ipairs({"wood", "steel"}) do
|
for _,mat in ipairs({"wood", "steel"}) do
|
||||||
def = clone_node("doors:door_"..mat.."_a")
|
def = table.copy(minetest.registered_nodes["doors:door_"..mat.."_a"])
|
||||||
def.mesh = "homedecor_3d_door_"..mat.."_a.obj"
|
def.mesh = "homedecor_3d_door_"..mat.."_a.obj"
|
||||||
minetest.register_node(":doors:door_"..mat.."_a", def)
|
minetest.register_node(":doors:door_"..mat.."_a", def)
|
||||||
|
|
||||||
def = clone_node("doors:door_"..mat.."_b")
|
def = table.copy(minetest.registered_nodes["doors:door_"..mat.."_b"])
|
||||||
def.mesh = "homedecor_3d_door_"..mat.."_b.obj"
|
def.mesh = "homedecor_3d_door_"..mat.."_b.obj"
|
||||||
minetest.register_node(":doors:door_"..mat.."_b", def)
|
minetest.register_node(":doors:door_"..mat.."_b", def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,mat in ipairs({"", "_steel"}) do
|
for _,mat in ipairs({"", "_steel"}) do
|
||||||
def = clone_node("doors:trapdoor"..mat)
|
def = table.copy(minetest.registered_nodes["doors:trapdoor"..mat])
|
||||||
def.drawtype = "mesh"
|
def.drawtype = "mesh"
|
||||||
def.mesh = "homedecor_3d_trapdoor"..mat..".obj"
|
def.mesh = "homedecor_3d_trapdoor"..mat..".obj"
|
||||||
def.tiles = {
|
def.tiles = {
|
||||||
@ -119,7 +110,7 @@ if minetest.get_modpath("doors") then
|
|||||||
}
|
}
|
||||||
minetest.register_node(":doors:trapdoor"..mat, def)
|
minetest.register_node(":doors:trapdoor"..mat, def)
|
||||||
|
|
||||||
def = clone_node("doors:trapdoor"..mat.."_open")
|
def = table.copy(minetest.registered_nodes["doors:trapdoor"..mat.."_open"])
|
||||||
def.mesh = "homedecor_3d_trapdoor"..mat.."_open.obj"
|
def.mesh = "homedecor_3d_trapdoor"..mat.."_open.obj"
|
||||||
def.drawtype = "mesh"
|
def.drawtype = "mesh"
|
||||||
def.tiles = {
|
def.tiles = {
|
||||||
|
@ -3,17 +3,6 @@
|
|||||||
local S = homedecor.gettext
|
local S = homedecor.gettext
|
||||||
local mesecons_mp = minetest.get_modpath("mesecons")
|
local mesecons_mp = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
-- clone node
|
|
||||||
|
|
||||||
function hd_doors_clone_node(name)
|
|
||||||
local node2 = {}
|
|
||||||
local node = minetest.registered_nodes[name]
|
|
||||||
for k,v in pairs(node) do
|
|
||||||
node2[k]=v
|
|
||||||
end
|
|
||||||
return node2
|
|
||||||
end
|
|
||||||
|
|
||||||
-- new doors using minetest_game doors API
|
-- new doors using minetest_game doors API
|
||||||
|
|
||||||
local door_list = {
|
local door_list = {
|
||||||
@ -181,22 +170,22 @@ for _, door in ipairs(door_list) do
|
|||||||
local nn_b = "doors:homedecor_"..door.name.."_b"
|
local nn_b = "doors:homedecor_"..door.name.."_b"
|
||||||
|
|
||||||
if door.alpha then
|
if door.alpha then
|
||||||
local def = hd_doors_clone_node(nn_a)
|
local def = table.copy(minetest.registered_nodes[nn_a])
|
||||||
def.use_texture_alpha = true
|
def.use_texture_alpha = true
|
||||||
def.mesh = "door_a.obj" -- leaving this out will break the _a model
|
def.mesh = "door_a.obj" -- leaving this out will break the _a model
|
||||||
minetest.register_node(":"..nn_a, def) -- assignment when the override takes place
|
minetest.register_node(":"..nn_a, def) -- assignment when the override takes place
|
||||||
|
|
||||||
def = hd_doors_clone_node(nn_b)
|
def = table.copy(minetest.registered_nodes[nn_b])
|
||||||
def.use_texture_alpha = true
|
def.use_texture_alpha = true
|
||||||
minetest.register_node(":"..nn_b, def)
|
minetest.register_node(":"..nn_b, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
if door.custom_model and hd_3d then
|
if door.custom_model and hd_3d then
|
||||||
def = hd_doors_clone_node(nn_a)
|
def = table.copy(minetest.registered_nodes[nn_a])
|
||||||
def.mesh = door.custom_model.."_a.obj"
|
def.mesh = door.custom_model.."_a.obj"
|
||||||
minetest.register_node(":"..nn_a, def)
|
minetest.register_node(":"..nn_a, def)
|
||||||
|
|
||||||
def = hd_doors_clone_node(nn_b)
|
def = table.copy(minetest.registered_nodes[nn_b])
|
||||||
def.mesh = door.custom_model.."_b.obj"
|
def.mesh = door.custom_model.."_b.obj"
|
||||||
minetest.register_node(":"..nn_b, def)
|
minetest.register_node(":"..nn_b, def)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user