mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-23 23:50:18 +02:00
add placeholders as not-buildable_to nodes, that can be set to prevent other nodes to build or expanded into expansions
this fixes #292
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
homedecor = homedecor or {}
|
||||
local S = homedecor.gettext
|
||||
local placeholder_node = "homedecor:expansion_placeholder"
|
||||
|
||||
--wrapper around minetest.register_node that sets sane defaults and interprets some specialized settings
|
||||
function homedecor.register(name, original_def)
|
||||
@ -59,7 +60,8 @@ function homedecor.register(name, original_def)
|
||||
def.after_dig_node = def.after_dig_node or function(pos, oldnode, oldmetadata, digger)
|
||||
if expand.top and expand.forward ~= "air" then
|
||||
local top_pos = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
if minetest.get_node(top_pos).name == expand.top then
|
||||
local node = minetest.get_node(top_pos).name
|
||||
if node == expand.top or node == placeholder_node then
|
||||
minetest.remove_node(top_pos)
|
||||
end
|
||||
end
|
||||
@ -69,13 +71,15 @@ function homedecor.register(name, original_def)
|
||||
|
||||
if expand.right and expand.forward ~= "air" 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
|
||||
local node = minetest.get_node(right_pos).name
|
||||
if node == expand.right or node == placeholder_node then
|
||||
minetest.remove_node(right_pos)
|
||||
end
|
||||
end
|
||||
if expand.forward and expand.forward ~= "air" 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
|
||||
local node = minetest.get_node(forward_pos).name
|
||||
if node == expand.forward or node == placeholder_node then
|
||||
minetest.remove_node(forward_pos)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user