1
0
Fork 0

Correct Splash effect times

This commit is contained in:
Brandon 2020-06-27 08:15:01 -04:00
parent e50aa40bea
commit 0369d931a3
2 changed files with 36 additions and 31 deletions

View File

@ -1,12 +1,16 @@
local S = minetest.get_translator("mcl_potions") local S = minetest.get_translator("mcl_potions")
mcl_potions = {} mcl_potions = {}
-- duration effects of redstone are a factor of 8/3
-- duration effects of glowstone are a time factor of 1/2
-- splash potion duration effects are reduced by a factor of 3/4
mcl_potions.DURATION = 180 mcl_potions.DURATION = 180
mcl_potions.DURATION_PLUS = mcl_potions.DURATION * (8/3) mcl_potions.DURATION_PLUS = mcl_potions.DURATION * (8/3)
mcl_potions.DURATION_2 = mcl_potions.DURATION * (1/2) mcl_potions.DURATION_2 = mcl_potions.DURATION * (1/2)
mcl_potions.INV_FACTOR = 0.25 mcl_potions.INV_FACTOR = 0.50
mcl_potions.SPLASH_FACTOR = 0.75
local modpath = minetest.get_modpath("mcl_potions") local modpath = minetest.get_modpath("mcl_potions")
@ -285,10 +289,6 @@ minetest.register_craft({
}) })
-- duration effects of redstone are a factor of 8/3
-- duration effects of glowstone are a time factor of 1/2 and effect of 14/12
-- splash potion effects are reduced by a factor of 3/4
local water_table = { local water_table = {
["mcl_nether:nether_wart_item"] = "mcl_potions:awkward", ["mcl_nether:nether_wart_item"] = "mcl_potions:awkward",
["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness", ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness",

View File

@ -1,4 +1,4 @@
local splash_image = function(colorstring, opacity) splash_DUR*local splash_image = function(colorstring, opacity)
if not opacity then if not opacity then
opacity = 127 opacity = 127
end end
@ -77,6 +77,10 @@ local function register_splash(name, descr, color, def)
}) })
end end
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_pl = mcl_potions.DURATION_PLUS*mcl_potions.SPLASH_FACTOR
register_splash("water", "Splash Water", "#0000FF", { register_splash("water", "Splash Water", "#0000FF", {
potion_fun = function(player, redx) end, potion_fun = function(player, redx) end,
}) })
@ -114,101 +118,102 @@ register_splash("harming_2", "Splash Harming II", "#330066", {
}) })
register_splash("leaping", "Splash Leaping", "#00CC33", { register_splash("leaping", "Splash Leaping", "#00CC33", {
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, 135*redx) end potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR*redx) end
}) })
register_splash("leaping_2", "Splash Leaping II", "#00EE33", { register_splash("leaping_2", "Splash Leaping II", "#00EE33", {
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.4, 135*redx) end potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.4, splash_DUR_2*redx) end
}) })
register_splash("leaping_plus", "Splash Leaping +", "#00DD33", { register_splash("leaping_plus", "Splash Leaping +", "#00DD33", {
potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, 360*redx) end potion_fun = function(player, redx) mcl_potions.leaping_func(player, 1.2, splash_DUR_pl*redx) end
}) })
register_splash("swiftness", "Splash Swiftness", "#009999", { register_splash("swiftness", "Splash Swiftness", "#009999", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, 135*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR*redx) end
}) })
register_splash("swiftness_2", "Splash Swiftness II", "#00BBBB", { register_splash("swiftness_2", "Splash Swiftness II", "#00BBBB", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.4, 135*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.4, splash_DUR_2*redx) end
}) })
register_splash("swiftness_plus", "Splash Swiftness +", "#00BBBB", { register_splash("swiftness_plus", "Splash Swiftness +", "#00BBBB", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, 360*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 1.2, splash_DUR_pl*redx) end
}) })
register_splash("slowness", "Splash Slowness", "#000080", { register_splash("slowness", "Splash Slowness", "#000080", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, 68*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("slowness_2", "Splash Slowness IV", "#000080", { register_splash("slowness_2", "Splash Slowness IV", "#000080", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.4, 20*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.4, 20*mcl_potions.SPLASH_FACTOR*redx) end
}) })
register_splash("slowness_plus", "Splash Slowness +", "#000066", { register_splash("slowness_plus", "Splash Slowness +", "#000066", {
potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, 180*redx) end potion_fun = function(player, redx) mcl_potions.swiftness_func(player, 0.85, splash_DUR_pl*mcl_potions.INV_FACTOR = 0.50
*redx) end
}) })
register_splash("poison", "Splash Poison", "#335544", { register_splash("poison", "Splash Poison", "#335544", {
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 45*redx) end potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("poison_2", "Splash Poison II", "#446655", { register_splash("poison_2", "Splash Poison II", "#446655", {
potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, 21*redx) end potion_fun = function(player, redx) mcl_potions.poison_func(player, 1.2, splash_DUR_2*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("poison_plus", "Splash Poison +", "#557766", { register_splash("poison_plus", "Splash Poison +", "#557766", {
potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, 90*redx) end potion_fun = function(player, redx) mcl_potions.poison_func(player, 2.5, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("regeneration", "Splash Regeneration", "#A52BB2", { register_splash("regeneration", "Splash Regeneration", "#A52BB2", {
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 45*redx) end potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("regeneration_2", "Splash Regeneration II", "#B52CC2", { register_splash("regeneration_2", "Splash Regeneration II", "#B52CC2", {
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, 21*redx) end potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 1.2, (splash_DUR_2*mcl_potions.INV_FACTOR + 1)*redx) end
}) })
register_splash("regeneration_plus", "Splash Regeneration +", "#C53DD3", { register_splash("regeneration_plus", "Splash Regeneration +", "#C53DD3", {
potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, 90*redx) end potion_fun = function(player, redx) mcl_potions.regeneration_func(player, 2.5, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("invisibility", "Splash Invisibility", "#B0B0B0", { register_splash("invisibility", "Splash Invisibility", "#B0B0B0", {
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, 135*redx) end potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, splash_DUR*redx) end
}) })
register_splash("invisibility_plus", "Splash Invisibility +", "#A0A0A0", { register_splash("invisibility_plus", "Splash Invisibility +", "#A0A0A0", {
potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, 360*redx) end potion_fun = function(player, redx) mcl_potions.invisiblility_func(player, splash_DUR_pl*redx) end
}) })
register_splash("weakness", "Splash Weakness", "#6600AA", { register_splash("weakness", "Splash Weakness", "#6600AA", {
potion_fun = function(player, redx) mcl_potions.weakness_func(player, 1.2, 68*redx) end potion_fun = function(player, redx) mcl_potions.weakness_func(player, 1.2, splash_DUR*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("weakness_plus", "Splash Weakness +", "#7700BB", { register_splash("weakness_plus", "Splash Weakness +", "#7700BB", {
potion_fun = function(player, redx) mcl_potions.weakness_func(player, 1.4, 180*redx) end potion_fun = function(player, redx) mcl_potions.weakness_func(player, 1.4, splash_DUR_pl*mcl_potions.INV_FACTOR*redx) end
}) })
register_splash("water_breathing", "Splash Water Breathing", "#0000AA", { register_splash("water_breathing", "Splash Water Breathing", "#0000AA", {
potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, 135*redx) end potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, splash_DUR*redx) end
}) })
register_splash("water_breathing_plus", "Splash Water Breathing +", "#0000CC", { register_splash("water_breathing_plus", "Splash Water Breathing +", "#0000CC", {
potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, 360*redx) end potion_fun = function(player, redx) mcl_potions.water_breathing_func(player, splash_DUR_pl*redx) end
}) })
register_splash("water_breathing_plus", "Splash Fire Resistance", "#D0A040", { register_splash("water_breathing_plus", "Splash Fire Resistance", "#D0A040", {
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, 135*redx) end potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, splash_DUR*redx) end
}) })
register_splash("water_breathing_plus", "Splash Fire Resistance +", "#E0B050", { register_splash("water_breathing_plus", "Splash Fire Resistance +", "#E0B050", {
potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, 360*redx) end potion_fun = function(player, redx) mcl_potions.fire_resistance_func(player, splash_DUR_pl*redx) end
}) })
register_splash("night_vision", "Splash Night Vision", "#1010AA", { register_splash("night_vision", "Splash Night Vision", "#1010AA", {
potion_fun = function(player, redx) mcl_potions.night_vision_func(player, 135*redx) end potion_fun = function(player, redx) mcl_potions.night_vision_func(player, splash_DUR*redx) end
}) })
register_splash("night_vision_plus", "Splash Night Vision +", "#2020BA", { register_splash("night_vision_plus", "Splash Night Vision +", "#2020BA", {
potion_fun = function(player, redx) mcl_potions.night_vision_func(player, 360*redx) end potion_fun = function(player, redx) mcl_potions.night_vision_func(player, splash_DUR_pl*redx) end
}) })