From 13bb9153912517d0056f57668609db73f4dbd4f4 Mon Sep 17 00:00:00 2001 From: MT-Modder Date: Sat, 13 Feb 2016 16:19:48 -0500 Subject: [PATCH] Control whether to dig up This small change makes it so when the player is holding shift while digging cactus or papyrus it doesn't dig up. This is perfect for making windows in cactus buildings. --- mods/default/functions.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 0137d912..12cec7e0 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -200,11 +200,12 @@ minetest.register_abm({ -- 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) + if digger and not digger:get_player_control().sneak then + 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 end