From 28505885f283d6fed1251ffb1e4de7d4997dc99e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 9 Dec 2019 21:06:17 +0100 Subject: [PATCH] Add on_blast handling to chorus plant --- mods/ITEMS/mcl_end/chorus_plant.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index adbd872c80..c6c2233668 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -94,7 +94,11 @@ mcl_end.detach_chorus_plant = function(start_pos, digger) -- Drop ALL the chorus nodes we found. for c=1, #chorus_nodes do no_detach[ minetest.hash_node_position(chorus_nodes[c]) ] = true - minetest.node_dig(chorus_nodes[c], { name = "mcl_end:chorus_plant" }, digger) + if digger then + minetest.node_dig(chorus_nodes[c], { name = "mcl_end:chorus_plant" }, digger) + else + minetest.remove_node(chorus_nodes[c]) + end end end end @@ -106,6 +110,10 @@ mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger) mcl_end.detach_chorus_plant(pos, digger) end +mcl_end.check_blast_chorus_plant = function(pos) + mcl_end.detach_chorus_plant(pos) +end + minetest.register_node("mcl_end:chorus_flower", { description = S("Chorus Flower"), _doc_items_longdesc = S("A chorus flower is the living part of a chorus plant. It can grow into a tall chorus plant, step by step. When it grows, it may die on old age eventually. It also dies when it is unable to grow."), @@ -190,6 +198,7 @@ minetest.register_node("mcl_end:chorus_flower", { end end, after_dig_node = mcl_end.check_detach_chorus_plant, + on_blast = mcl_end.check_blast_chorus_plant, _mcl_blast_resistance = 2, _mcl_hardness = 0.4, }) @@ -214,6 +223,7 @@ minetest.register_node("mcl_end:chorus_flower_dead", { drop = "mcl_end:chorus_flower", groups = {handy=1,axey=1, deco_block = 1, dig_by_piston = 1, destroy_by_lava_flow = 1,chorus_plant = 1}, after_dig_node = mcl_end.check_detach_chorus_plant, + on_blast = mcl_end.check_blast_chorus_plant, _mcl_blast_resistance = 2, _mcl_hardness = 0.4, }) @@ -291,6 +301,7 @@ minetest.register_node("mcl_end:chorus_plant", { end end, after_dig_node = mcl_end.check_detach_chorus_plant, + on_blast = mcl_end.check_blast_chorus_plant, _mcl_blast_resistance = 2, _mcl_hardness = 0.4, })