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
end
minetest.add_particlespawner({
local particlespawner_def = {
amount = 1,
time = 4,
size = {
min = 16,
max = 24,
},
exptime = 7.5,
pos = {
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
minpos = vector.new({ x = pos.x - 0.25, y = pos.y + 0.6, z = pos.z - 0.25 }),
maxpos = vector.new({ x = pos.x + 0.25, y = pos.y + 0.6, z = pos.z + 0.25 }),
minvel = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
maxvel = vector.new({ x = 0.1, y = 0.5, z = 0.1 }),
minacc = vector.new({ x = -0.1, y = 0.25, z = -0.1 }),
maxacc = vector.new({ x = 0.1, y = 0.5, z = 0.1 }),
minexptime = 7.5,
maxexptime = 7.5,
minsize = 16,
maxsize = 24,
texture = 'everness_smoke_cloud_particle_static.png',
}
if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
particlespawner_def = {
amount = 1,
time = 4,
size = {
min = 16,
max = 24,
},
exptime = 7.5,
pos = {
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)
end
@ -4311,36 +4331,38 @@ minetest.register_node('everness:floating_crystal', {
position = temp_pos
minetest.after(i - 1, function(v_position, v_position_prev)
minetest.add_particlespawner({
amount = 50,
time = 1,
size = {
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
if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
minetest.add_particlespawner({
amount = 50,
time = 1,
size = {
min = 0.5,
max = 1,
},
scale_tween = {
1, 0.5,
style = 'fwd',
reps = 1
}
},
radius = { min = 0.2, max = 0.4 },
attract = {
kind = 'point',
strength = 1,
origin = v_position,
},
glow = 12
})
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 = {
1, 0.5,
style = 'fwd',
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.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'
then
-- place crystal
minetest.add_particlespawner({
amount = 50,
time = 1,
size = {
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
if minetest.has_feature({ dynamic_add_media_table = true, particlespawner_tweenable = true }) then
minetest.add_particlespawner({
amount = 50,
time = 1,
size = {
min = 0.5,
max = 1,
},
scale_tween = {
1, 0.5,
style = 'fwd',
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
})
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 = {
1, 0.5,
style = 'fwd',
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.get_node_timer(pointed_thing.above):start(math.random(85, 95))