mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Smoother lingering potion particles in 1st second
This commit is contained in:
parent
82c3142913
commit
3a57a5800b
@ -16,6 +16,25 @@ local function add_lingering_effect(pos, color, def, is_water, instant)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function linger_particles(pos, d, texture, color)
|
||||||
|
minetest.add_particlespawner({
|
||||||
|
amount = 10 * d^2,
|
||||||
|
time = 1,
|
||||||
|
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
||||||
|
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
|
||||||
|
minvel = {x=-0.5, y=0, z=-0.5},
|
||||||
|
maxvel = {x=0.5, y=0.5, z=0.5},
|
||||||
|
minacc = {x=-0.2, y=0, z=-0.2},
|
||||||
|
maxacc = {x=0.2, y=.05, z=0.2},
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 2,
|
||||||
|
minsize = 2,
|
||||||
|
maxsize = 4,
|
||||||
|
collisiondetection = true,
|
||||||
|
vertical = false,
|
||||||
|
texture = texture.."^[colorize:"..color..":127",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
local lingering_timer = 0
|
local lingering_timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
@ -35,23 +54,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
else
|
else
|
||||||
texture = "mcl_particles_effect.png"
|
texture = "mcl_particles_effect.png"
|
||||||
end
|
end
|
||||||
minetest.add_particlespawner({
|
linger_particles(pos, d, texture, vals.color)
|
||||||
amount = 10 * d^2,
|
|
||||||
time = 1,
|
|
||||||
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
|
||||||
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
|
|
||||||
minvel = {x=-0.5, y=0, z=-0.5},
|
|
||||||
maxvel = {x=0.5, y=0.5, z=0.5},
|
|
||||||
minacc = {x=-0.2, y=0, z=-0.2},
|
|
||||||
maxacc = {x=0.2, y=.05, z=0.2},
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 2,
|
|
||||||
minsize = 2,
|
|
||||||
maxsize = 4,
|
|
||||||
collisiondetection = true,
|
|
||||||
vertical = false,
|
|
||||||
texture = texture.."^[colorize:"..vals.color..":127",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Extinguish fire if water bottle
|
-- Extinguish fire if water bottle
|
||||||
if vals.is_water then
|
if vals.is_water then
|
||||||
@ -141,37 +144,17 @@ minetest.register_entity(id.."_flying",{
|
|||||||
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
||||||
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
||||||
add_lingering_effect(pos, color, def, name == "water")
|
add_lingering_effect(pos, color, def, name == "water")
|
||||||
local texture, minacc, maxacc
|
local texture
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
texture = "mcl_particles_droplet_bottle.png"
|
texture = "mcl_particles_droplet_bottle.png"
|
||||||
minacc = {x=-0.2, y=-0.05, z=-0.2}
|
|
||||||
maxacc = {x=0.2, y=0.05, z=0.2}
|
|
||||||
else
|
else
|
||||||
if def.instant then
|
if def.instant then
|
||||||
texture = "mcl_particles_instant_effect.png"
|
texture = "mcl_particles_instant_effect.png"
|
||||||
else
|
else
|
||||||
texture = "mcl_particles_effect.png"
|
texture = "mcl_particles_effect.png"
|
||||||
end
|
end
|
||||||
minacc = {x=-0.2, y=0, z=-0.2}
|
|
||||||
maxacc = {x=0.2, y=.05, z=0.2}
|
|
||||||
end
|
end
|
||||||
minetest.add_particlespawner({
|
linger_particles(pos, d, texture, color)
|
||||||
amount = 40,
|
|
||||||
time = 1,
|
|
||||||
minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
|
|
||||||
maxpos = {x=pos.x+d, y=pos.y+1, z=pos.z+d},
|
|
||||||
minvel = {x=-0.5, y=0, z=-0.5},
|
|
||||||
maxvel = {x=0.5, y=0.5, z=0.5},
|
|
||||||
minacc = minacc,
|
|
||||||
maxacc = maxacc,
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 2,
|
|
||||||
minsize = 1,
|
|
||||||
maxsize = 2,
|
|
||||||
collisiondetection = true,
|
|
||||||
vertical = false,
|
|
||||||
texture = texture.."^[colorize:"..color..":127",
|
|
||||||
})
|
|
||||||
if name == "water" then
|
if name == "water" then
|
||||||
mcl_potions._extinguish_nearby_fire(pos, d)
|
mcl_potions._extinguish_nearby_fire(pos, d)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user