0
0
Fork 0

Correct crash from on_use = nil

This commit is contained in:
Brandon 2020-07-22 17:57:02 -04:00
parent 8ac54febba
commit dc3a991705
1 changed files with 2 additions and 1 deletions

View File

@ -54,6 +54,7 @@ local function register_potion(def)
end end
local on_use = function (itemstack, user, pointed_thing) local on_use = function (itemstack, user, pointed_thing)
if not def.on_use then return end
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)
@ -145,7 +146,7 @@ local function register_potion(def)
potion_fun = get_arrow_fun(def.effect, dur/8.), potion_fun = get_arrow_fun(def.effect, dur/8.),
} }
if def.color and def.name ~= "dragon_breath" then if def.color and def.name ~= "dragon_breath" then -- dont' splash dragon's breath...
mcl_potions.register_splash(def.name, S("Splash "..def.description), def.color, splash_def) mcl_potions.register_splash(def.name, S("Splash "..def.description), def.color, splash_def)
mcl_potions.register_lingering(def.name, S("Lingering "..def.description), def.color, ling_def) mcl_potions.register_lingering(def.name, S("Lingering "..def.description), def.color, ling_def)
mcl_potions.register_arrow(def.name, S(def.description.." Arrow"), def.color, arrow_def) mcl_potions.register_arrow(def.name, S(def.description.." Arrow"), def.color, arrow_def)