Fix full bucket losing content if placed invalidly
This commit is contained in:
parent
7b4d48538a
commit
be6ef203e0
@ -30,6 +30,15 @@ for b=1, #water_buckets do
|
||||
|
||||
local inv=user:get_inventory()
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local above_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
||||
local under_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if under_nodedef.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
if itemstack:get_count() == 1 then
|
||||
itemstack:set_name("default:bucket")
|
||||
@ -43,16 +52,6 @@ for b=1, #water_buckets do
|
||||
minetest.add_item(pos, "default:bucket")
|
||||
end
|
||||
end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local above_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
||||
local under_nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
|
||||
if under_nodedef.buildable_to then
|
||||
pos=pointed_thing.under
|
||||
end
|
||||
|
||||
if not above_nodedef.walkable then
|
||||
minetest.add_node(pos, {name = bucket[4]})
|
||||
minetest.sound_play({name="default_place_node_water", gain=1.0}, {pos=pos}, true)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user