forked from nalc/homedecor_modpack
use an expand def-field to automaticly expand and unexpand the three available types of expansion and let nearly all decor use this form
example of usage: expand = { top="homedecor:newnode", right="homedecor:rightnode", forward="homedecor:forwardnode" }
This commit is contained in:
parent
9912f72de6
commit
d6ce145f9c
|
@ -320,7 +320,7 @@ for _, color in ipairs(bedcolors) do
|
|||
|
||||
end
|
||||
|
||||
minetest.register_node("homedecor:wardrobe_top", {
|
||||
homedecor.register("wardrobe_top", {
|
||||
tiles = {
|
||||
"forniture_wood.png",
|
||||
"forniture_wood.png",
|
||||
|
@ -329,9 +329,6 @@ minetest.register_node("homedecor:wardrobe_top", {
|
|||
"forniture_wood.png^[transformR90",
|
||||
"homedecor_wardrobe_frontt.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, not_in_creative_inventory=1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -372,17 +369,8 @@ homedecor.register("wardrobe_bottom", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:wardrobe_bottom", "homedecor:wardrobe_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:wardrobe_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end,
|
||||
infotext=S("Wardrobe cabinet"),
|
||||
expand = { top="homedecor:wardrobe_top" },
|
||||
infotext = S("Wardrobe cabinet"),
|
||||
inventory = {
|
||||
size=24,
|
||||
formspec="size[8,8]"..
|
||||
|
@ -391,7 +379,7 @@ homedecor.register("wardrobe_bottom", {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:simple_bench", {
|
||||
homedecor.register("simple_bench", {
|
||||
tiles = {
|
||||
"homedecor_generic_wood.png",
|
||||
"homedecor_generic_wood.png",
|
||||
|
@ -401,9 +389,6 @@ minetest.register_node("homedecor:simple_bench", {
|
|||
"homedecor_bench_large_2_left_back.png^[transformFX"
|
||||
},
|
||||
description = "Simple Bench",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -411,12 +396,11 @@ minetest.register_node("homedecor:simple_bench", {
|
|||
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
|
||||
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
|
||||
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("homedecor:bench_large_1_left", {
|
||||
homedecor.register("bench_large_1_left", {
|
||||
description = "Garden Bench (style 1)",
|
||||
tiles = {
|
||||
"homedecor_bench_large_1_left_top.png",
|
||||
|
@ -427,9 +411,6 @@ minetest.register_node("homedecor:bench_large_1_left", {
|
|||
"homedecor_bench_large_1_left_front.png"
|
||||
},
|
||||
inventory_image = "homedecor_bench_large_1_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -447,21 +428,10 @@ minetest.register_node("homedecor:bench_large_1_left", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.09375, 1.5, 0.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:bench_large_1_left", "homedecor:bench_large_1_right", true)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:bench_large_1_right" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { right="homedecor:bench_large_1_right" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:bench_large_1_right", {
|
||||
homedecor.register("bench_large_1_right", {
|
||||
tiles = {
|
||||
"homedecor_bench_large_1_left_top.png^[transformFX",
|
||||
"homedecor_bench_large_1_left_bottom.png^[transformFX",
|
||||
|
@ -470,9 +440,6 @@ minetest.register_node("homedecor:bench_large_1_right", {
|
|||
"homedecor_bench_large_1_left_back.png^[transformFX",
|
||||
"homedecor_bench_large_1_left_front.png^[transformFX"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -493,7 +460,7 @@ minetest.register_node("homedecor:bench_large_1_right", {
|
|||
})
|
||||
|
||||
|
||||
minetest.register_node("homedecor:bench_large_2_left", {
|
||||
homedecor.register("bench_large_2_left", {
|
||||
description = "Garden Bench (style 2)",
|
||||
tiles = {
|
||||
"homedecor_generic_wood.png",
|
||||
|
@ -504,9 +471,6 @@ minetest.register_node("homedecor:bench_large_2_left", {
|
|||
"homedecor_bench_large_2_left_back.png^[transformFX"
|
||||
},
|
||||
inventory_image = "homedecor_bench_large_2_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -533,21 +497,10 @@ minetest.register_node("homedecor:bench_large_2_left", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.15625, 1.5, 0.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:bench_large_2_left", "homedecor:bench_large_2_right", true)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:bench_large_2_right" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { right="homedecor:bench_large_2_right" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:bench_large_2_right", {
|
||||
homedecor.register("bench_large_2_right", {
|
||||
tiles = {
|
||||
"homedecor_generic_wood.png",
|
||||
"homedecor_generic_wood.png",
|
||||
|
@ -556,9 +509,6 @@ minetest.register_node("homedecor:bench_large_2_right", {
|
|||
"homedecor_bench_large_2_right_back.png",
|
||||
"homedecor_bench_large_2_right_back.png^[transformFX"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -587,7 +537,7 @@ minetest.register_node("homedecor:bench_large_2_right", {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:deckchair_head", {
|
||||
homedecor.register("deckchair_head", {
|
||||
tiles = {
|
||||
"homedecor_deckchair_top_c1.png",
|
||||
"homedecor_deckchair_sides.png",
|
||||
|
@ -596,9 +546,6 @@ minetest.register_node("homedecor:deckchair_head", {
|
|||
"homedecor_deckchair_sides.png",
|
||||
"homedecor_deckchair_front.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -619,13 +566,13 @@ minetest.register_node("homedecor:deckchair_head", {
|
|||
{-0.375, -0.5, 0, -0.3125, -0.25, 0.0625}, -- NodeBox14
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { 0, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { 0, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:deckchair_foot", {
|
||||
homedecor.register("deckchair_foot", {
|
||||
tiles = {
|
||||
"homedecor_deckchair_top_c2.png",
|
||||
"homedecor_deckchair_sides.png",
|
||||
|
@ -655,18 +602,7 @@ minetest.register_node("homedecor:deckchair_foot", {
|
|||
type = "fixed",
|
||||
fixed = { -0.45, -0.5, -0.5, 0.45, 0.35, 1.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:deckchair_foot", "homedecor:deckchair_head", false)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:deckchair_head" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { forward="homedecor:deckchair_head" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:wall_shelf", {
|
||||
|
@ -687,7 +623,7 @@ minetest.register_node("homedecor:wall_shelf", {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:grandfather_clock_bottom", {
|
||||
homedecor.register("grandfather_clock_bottom", {
|
||||
description = "Grandfather Clock",
|
||||
tiles = {
|
||||
"homedecor_grandfather_clock_sides.png",
|
||||
|
@ -698,9 +634,6 @@ minetest.register_node("homedecor:grandfather_clock_bottom", {
|
|||
"homedecor_grandfather_clock_bottom.png"
|
||||
},
|
||||
inventory_image = "homedecor_grandfather_clock_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -715,19 +648,10 @@ minetest.register_node("homedecor:grandfather_clock_bottom", {
|
|||
type = "fixed",
|
||||
fixed = { -0.4, -0.5, -0.4, 0.4, 1.5, 0.4 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:grandfather_clock_bottom", "homedecor:grandfather_clock_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:grandfather_clock_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end,
|
||||
expand = { top="homedecor:grandfather_clock_top" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:grandfather_clock_top", {
|
||||
homedecor.register("grandfather_clock_top", {
|
||||
tiles = {
|
||||
"homedecor_grandfather_clock_sides.png",
|
||||
"homedecor_grandfather_clock_sides.png",
|
||||
|
@ -736,9 +660,6 @@ minetest.register_node("homedecor:grandfather_clock_top", {
|
|||
"homedecor_grandfather_clock_sides.png",
|
||||
"homedecor_grandfather_clock_top.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
|
|
@ -491,7 +491,7 @@ minetest.register_node("homedecor:dishwasher_granite", {
|
|||
groups = { snappy = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:doghouse_base", {
|
||||
homedecor.register("doghouse_base", {
|
||||
tiles = {
|
||||
"homedecor_doghouse_base_top.png",
|
||||
"homedecor_doghouse_base_bottom.png",
|
||||
|
@ -502,9 +502,6 @@ minetest.register_node("homedecor:doghouse_base", {
|
|||
},
|
||||
description = "Doghouse",
|
||||
inventory_image = "homedecor_doghouse_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -526,19 +523,10 @@ minetest.register_node("homedecor:doghouse_base", {
|
|||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.0, 0.5 }
|
||||
},
|
||||
groups = {snappy=3},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:doghouse_base", "homedecor:doghouse_roof")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:doghouse_roof" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { top="homedecor:doghouse_roof" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:doghouse_roof", {
|
||||
homedecor.register("doghouse_roof", {
|
||||
tiles = {
|
||||
"homedecor_doghouse_roof_top.png",
|
||||
"homedecor_doghouse_roof_bottom.png",
|
||||
|
@ -547,9 +535,6 @@ minetest.register_node("homedecor:doghouse_roof", {
|
|||
"homedecor_doghouse_roof_front.png",
|
||||
"homedecor_doghouse_roof_front.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -584,7 +569,7 @@ minetest.register_node("homedecor:doghouse_roof", {
|
|||
groups = {snappy=3, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:pool_table", {
|
||||
homedecor.register("pool_table", {
|
||||
tiles = {
|
||||
"homedecor_pool_table_top1.png",
|
||||
"homedecor_pool_table_bottom1.png",
|
||||
|
@ -595,9 +580,6 @@ minetest.register_node("homedecor:pool_table", {
|
|||
},
|
||||
description = "Pool Table",
|
||||
inventory_image = "homedecor_pool_table_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -631,21 +613,10 @@ minetest.register_node("homedecor:pool_table", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.3125, 1.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:pool_table", "homedecor:pool_table_2", false)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:pool_table_2" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { forward="homedecor:pool_table_2" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:pool_table_2", {
|
||||
homedecor.register("pool_table_2", {
|
||||
tiles = {
|
||||
"homedecor_pool_table_top1.png^[transformR180",
|
||||
"homedecor_pool_table_bottom1.png",
|
||||
|
@ -654,9 +625,6 @@ minetest.register_node("homedecor:pool_table_2", {
|
|||
"homedecor_pool_table_end1.png",
|
||||
"homedecor_pool_table_end1.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=3, not_in_creative_inventory=1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -727,17 +695,14 @@ minetest.register_node("homedecor:trash_can", {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:well_base", {
|
||||
homedecor.register("well_base", {
|
||||
tiles = {
|
||||
"homedecor_well_base_top.png",
|
||||
"default_cobble.png"
|
||||
},
|
||||
inventory_image = "homedecor_well_inv.png",
|
||||
description = "Water well",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3 },
|
||||
groups = { snappy = 3 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -764,19 +729,10 @@ minetest.register_node("homedecor:well_base", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:well_base", "homedecor:well_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:well_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { top="homedecor:well_top" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:well_top", {
|
||||
homedecor.register("well_top", {
|
||||
tiles = {
|
||||
"homedecor_well_roof_top.png",
|
||||
"homedecor_well_roof_wood.png",
|
||||
|
@ -785,9 +741,6 @@ minetest.register_node("homedecor:well_top", {
|
|||
"homedecor_well_roof_side2.png",
|
||||
"homedecor_well_roof_side1.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -1170,7 +1123,7 @@ minetest.register_node("homedecor:dartboard", {
|
|||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:piano_left", {
|
||||
homedecor.register("piano_left", {
|
||||
tiles = {
|
||||
"homedecor_piano_top_left.png",
|
||||
"homedecor_piano_sides.png",
|
||||
|
@ -1181,9 +1134,6 @@ minetest.register_node("homedecor:piano_left", {
|
|||
},
|
||||
inventory_image = "homedecor_piano_inv.png",
|
||||
description = "Piano",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -1202,21 +1152,10 @@ minetest.register_node("homedecor:piano_left", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.125, 1.5, 0.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:piano_left", "homedecor:piano_right", true)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:piano_right" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { right="homedecor:piano_right" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:piano_right", {
|
||||
homedecor.register("piano_right", {
|
||||
tiles = {
|
||||
"homedecor_piano_top_right.png",
|
||||
"homedecor_piano_sides.png",
|
||||
|
@ -1225,9 +1164,6 @@ minetest.register_node("homedecor:piano_right", {
|
|||
"homedecor_piano_sides.png",
|
||||
"homedecor_piano_front_right.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -1509,16 +1445,13 @@ minetest.register_node("homedecor:stonepath", {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:barbecue", {
|
||||
homedecor.register("barbecue", {
|
||||
description = "Barbecue",
|
||||
tiles = {
|
||||
{name="homedecor_barbecue_top.png", animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=2}},
|
||||
"forniture_black_metal.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy=3 },
|
||||
light_source = 9,
|
||||
node_box = {
|
||||
|
@ -1546,25 +1479,13 @@ minetest.register_node("homedecor:barbecue", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.3125, 0.5, 0.625, 0.3125 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:barbecue", "homedecor:barbecue_meat")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:barbecue_meat" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { top="homedecor:barbecue_meat" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:barbecue_meat", {
|
||||
homedecor.register("barbecue_meat", {
|
||||
tiles = {
|
||||
"homedecor_barbecue_meat.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy=3, not_in_creative_inventory=1 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -1576,7 +1497,7 @@ minetest.register_node("homedecor:barbecue_meat", {
|
|||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { 0, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:beer_tap", {
|
||||
|
@ -1662,7 +1583,7 @@ minetest.register_node("homedecor:beer_mug", {
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:tool_cabinet_bottom", {
|
||||
homedecor.register("tool_cabinet_bottom", {
|
||||
description = "Metal tool cabinet and work table",
|
||||
tiles = {
|
||||
"homedecor_tool_cabinet_bottom_top.png",
|
||||
|
@ -1673,9 +1594,6 @@ minetest.register_node("homedecor:tool_cabinet_bottom", {
|
|||
"homedecor_tool_cabinet_bottom_front.png"
|
||||
},
|
||||
inventory_image = "homedecor_tool_cabinet_inv.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy=3 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -1691,19 +1609,10 @@ minetest.register_node("homedecor:tool_cabinet_bottom", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
||||
"homedecor:tool_cabinet_bottom", "homedecor:tool_cabinet_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:tool_cabinet_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = { top="homedecor:tool_cabinet_top" },
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:tool_cabinet_top", {
|
||||
homedecor.register("tool_cabinet_top", {
|
||||
tiles = {
|
||||
"homedecor_tool_cabinet_top_top.png",
|
||||
"homedecor_tool_cabinet_top_bottom.png",
|
||||
|
@ -1712,9 +1621,6 @@ minetest.register_node("homedecor:tool_cabinet_top", {
|
|||
"homedecor_tool_cabinet_top_back.png",
|
||||
"homedecor_tool_cabinet_top_front.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = { snappy=3, not_in_creative_inventory=1 },
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
|
|
@ -53,15 +53,9 @@ homedecor.register("refrigerator_steel_bottom", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
homedecor.stack_vertically(itemstack, placer, pointed_thing, itemstack:get_name(), "homedecor:refrigerator_steel_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:refrigerator_steel_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end,
|
||||
expand = {
|
||||
top="homedecor:refrigerator_steel_top"
|
||||
},
|
||||
infotext=S("Refrigerator"),
|
||||
inventory = {
|
||||
size=50,
|
||||
|
@ -108,15 +102,9 @@ homedecor.register("refrigerator_white_bottom", {
|
|||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
homedecor.stack_vertically(itemstack, placer, pointed_thing, itemstack:get_name(), "homedecor:refrigerator_white_top")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
||||
if minetest.get_node(pos2).name == "homedecor:refrigerator_white_top" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end,
|
||||
expand = {
|
||||
top="homedecor:refrigerator_white_top"
|
||||
},
|
||||
infotext=S("Refrigerator"),
|
||||
inventory = {
|
||||
size=50,
|
||||
|
|
|
@ -16,6 +16,10 @@ local default_inventory_formspec = "size[8,9]"..
|
|||
"list[current_player;main;0,6.08;8,3;8]"..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
|
||||
local function remove_node_if()
|
||||
end
|
||||
|
||||
|
||||
--wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings
|
||||
function homedecor.register(name, def)
|
||||
def.paramtype = def.paramtype or "light"
|
||||
|
@ -73,6 +77,47 @@ function homedecor.register(name, def)
|
|||
end
|
||||
end
|
||||
|
||||
local expand = def.expand
|
||||
def.expand = nil
|
||||
|
||||
if expand then
|
||||
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
|
||||
if expand.top then
|
||||
homedecor.stack_vertically(itemstack, placer, pointed_thing, itemstack:get_name(), expand.top)
|
||||
end
|
||||
if expand.right then
|
||||
homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.right, true)
|
||||
end
|
||||
if expand.forward then
|
||||
homedecor.stack_sideways(itemstack, placer, pointed_thing, itemstack:get_name(), expand.forward, false)
|
||||
end
|
||||
end
|
||||
def.after_dig_node = def.after_dig_node or function(pos, oldnode, oldmetadata, digger)
|
||||
if expand.top then
|
||||
local top_pos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
if minetest.get_node(top_pos).name == expand.top then
|
||||
minetest.remove_node(top_pos)
|
||||
end
|
||||
end
|
||||
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
|
||||
if expand.right then
|
||||
local right_pos = { x=pos.x+homedecor.fdir_to_right[fdir+1][1], y=pos.y, z=pos.z+homedecor.fdir_to_right[fdir+1][2] }
|
||||
if minetest.get_node(right_pos).name == expand.right then
|
||||
minetest.remove_node(right_pos)
|
||||
end
|
||||
end
|
||||
if expand.forward then
|
||||
local forward_pos = { x=pos.x+homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+homedecor.fdir_to_fwd[fdir+1][2] }
|
||||
if minetest.get_node(forward_pos).name == expand.forward then
|
||||
minetest.remove_node(forward_pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- register the actual minetest node
|
||||
minetest.register_node("homedecor:" .. name, def)
|
||||
end
|
||||
|
|
|
@ -224,8 +224,7 @@ minetest.register_node('homedecor:utility_table_legs', {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:desk", {
|
||||
drawtype = "nodebox",
|
||||
homedecor.register("desk", {
|
||||
description = "Desk",
|
||||
tiles = {
|
||||
"forniture_wood.png",
|
||||
|
@ -236,8 +235,6 @@ minetest.register_node("homedecor:desk", {
|
|||
"homedecor_desk_front_l.png"
|
||||
},
|
||||
inventory_image = "homedecor_desk_inv.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -253,22 +250,12 @@ minetest.register_node("homedecor:desk", {
|
|||
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 0.5 }
|
||||
},
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return homedecor.stack_sideways(itemstack, placer, pointed_thing,
|
||||
"homedecor:desk", "homedecor:desk_r", true)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local fdir = oldnode.param2
|
||||
if not fdir or fdir > 3 then return end
|
||||
local pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
|
||||
if minetest.get_node(pos2).name == "homedecor:desk_r" then
|
||||
minetest.remove_node(pos2)
|
||||
end
|
||||
end
|
||||
expand = {
|
||||
right="homedecor:desk_r"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("homedecor:desk_r", {
|
||||
drawtype = "nodebox",
|
||||
homedecor.register("desk_r", {
|
||||
tiles = {
|
||||
"forniture_wood.png",
|
||||
"forniture_wood.png",
|
||||
|
@ -277,8 +264,6 @@ minetest.register_node("homedecor:desk_r", {
|
|||
"homedecor_desk_back_r.png",
|
||||
"homedecor_desk_front_r.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user