Skip to content

Commit

Permalink
Bucket: Allow liquid placed against unknown nodes instead of aborting…
Browse files Browse the repository at this point in the history
… abnormally
  • Loading branch information
t4im authored and paramat committed Jul 7, 2016
1 parent fe450b4 commit 5644ab4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions mods/bucket/init.lua
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 5644ab4

Please sign in to comment.