6 Check for particle spawner compatibility for older MT client versions

This commit is contained in:
Juraj Vajda 2023-03-06 20:59:41 +00:00
commit 716dcc337b
3 changed files with 108 additions and 84 deletions

132
nodes.lua
View File

@ -431,36 +431,56 @@ minetest.register_node('everness:sulfur_stone', {
return return
end end
minetest.add_particlespawner({ local particlespawner_def = {
amount = 1, amount = 1,
time = 4, time = 4,
size = { minpos = vector.new({ x = pos.x - 0.25, y = pos.y + 0.6, z = pos.z - 0.25 }),
min = 16, maxpos = vector.new({ x = pos.x + 0.25, y = pos.y + 0.6, z = pos.z + 0.25 }),
max = 24, minvel = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
}, maxvel = vector.new({ x = 0.1, y = 0.5, z = 0.1 }),
exptime = 7.5, minacc = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
pos = { maxacc = vector.new({ x = 0.1, y = 0.5, z = 0.1 }),
min = vector.new({ x = pos.x - 0.25, y = pos.y + 0.6, z = pos.z - 0.25 }), minexptime = 7.5,
max = vector.new({ x = pos.x + 0.25, y = pos.y + 0.6, z = pos.z + 0.25 }), maxexptime = 7.5,
}, minsize = 16,
vel = { maxsize = 24,
min = vector.new({ x = -0.1, y = 0.25, z = -0.1 }), texture = 'everness_smoke_cloud_particle_static.png',
max = vector.new({ x = 0.1, y = 0.5, z = 0.1 }) }
},
acc = { if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
min = vector.new({ x = -0.1, y = 0.25, z = -0.1 }), particlespawner_def = {
max = vector.new({ x = 0.1, y = 0.5, z = 0.1 }) amount = 1,
}, time = 4,
texture = { size = {
name = 'everness_smoke_cloud_particle_animated.png', min = 16,
animation = { max = 24,
type = 'vertical_frames', },
aspect_w = 8, exptime = 7.5,
aspect_h = 8, pos = {
length = 8 min = vector.new({ x = pos.x - 0.25, y = pos.y + 0.6, z = pos.z - 0.25 }),
max = vector.new({ x = pos.x + 0.25, y = pos.y + 0.6, z = pos.z + 0.25 }),
},
vel = {
min = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
max = vector.new({ x = 0.1, y = 0.5, z = 0.1 })
},
acc = {
min = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
max = vector.new({ x = 0.1, y = 0.5, z = 0.1 })
},
texture = {
name = 'everness_smoke_cloud_particle_animated.png',
animation = {
type = 'vertical_frames',
aspect_w = 8,
aspect_h = 8,
length = 8
}
} }
} }
}) end
minetest.add_particlespawner(particlespawner_def)
Everness:tick_sulfur_stone(pos) Everness:tick_sulfur_stone(pos)
end end
@ -4311,36 +4331,38 @@ minetest.register_node('everness:floating_crystal', {
position = temp_pos position = temp_pos
minetest.after(i - 1, function(v_position, v_position_prev) minetest.after(i - 1, function(v_position, v_position_prev)
minetest.add_particlespawner({ if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
amount = 50, minetest.add_particlespawner({
time = 1, amount = 50,
size = { time = 1,
min = 0.5, size = {
max = 1, min = 0.5,
}, max = 1,
exptime = 2,
pos = v_position_prev,
texture = {
name = 'everness_particle.png^[colorize:#FFEE83:255',
alpha_tween = {
1, 0.5,
style = 'fwd',
reps = 1
}, },
scale_tween = { exptime = 2,
1, 0.5, pos = v_position_prev,
style = 'fwd', texture = {
reps = 1 name = 'everness_particle.png^[colorize:#FFEE83:255',
} alpha_tween = {
}, 1, 0.5,
radius = { min = 0.2, max = 0.4 }, style = 'fwd',
attract = { reps = 1
kind = 'point', },
strength = 1, scale_tween = {
origin = v_position, 1, 0.5,
}, style = 'fwd',
glow = 12 reps = 1
}) }
},
radius = { min = 0.2, max = 0.4 },
attract = {
kind = 'point',
strength = 1,
origin = v_position,
},
glow = 12
})
end
minetest.after(1, function(v_position2, v_position_prev2) minetest.after(1, function(v_position2, v_position_prev2)
minetest.set_node(v_position2, { name = 'everness:floating_crystal' }) minetest.set_node(v_position2, { name = 'everness:floating_crystal' })

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

View File

@ -74,36 +74,38 @@ minetest.register_tool('everness:pick_illuminating', {
and minetest.get_node(pointed_thing.above).name == 'air' and minetest.get_node(pointed_thing.above).name == 'air'
then then
-- place crystal -- place crystal
minetest.add_particlespawner({ if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
amount = 50, minetest.add_particlespawner({
time = 1, amount = 50,
size = { time = 1,
min = 0.5, size = {
max = 1, min = 0.5,
}, max = 1,
exptime = 2,
pos = vector.new(pos_placer.x, pos_placer.y, pos_placer.z),
texture = {
name = 'everness_particle.png^[colorize:#FFEE83:255',
alpha_tween = {
1, 0.5,
style = 'fwd',
reps = 1
}, },
scale_tween = { exptime = 2,
1, 0.5, pos = vector.new(pos_placer.x, pos_placer.y, pos_placer.z),
style = 'fwd', texture = {
reps = 1 name = 'everness_particle.png^[colorize:#FFEE83:255',
} alpha_tween = {
}, 1, 0.5,
radius = { min = 0.5, max = 0.7 }, style = 'fwd',
attract = { reps = 1
kind = 'point', },
strength = 1, scale_tween = {
origin = vector.new(pointed_thing.above.x, pointed_thing.above.y, pointed_thing.above.z), 1, 0.5,
}, style = 'fwd',
glow = 12 reps = 1
}) }
},
radius = { min = 0.5, max = 0.7 },
attract = {
kind = 'point',
strength = 1,
origin = vector.new(pointed_thing.above.x, pointed_thing.above.y, pointed_thing.above.z),
},
glow = 12
})
end
minetest.set_node(pointed_thing.above, { name = 'everness:floating_crystal' }) minetest.set_node(pointed_thing.above, { name = 'everness:floating_crystal' })
minetest.get_node_timer(pointed_thing.above):start(math.random(85, 95)) minetest.get_node_timer(pointed_thing.above):start(math.random(85, 95))