Fix drinking a potion never depleting it

This commit is contained in:
Wuzzy 2020-08-13 18:16:53 +02:00
parent 12ca804488
commit cef20edd53

View File

@ -62,9 +62,13 @@ function return_on_use(def, effect, dur)
end
def.on_use(user, effect, dur)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
local old_name, old_count = itemstack:get_name(), itemstack:get_count()
itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
if old_name ~= itemstack:get_name() or old_count ~= itemstack:get_count() then
mcl_potions._use_potion(itemstack, user, def.color)
end
return itemstack
end
end