diff --git a/mods/bg_tree/node_leaves.lua b/mods/bg_tree/node_leaves.lua index 7162286..1f75098 100644 --- a/mods/bg_tree/node_leaves.lua +++ b/mods/bg_tree/node_leaves.lua @@ -64,72 +64,9 @@ reg_leaves("leaves_alive", { }, }) ---[[ -local function check_decompose (pos) - local node = minetest.get_node(pos) - return blockgame.item_matches(node.name, {"group:leaves_decomposing"}) -end -]]-- --- TODO: generalize stacking node registration and put into API. local decomposing_leaves_layers = 4 ---[[ -local function after_place_stack (pos) - if not check_decompose(pos) then return end - - local below = pos + blockgame.vector.dirs.down - if check_decompose(below) then - local node = minetest.get_node(pos) - local below_node = minetest.get_node(below) - - local def = minetest.registered_nodes[node.name] - local below_def = minetest.registered_nodes[below_node.name] - - if below_def.level ~= decomposing_leaves_layers then - local max_diff = decomposing_leaves_layers - below_def.level - local diff = math.min(max_diff, def.level) - - minetest.swap_node(below, {name = modname .. ":leaves_decomposing_" .. (below_def.level + diff)}) - if diff == def.level then - minetest.remove_node(pos) - else - minetest.swap_node(pos, {name = modname .. ":leaves_decomposing_" .. (def.level - diff)}) - end - end - end - - local above = pos:offset(0, 1, 0) - if check_decompose(above) then - after_place_stack(above) - end -end - -local function reg_decomposing (level) - local height = level / decomposing_leaves_layers - - local description = "Decomposing Leaves (" .. level .. "/" .. decomposing_leaves_layers .. ")" - if level == decomposing_leaves_layers then description = "Decomposing Leaves" end - - local drawtype = "nodebox" - local node_box = { - ["type"] = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, -0.5 + height, 0.5 }, - } - if level == decomposing_leaves_layers then - drawtype = "allfaces_optional" - node_box = nil - end - - reg_leaves("leaves_decomposing_" .. level, ) -end -for level=1, decomposing_leaves_layers do - reg_decomposing(level) -end - -minetest.register_alias(modname .. ":leaves_decomposing", modname .. ":leaves_decomposing_" .. decomposing_leaves_layers) -]]-- - blockgame.register_leveled_node("leaves_decomposing", blockgame.underride({ description = "Decomposing Leaves", level_max = decomposing_leaves_layers,