Skip to content

Commit

Permalink
Merge pull request #40 from minetest-mods/master
Browse files Browse the repository at this point in the history
[pull] master from minetest-mods:master
  • Loading branch information
pull[bot] committed May 1, 2020
2 parents 0e79131 + b2a124d commit 6a71468
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions technic/tools/cans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ function technic.register_can(d)
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local pos = pointed_thing.under
local def = minetest.registered_nodes[minetest.get_node(pos).name] or {}
local node_name = minetest.get_node(pos).name
local def = minetest.registered_nodes[node_name] or {}
if def.on_rightclick and user and not user:get_player_control().sneak then
return def.on_rightclick(pos, minetest.get_node(pos), user, itemstack, pointed_thing)
end
if not def.buildable_to then
if not def.buildable_to or node_name == data.liquid_source_name then
pos = pointed_thing.above
def = minetest.registered_nodes[minetest.get_node(pos).name] or {}
if not def.buildable_to then return end
node_name = minetest.get_node(pos).name
def = minetest.registered_nodes[node_name] or {}
-- Try to place node above the pointed source, or abort.
if not def.buildable_to or node_name == data.liquid_source_name then return end
end
local charge = get_can_level(itemstack)
if charge == 0 then return end
Expand Down

0 comments on commit 6a71468

Please sign in to comment.