make redefined buckets return their itemstacks properly

This commit is contained in:
Vanessa Ezekowitz 2015-05-29 21:54:25 -04:00
parent f0da8f3d6f
commit e00742a93a

View File

@ -331,21 +331,20 @@ if minetest.get_modpath("bucket") then
local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
minetest.override_item("bucket:bucket_empty", {
on_use = function(itemstack, user, pointed_thing)
local wielditem = user:get_wielded_item()
local wieldname = itemstack:get_name()
local inv = user:get_inventory()
if pointed_thing.type == "node" and minetest.get_node(pointed_thing.under).name == "homedecor:well" then
if inv:room_for_item("main", "bucket:bucket_water 1") then
wielditem:take_item()
user:set_wielded_item(wielditem)
itemstack:take_item()
user:set_wielded_item(itemstack)
inv:add_item("main", "bucket:bucket_water 1")
else
minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
end
return wielditem
return itemstack
else if original_bucket_on_use then
original_bucket_on_use(itemstack, user, pointed_thing)
return original_bucket_on_use(itemstack, user, pointed_thing)
else return end
end
end