1
0
Fork 0

Cleaned up the global function to match the current ABM.

This commit is contained in:
Michieal 2023-02-06 16:51:48 -05:00
parent acf2fbdaed
commit 76507025d9
1 changed files with 19 additions and 24 deletions

View File

@ -67,33 +67,28 @@ end
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap" local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
--[[ For when I learn more about the pistons... -- For when I learn more about the pistons...
function mcl_bamboo.break_orphaned(pos) function mcl_bamboo.break_orphaned(pos)
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0)) local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))
local node_name = node_below.name local node_name = node_below.name
-- prevent accidental calling on non-bamboo nodes. -- short circuit checks.
if mcl_bamboo.is_bamboo(minetest.get_node(pos).name) == false 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
return return
end
if mcl_bamboo.is_dirt(node_name) == false and mcl_bamboo.is_bamboo(node_name) == false then
-- dig the node.
if not minetest.dig_node(pos) then
-- If dig_node fails, to prevent the bamboo from hanging in the air, manually remove it.
minetest.remove_node(pos) -- if that fails, remove the node
local istack = ItemStack("mcl_bamboo:bamboo")
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
end
-- dig the node.
minetest.remove_node(pos) -- if that fails, remove the node
local istack = ItemStack("mcl_bamboo:bamboo")
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
--]] --]]