Correct splash potions with no executable function

This commit is contained in:
Brandon 2020-07-12 12:32:54 -04:00
parent 4a654fccc4
commit 10f2dcb53a
1 changed files with 8 additions and 4 deletions

View File

@ -51,17 +51,21 @@ local function register_potion(def)
local function get_splash_fun(effect, sp_dur) local function get_splash_fun(effect, sp_dur)
if def.is_dur then if def.is_dur then
return function(player, redx) def.on_use(player, effect, sp_dur*redx) end 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 return function(player, redx) def.on_use(player, effect*redx, sp_dur) end
end end
-- covers case of no effect (water, awkward, mundane)
return function() end
end end
local function get_lingering_fun(effect, sp_dur) local function get_lingering_fun(effect, sp_dur)
if def.is_dur then if def.is_dur then
return function(player, redx) def.on_use(player, effect, sp_dur) end return function(player) def.on_use(player, effect, sp_dur) end
else elseif def.effect then
return function(player, redx) def.on_use(player, effect*0.5, sp_dur) end return function(player) def.on_use(player, effect*0.5, sp_dur) end
end end
-- covers case of no effect (water, awkward, mundane)
return function() end
end end
minetest.register_craftitem("mcl_potions:"..def.name, { minetest.register_craftitem("mcl_potions:"..def.name, {