forked from VoxeLibre/VoxeLibre
Update how "on_use" is defined for potions.
This commit is contained in:
parent
48fae05040
commit
9024c8084d
|
@ -54,13 +54,19 @@ local function register_potion(def)
|
||||||
dur = 45
|
dur = 45
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_use = function (itemstack, user, pointed_thing)
|
local on_use = nil
|
||||||
if not def.on_use then return end
|
|
||||||
|
if def.on_use then
|
||||||
|
|
||||||
|
on_use = function (itemstack, user, pointed_thing)
|
||||||
|
|
||||||
def.on_use(user, def.effect, dur)
|
def.on_use(user, def.effect, dur)
|
||||||
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
|
||||||
mcl_potions._use_potion(itemstack, user, def.color)
|
mcl_potions._use_potion(itemstack, user, def.color)
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function get_tt(tt, effect, dur)
|
local function get_tt(tt, effect, dur)
|
||||||
local _tt
|
local _tt
|
||||||
|
|
Loading…
Reference in New Issue