forked from minetest/minetest_game
Dont allow the bucket to replace nodes that are not buildable to
This commit is contained in:
parent
f1a447d1fe
commit
68020d2e93
@ -40,14 +40,21 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
|||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Check if pointing to a liquid
|
-- Check if pointing to a buildable node
|
||||||
n = minetest.env:get_node(pointed_thing.under)
|
n = minetest.env:get_node(pointed_thing.under)
|
||||||
if bucket.liquids[n.name] == nil then
|
if minetest.registered_nodes[n.name].buildable_to then
|
||||||
-- Not a liquid
|
-- buildable; replace the node
|
||||||
minetest.env:add_node(pointed_thing.above, {name=source})
|
|
||||||
elseif n.name ~= source then
|
|
||||||
-- It's a liquid
|
|
||||||
minetest.env:add_node(pointed_thing.under, {name=source})
|
minetest.env:add_node(pointed_thing.under, {name=source})
|
||||||
|
else
|
||||||
|
-- not buildable to; place the liquid above
|
||||||
|
-- check if the node above can be replaced
|
||||||
|
n = minetest.env:get_node(pointed_thing.above)
|
||||||
|
if minetest.registered_nodes[n.name].buildable_to then
|
||||||
|
minetest.env:add_node(pointed_thing.above,{name=source})
|
||||||
|
else
|
||||||
|
-- do not remove the bucket with the liquid
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return {name="bucket:bucket_empty"}
|
return {name="bucket:bucket_empty"}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user