1
0
Fork 0

Update init.lua to register dropper callback.

This commit is contained in:
Michieal 2023-02-08 21:09:16 -05:00
parent 14383d6c6f
commit f81d530912
1 changed files with 33 additions and 24 deletions

View File

@ -34,34 +34,43 @@ minetest.register_abm({
mcl_bamboo.grow_bamboo(pos, false) mcl_bamboo.grow_bamboo(pos, false)
end, end,
}) })
minetest.register_abm({
label = "Break Orphaned Bamboo",
nodenames = mcl_bamboo.bamboo_index,
interval = 1.5,
chance = 1,
action = function(pos, _)
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))
local node_name = node_below.name
-- short circuit checks. if minetest.get_modpath("mesecons_mvps") then
if mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then if mesecons_mvps then
return for x = 1, #mcl_bamboo.bamboo_index do
mesecon.register_mvps_dropper(mcl_bamboo.bamboo_index[x], mcl_bamboo.break_orphaned)
end end
end
else
minetest.register_abm({
label = "Break Orphaned Bamboo",
nodenames = mcl_bamboo.bamboo_index,
interval = 1.5,
chance = 1,
action = function(pos, _)
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))
local node_name = node_below.name
-- dig the node. -- short circuit checks.
minetest.remove_node(pos) -- if that fails, remove the node if mcl_bamboo.is_dirt(node_name) or mcl_bamboo.is_bamboo(node_name) or mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false then
local istack = ItemStack("mcl_bamboo:bamboo") return
local sound_params = { end
pos = pos,
gain = 1.0, -- default
max_hear_distance = 10, -- default, uses a Euclidean metric
}
minetest.remove_node(pos) -- dig the node.
minetest.sound_play(mcl_sounds.node_sound_wood_defaults().dug, sound_params, true) minetest.remove_node(pos) -- if that fails, remove the node
minetest.add_item(pos, istack) local istack = ItemStack("mcl_bamboo:bamboo")
end, local sound_params = {
}) pos = pos,
gain = 1.0, -- default
max_hear_distance = 10, -- default, uses a Euclidean metric
}
minetest.remove_node(pos)
minetest.sound_play(mcl_sounds.node_sound_wood_defaults().dug, sound_params, true)
minetest.add_item(pos, istack)
end,
})
end
-- Base Aliases. -- Base Aliases.
local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding" local SCAFFOLDING_NAME = "mcl_bamboo:scaffolding"