Fix leaves not dropping

Due to some renaming, leaves no longer dropped from any of the `mcl_core` trees.

This has now been fixed.
This commit is contained in:
FossFanatic 2023-02-10 18:40:35 +00:00
parent b789845f62
commit 1fb300ef18

View file

@ -46,9 +46,9 @@ end
function mcl_core.make_player_leaves(pos) function mcl_core.make_player_leaves(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "player_leaves") ~= 1 then if minetest.get_item_group(node.name, "player_leaves") ~= 1 then
local playerleafname = node.name .. "_player" local playerleafname = node.name .. "_player"
minetest.set_node(pos, {name = playerleafname}) minetest.set_node(pos, {name = playerleafname})
end end
end end
@ -208,26 +208,26 @@ local function register_leaves(subname, description, longdesc, tiles, color, par
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) }, _mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
on_construct = function(pos) on_construct = function(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.param2 == 0 then if node.param2 == 0 then
local new_node = mcl_core.get_foliage_block_type(pos) local new_node = mcl_core.get_foliage_block_type(pos)
if new_node.param2 ~= 0 then if new_node.param2 ~= 0 then
minetest.swap_node(pos, new_node) minetest.swap_node(pos, new_node)
end
end end
end end,
end,
after_place_node = function(pos) after_place_node = function(pos)
mcl_core.make_player_leaves(pos) -- Leaves placed by the player should always be player leaves. mcl_core.make_player_leaves(pos) -- Leaves placed by the player should always be player leaves.
end, end,
} }
minetest.register_node("mcl_core:" .. subname .. "_player", pl_def) minetest.register_node("mcl_core:" .. subname .. "_player", pl_def)
local l_def = table.copy(pl_def) local l_def = table.copy(pl_def)
l_def.groups.player_leaves = nil l_def.groups.player_leaves = nil
l_def.groups.not_in_creative_inventory = 1 l_def.groups.not_in_creative_inventory = 1
l_def._mcl_shears_drop = {"mcl_core:player" .. subname} l_def._mcl_shears_drop = {"mcl_core:" .. subname .. "_player"}
l_def._mcl_silk_touch_drop = {"mcl_core:player" .. subname} l_def._mcl_silk_touch_drop = {"mcl_core:" .. subname .. "_player"}
minetest.register_node("mcl_core:" .. subname, l_def) minetest.register_node("mcl_core:" .. subname, l_def)
@ -235,8 +235,8 @@ local function register_leaves(subname, description, longdesc, tiles, color, par
o_def._doc_items_create_entry = false o_def._doc_items_create_entry = false
o_def.groups.not_in_creative_inventory = 1 o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1 o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_core:player" .. subname} o_def._mcl_shears_drop = {"mcl_core:" .. subname .. "_player"}
o_def._mcl_silk_touch_drop = {"mcl_core:player" .. subname} o_def._mcl_silk_touch_drop = {"mcl_core:" .. subname .. "_player"}
minetest.register_node("mcl_core:" .. subname .. "_orphan", o_def) minetest.register_node("mcl_core:" .. subname .. "_orphan", o_def)
end end