forked from VoxeLibre/VoxeLibre
Correct Splash registration of "+" variant
This commit is contained in:
parent
8f079d11be
commit
e3becf443e
|
@ -46,6 +46,14 @@ local function register_potion(def)
|
||||||
return _tt
|
return _tt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_splash_fun(effect, sp_dur)
|
||||||
|
if def.dur then
|
||||||
|
return function(player, redx) def.on_use(player, effect, sp_dur*redx) end
|
||||||
|
else
|
||||||
|
return function(player, redx) def.on_use(player, effect*redx, sp_dur) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:"..def.name, {
|
minetest.register_craftitem("mcl_potions:"..def.name, {
|
||||||
description = S(def.description),
|
description = S(def.description),
|
||||||
_tt_help = get_tt(def._tt, def.effect, dur),
|
_tt_help = get_tt(def._tt, def.effect, dur),
|
||||||
|
@ -59,23 +67,18 @@ local function register_potion(def)
|
||||||
on_secondary_use = on_use,
|
on_secondary_use = on_use,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Register Splash
|
||||||
local splash_dur = dur * mcl_potions.SPLASH_FACTOR
|
local splash_dur = dur * mcl_potions.SPLASH_FACTOR
|
||||||
|
|
||||||
local potion_fun
|
|
||||||
if def.dur then
|
|
||||||
potion_fun = function(player, redx) def.on_use(player, def.effect, splash_dur*redx) end
|
|
||||||
else
|
|
||||||
potion_fun = function(player, redx) def.on_use(player, def.effect*redx, splash_dur) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local splash_def = {
|
local splash_def = {
|
||||||
tt = get_tt(def._tt, def.effect, splash_dur),
|
tt = get_tt(def._tt, def.effect, splash_dur),
|
||||||
potion_fun = potion_fun,
|
potion_fun = get_splash_fun(def.effect, splash_dur),
|
||||||
}
|
}
|
||||||
if def.color then
|
if def.color then
|
||||||
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if def.is_II then
|
if def.is_II then
|
||||||
|
|
||||||
local desc_mod = " II"
|
local desc_mod = " II"
|
||||||
|
@ -118,21 +121,15 @@ local function register_potion(def)
|
||||||
on_secondary_use = on_use,
|
on_secondary_use = on_use,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Register Splash
|
||||||
local splash_dur_2 = dur_2 * mcl_potions.SPLASH_FACTOR
|
local splash_dur_2 = dur_2 * mcl_potions.SPLASH_FACTOR
|
||||||
|
|
||||||
local potion_fun
|
local splash_def_2 = {
|
||||||
if def.dur then
|
|
||||||
potion_fun = function(player, redx) def.on_use(player, effect_II, splash_dur_2*redx) end
|
|
||||||
else
|
|
||||||
potion_fun = function(player, redx) def.on_use(player, effect_II*redx, splash_dur_2) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local splash_def = {
|
|
||||||
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
|
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
|
||||||
potion_fun = potion_fun,
|
potion_fun = get_splash_fun(effect_II, splash_dur_2),
|
||||||
}
|
}
|
||||||
if def.color then
|
if def.color then
|
||||||
mcl_potions.register_splash(def.name.."_2", S("Splash "..def.description..desc_mod), def.color, splash_def)
|
mcl_potions.register_splash(def.name.."_2", S("Splash "..def.description..desc_mod), def.color, splash_def_2)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -164,21 +161,15 @@ local function register_potion(def)
|
||||||
on_secondary_use = on_use,
|
on_secondary_use = on_use,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Register Splash
|
||||||
local splash_dur_pl = dur_pl * mcl_potions.SPLASH_FACTOR
|
local splash_dur_pl = dur_pl * mcl_potions.SPLASH_FACTOR
|
||||||
|
|
||||||
local potion_fun
|
local splash_def_pl = {
|
||||||
if def.dur then
|
tt = get_tt(def._tt_plus, def.effect, splash_dur_pl),
|
||||||
potion_fun = function(player, redx) def.on_use(player, def.effect, splash_dur_2*redx) end
|
potion_fun = get_splash_fun(def.effect, splash_dur_pl),
|
||||||
else
|
|
||||||
potion_fun = function(player, redx) def.on_use(player, def.effect*redx, splash_dur_2) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local splash_def = {
|
|
||||||
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
|
|
||||||
potion_fun = potion_fun,
|
|
||||||
}
|
}
|
||||||
if def.color then
|
if def.color then
|
||||||
mcl_potions.register_splash(def.name.."_plus", S("Splash "..def.description.." +"), def.color, splash_def)
|
mcl_potions.register_splash(def.name.."_plus", S("Splash "..def.description.." +"), def.color, splash_def_pl)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -96,136 +96,7 @@ local splash_DUR = mcl_potions.DURATION*mcl_potions.SPLASH_FACTOR
|
||||||
local splash_DUR_2 = mcl_potions.DURATION_2*mcl_potions.SPLASH_FACTOR
|
local splash_DUR_2 = mcl_potions.DURATION_2*mcl_potions.SPLASH_FACTOR
|
||||||
local splash_DUR_pl = mcl_potions.DURATION_PLUS*mcl_potions.SPLASH_FACTOR
|
local splash_DUR_pl = mcl_potions.DURATION_PLUS*mcl_potions.SPLASH_FACTOR
|
||||||
|
|
||||||
-- register_splash("water", S("Splash Water Bottle"), "#0000FF", {
|
|
||||||
-- potion_fun = function(player, redx) end,
|
|
||||||
-- tt = S("No effect")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("river_water", S("Splash River Water Bottle"), "#0044FF", {
|
|
||||||
-- potion_fun = function(player, redx) end,
|
|
||||||
-- tt = S("No effect")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("awkward", S("Awkward Splash Potion"), "#0000FF", {
|
|
||||||
-- potion_fun = function(player, redx) end,
|
|
||||||
-- tt = S("No effect")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("mundane", S("Mundane Splash Potion"), "#0000FF", {
|
|
||||||
-- potion_fun = function(player, redx) end,
|
|
||||||
-- tt = S("No effect")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("thick", S("Thick Splash Potion"), "#0000FF", {
|
|
||||||
-- potion_fun = function(player, redx) end,
|
|
||||||
-- tt = S("No effect")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("healing", S("Healing Splash Potion"), "#AA0000", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.healing_func(player, 3*redx) end,
|
|
||||||
-- tt = S("+3 HP")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("healing_2", S("Healing Splash Potion II"), "#DD0000", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.healing_func(player, 6*redx) end,
|
|
||||||
-- tt = S("+6 HP")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("harming", S("Harming Splash Potion"), "#660099", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.healing_func(player, -6*redx) end,
|
|
||||||
-- tt = S("-4 HP")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("harming_2", S("Harming Splash Potion II"), "#330066", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.healing_func(player, -12*redx) end,
|
|
||||||
-- tt = S("-6 HP")
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("leaping", S("Leaping Splash Potion"), "#00CC33", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR*redx) end,
|
|
||||||
-- tt = S("120% | @1", time_string(splash_DUR))
|
|
||||||
--
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("leaping_2", S("Leaping Splash Potion II"), "#00EE33", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.4, splash_DUR_2*redx) end,
|
|
||||||
-- tt = S("140% | @1", time_string(splash_DUR_2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("leaping_plus", S("Leaping Splash Potion +"), "#00DD33", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = S("120% | @1", time_string(splash_DUR_pl))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("swiftness", S("Swiftness Splash Potion"), "#009999", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR*redx) end,
|
|
||||||
-- tt = S("120% | @1", time_string(splash_DUR))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("swiftness_2", S("Swiftness Splash Potion II"), "#00BBBB", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.4, splash_DUR_2*redx) end,
|
|
||||||
-- tt = S("140% | @1", time_string(splash_DUR_2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("swiftness_plus", S("Swiftness Splash Potion +"), "#00BBBB", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = S("120% | @1", time_string(splash_DUR_2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("slowness", S("Slowness Splash Potion"), "#000080", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR*mcl_potions.INV_FACTOR*redx) end,
|
|
||||||
-- tt = S("85% | @1", time_string(splash_DUR*mcl_potions.INV_FACTOR))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("slowness_2", S("Slowness Splash Potion IV"), "#000080", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.4, 20*mcl_potions.INV_FACTOR*redx) end,
|
|
||||||
-- tt = S("40% | @1", time_string(20*mcl_potions.INV_FACTOR))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("slowness_plus", S("Slowness Splash Potion +"), "#000066", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end,
|
|
||||||
-- tt = S("85% | @1", time_string(splash_DUR_pl*mcl_potions.INV_FACTOR))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("poison", S("Poison Splash Potion"), "#335544", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR^2*redx) end,
|
|
||||||
-- tt = S("-1 HP / 2.5s | @1", time_string(splash_DUR*mcl_potions.INV_FACTOR^2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("poison_2", S("Poison Splash Potion II"), "#446655", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, splash_DUR_2*mcl_potions.INV_FACTOR^2*redx) end,
|
|
||||||
-- tt = S("-1 HP / 1.2s | @1", time_string(splash_DUR_2*mcl_potions.INV_FACTOR^2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("poison_plus", S("Poison Splash Potion +"), "#557766", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR*redx) end,
|
|
||||||
-- tt = S("-1 HP / 2.5s | @1", time_string(splash_DUR_pl*mcl_potions.INV_FACTOR^2))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("regeneration", S("Regeneration Splash Potion"), "#A52BB2", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR*redx) end,
|
|
||||||
-- tt = S("+1 HP / 2.5s | @1", time_string(splash_DUR))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("regeneration_2", S("Regeneration Splash Potion II"), "#B52CC2", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, (splash_DUR_2 + 1)*redx) end,
|
|
||||||
-- tt = S("+1 HP / 1.2s | @1", time_string(splash_DUR_2 + 1))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("regeneration_plus", S("Regeneration Splash Potion +"), "#C53DD3", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = S("+1 HP / 2.5s | @1", time_string(splash_DUR_pl))
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("invisibility", S("Invisibility Splash Potion"), "#B0B0B0", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, nil, splash_DUR*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("invisibility_plus", S("Invisibility Splash Potion +"), "#A0A0A0", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, nil, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR_pl)
|
|
||||||
-- })
|
|
||||||
|
|
||||||
-- register_splash("weakness", S("Weakness Splash Potion"), "#6600AA", {
|
-- register_splash("weakness", S("Weakness Splash Potion"), "#6600AA", {
|
||||||
-- potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, splash_DUR*mcl_potions.INV_FACTOR*redx) end,
|
-- potion_fun = function(player, redx) mcl_potions.weakness_func(player, -4, splash_DUR*mcl_potions.INV_FACTOR*redx) end,
|
||||||
|
@ -256,33 +127,3 @@ local splash_DUR_pl = mcl_potions.DURATION_PLUS*mcl_potions.SPLASH_FACTOR
|
||||||
-- -- TODO: Fix tooltip
|
-- -- TODO: Fix tooltip
|
||||||
-- tt = time_string(splash_DUR_pl)
|
-- tt = time_string(splash_DUR_pl)
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
-- register_splash("water_breathing", S("Water Breathing Splash Potion"), "#0000AA", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, nil, splash_DUR*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("water_breathing_plus", S("Water Breathing Splash Potion +"), "#0000CC", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, nil, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR_pl)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("fire_resistance", S("Fire Resistance Splash Potion"), "#D0A040", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, nil, splash_DUR*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("fire_resistance_plus", S("Fire Resistance Splash Potion +"), "#E0B050", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, nil, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR_pl)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("night_vision", S("Night Vision Splash Potion"), "#1010AA", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.night_vision_func(player, nil, splash_DUR*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR)
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- register_splash("night_vision_plus", S("Night Vision Splash Potion +"), "#2020BA", {
|
|
||||||
-- potion_fun = function(player, redx) mcl_potions.night_vision_func(player, nil, splash_DUR_pl*redx) end,
|
|
||||||
-- tt = time_string(splash_DUR_pl)
|
|
||||||
-- })
|
|
||||||
|
|
Loading…
Reference in New Issue