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,20 +67,17 @@ 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 end
if mcl_bamboo.is_dirt(node_name) == false and mcl_bamboo.is_bamboo(node_name) == false then
-- dig the node. -- 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 minetest.remove_node(pos) -- if that fails, remove the node
local istack = ItemStack("mcl_bamboo:bamboo") local istack = ItemStack("mcl_bamboo:bamboo")
local sound_params = { local sound_params = {
@ -93,8 +90,6 @@ function mcl_bamboo.break_orphaned(pos)
minetest.sound_play(mcl_sounds.node_sound_wood_defaults().dug, sound_params, true) minetest.sound_play(mcl_sounds.node_sound_wood_defaults().dug, sound_params, true)
minetest.add_item(pos, istack) minetest.add_item(pos, istack)
end end
end
end
--]] --]]
function mcl_bamboo.grow_bamboo(pos, bonemeal_applied) function mcl_bamboo.grow_bamboo(pos, bonemeal_applied)