Change particle for instant effects

This commit is contained in:
Wuzzy 2020-08-19 17:37:41 +02:00
parent 91d174b437
commit 7c0c0d4d0c
6 changed files with 27 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View File

@ -10,7 +10,7 @@ end
local lingering_effect_at = {} local lingering_effect_at = {}
local function add_lingering_effect(pos, color, def, is_water) local function add_lingering_effect(pos, color, def, is_water, instant)
lingering_effect_at[pos] = {color = color, timer = 30, def = def, is_water = is_water} lingering_effect_at[pos] = {color = color, timer = 30, def = def, is_water = is_water}
@ -30,6 +30,8 @@ minetest.register_globalstep(function(dtime)
local texture local texture
if vals.is_water then if vals.is_water then
texture = "mcl_particles_droplet_bottle.png" texture = "mcl_particles_droplet_bottle.png"
elseif vals.def.instant then
texture = "mcl_particles_instant_effect.png"
else else
texture = "mcl_particles_effect.png" texture = "mcl_particles_effect.png"
end end
@ -145,7 +147,11 @@ minetest.register_entity(id.."_flying",{
minacc = {x=-0.2, y=-0.05, z=-0.2} minacc = {x=-0.2, y=-0.05, z=-0.2}
maxacc = {x=0.2, y=0.05, z=0.2} maxacc = {x=0.2, y=0.05, z=0.2}
else else
texture = "mcl_particles_effect.png" if def.instant then
texture = "mcl_particles_instant_effect.png"
else
texture = "mcl_particles_effect.png"
end
minacc = {x=-0.2, y=0, z=-0.2} minacc = {x=-0.2, y=0, z=-0.2}
maxacc = {x=0.2, y=.05, z=0.2} maxacc = {x=0.2, y=.05, z=0.2}
end end

View File

@ -177,6 +177,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_splash_fun(def.effect, splash_dur), potion_fun = get_splash_fun(def.effect, splash_dur),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
local ling_def local ling_def
@ -186,6 +187,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_lingering_fun(def.effect*mcl_potions.LINGERING_FACTOR, ling_dur), potion_fun = get_lingering_fun(def.effect*mcl_potions.LINGERING_FACTOR, ling_dur),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
else else
ling_def = { ling_def = {
@ -193,6 +195,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_lingering_fun(def.effect, ling_dur), potion_fun = get_lingering_fun(def.effect, ling_dur),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
end end
@ -201,6 +204,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_arrow_fun(def.effect, dur/8.), potion_fun = get_arrow_fun(def.effect, dur/8.),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
if def.color and not def.no_throwable then if def.color and not def.no_throwable then
@ -270,6 +274,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_splash_fun(7, splash_dur_2), potion_fun = get_splash_fun(7, splash_dur_2),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
else else
splash_def_2 = { splash_def_2 = {
@ -277,6 +282,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_splash_fun(effect_II, splash_dur_2), potion_fun = get_splash_fun(effect_II, splash_dur_2),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
end end
@ -288,6 +294,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_lingering_fun(effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2), potion_fun = get_lingering_fun(effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
else else
ling_def_2 = { ling_def_2 = {
@ -295,6 +302,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_lingering_fun(effect_II, ling_dur_2), potion_fun = get_lingering_fun(effect_II, ling_dur_2),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
end end
@ -303,6 +311,7 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_arrow_fun(effect_II, dur_2/8.), potion_fun = get_arrow_fun(effect_II, dur_2/8.),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
if def.color and not def.no_throwable then if def.color and not def.no_throwable then
@ -346,18 +355,21 @@ local function register_potion(def)
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_splash_fun(def.effect, splash_dur_pl), potion_fun = get_splash_fun(def.effect, splash_dur_pl),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
local ling_def_pl = { local ling_def_pl = {
tt = get_tt(def._tt_plus, def.effect, ling_dur_pl), tt = get_tt(def._tt_plus, def.effect, ling_dur_pl),
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_lingering_fun(def.effect, ling_dur_pl), potion_fun = get_lingering_fun(def.effect, ling_dur_pl),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
local arrow_def_pl = { local arrow_def_pl = {
tt = get_tt(def._tt_pl, def.effect, dur_pl/8.), tt = get_tt(def._tt_pl, def.effect, dur_pl/8.),
longdesc = def._longdesc, longdesc = def._longdesc,
potion_fun = get_arrow_fun(def.effect, dur_pl/8.), potion_fun = get_arrow_fun(def.effect, dur_pl/8.),
no_effect = def.no_effect, no_effect = def.no_effect,
instant = def.instant,
} }
if def.color and not def.no_throwable then if def.color and not def.no_throwable then
mcl_potions.register_splash(def.name.."_plus", S("Splash @1 + Potion", def.description), def.color, splash_def_pl) mcl_potions.register_splash(def.name.."_plus", S("Splash @1 + Potion", def.description), def.color, splash_def_pl)
@ -449,6 +461,7 @@ local healing_def = {
_longdesc = S("Instantly heals."), _longdesc = S("Instantly heals."),
color = "#CC0000", color = "#CC0000",
effect = 4, effect = 4,
instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
is_II = true, is_II = true,
} }
@ -462,6 +475,7 @@ local harming_def = {
_longdesc = S("Instantly deals damage."), _longdesc = S("Instantly deals damage."),
color = "#660099", color = "#660099",
effect = -6, effect = -6,
instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
is_II = true, is_II = true,
is_inv = true, is_inv = true,

View File

@ -71,7 +71,11 @@ function mcl_potions.register_splash(name, descr, color, def)
texture = "mcl_particles_droplet_bottle.png" texture = "mcl_particles_droplet_bottle.png"
acc = {x=0, y=-GRAVITY, z=0} acc = {x=0, y=-GRAVITY, z=0}
else else
texture = "mcl_particles_effect.png" if def.instant then
texture = "mcl_particles_instant_effect.png"
else
texture = "mcl_particles_effect.png"
end
acc = {x=0, y=0, z=0} acc = {x=0, y=0, z=0}
end end
minetest.add_particlespawner({ minetest.add_particlespawner({