From: Casimir Date: Mon, 2 Dec 2013 18:23:29 +0000 (+0100) Subject: Dig upwards for papyrus and cactus X-Git-Tag: 0.4.10~40 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9559f695ece743e051412d39ca73e5f76f6b0151;p=oweals%2Fminetest_game.git Dig upwards for papyrus and cactus --- diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 4f5f85d4..6840c5d2 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -266,6 +266,19 @@ minetest.register_abm({ end, }) +-- +-- dig upwards +-- + +function default.dig_up(pos, node, digger) + if digger == nil then return end + local np = {x = pos.x, y = pos.y + 1, z = pos.z} + local nn = minetest.get_node(np) + if nn.name == node.name then + minetest.node_dig(np, nn, digger) + end +end + -- -- Leafdecay -- diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 9f541deb..3a7d63b7 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -349,7 +349,10 @@ minetest.register_node("default:cactus", { is_ground_content = true, groups = {snappy=1,choppy=3,flammable=2}, sounds = default.node_sound_wood_defaults(), - on_place = minetest.rotate_node + on_place = minetest.rotate_node, + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, }) minetest.register_node("default:papyrus", { @@ -367,6 +370,9 @@ minetest.register_node("default:papyrus", { }, groups = {snappy=3,flammable=2}, sounds = default.node_sound_leaves_defaults(), + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, }) minetest.register_node("default:bookshelf", {