From 5644ab4bd37b7bbbb7d911c95b41f6d55c428301 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 5 Jul 2016 19:36:36 +0200 Subject: [PATCH] Bucket: Allow liquid placed against unknown nodes instead of aborting abnormally --- mods/bucket/init.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index 521a446..ad5e309 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -60,16 +60,10 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name end local node = minetest.get_node_or_nil(pointed_thing.under) - if not node then - return - end - local ndef = minetest.registered_nodes[node.name] - if not ndef then - return - end + local ndef = node and minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if ndef.on_rightclick and + if ndef and ndef.on_rightclick and user and not user:get_player_control().sneak then return ndef.on_rightclick( pointed_thing.under, @@ -80,7 +74,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name local lpos -- Check if pointing to a buildable node - if ndef.buildable_to then + if ndef and ndef.buildable_to then -- buildable; replace the node lpos = pointed_thing.under else