forked from mtcontrib/homedecor_modpack
make redefined buckets return their itemstacks properly
This commit is contained in:
parent
f0da8f3d6f
commit
e00742a93a
@ -331,21 +331,20 @@ if minetest.get_modpath("bucket") then
|
|||||||
local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
|
local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
|
||||||
minetest.override_item("bucket:bucket_empty", {
|
minetest.override_item("bucket:bucket_empty", {
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local wielditem = user:get_wielded_item()
|
|
||||||
local wieldname = itemstack:get_name()
|
local wieldname = itemstack:get_name()
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
|
|
||||||
if pointed_thing.type == "node" and minetest.get_node(pointed_thing.under).name == "homedecor:well" then
|
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
|
if inv:room_for_item("main", "bucket:bucket_water 1") then
|
||||||
wielditem:take_item()
|
itemstack:take_item()
|
||||||
user:set_wielded_item(wielditem)
|
user:set_wielded_item(itemstack)
|
||||||
inv:add_item("main", "bucket:bucket_water 1")
|
inv:add_item("main", "bucket:bucket_water 1")
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
|
minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
|
||||||
end
|
end
|
||||||
return wielditem
|
return itemstack
|
||||||
else if original_bucket_on_use then
|
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
|
else return end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user