From 10f2dcb53a5e2ce633cc10880ebc093156172d02 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 12 Jul 2020 12:32:54 -0400 Subject: [PATCH] Correct splash potions with no executable function --- mods/ITEMS/mcl_potions/potions.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index fc033fbb..efb924d5 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -51,17 +51,21 @@ local function register_potion(def) local function get_splash_fun(effect, sp_dur) if def.is_dur then return function(player, redx) def.on_use(player, effect, sp_dur*redx) end - else + elseif def.effect then return function(player, redx) def.on_use(player, effect*redx, sp_dur) end end + -- covers case of no effect (water, awkward, mundane) + return function() end end local function get_lingering_fun(effect, sp_dur) if def.is_dur then - return function(player, redx) def.on_use(player, effect, sp_dur) end - else - return function(player, redx) def.on_use(player, effect*0.5, sp_dur) end + return function(player) def.on_use(player, effect, sp_dur) end + elseif def.effect then + return function(player) def.on_use(player, effect*0.5, sp_dur) end end + -- covers case of no effect (water, awkward, mundane) + return function() end end minetest.register_craftitem("mcl_potions:"..def.name, {