From dc3a99170563398b77cbbf0237b33b50402c2f54 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 22 Jul 2020 17:57:02 -0400 Subject: [PATCH] Correct crash from on_use = nil --- mods/ITEMS/mcl_potions/potions.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index 4616ec9bf..d06c22760 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -54,6 +54,7 @@ local function register_potion(def) end local on_use = function (itemstack, user, pointed_thing) + if not def.on_use then return end def.on_use(user, def.effect, dur) minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) 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.), } - 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_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)