mirror of
https://github.com/minetest-mods/nether.git
synced 2025-07-01 07:50:34 +02:00
Add animated particle support
Also implements an ignition failure sound.
This commit is contained in:
52
init.lua
52
init.lua
@ -40,7 +40,10 @@ dofile(nether.path .. "/mapgen.lua")
|
||||
|
||||
|
||||
-- Portals are ignited by right-clicking with a mese crystal fragment
|
||||
nether.register_portal_ignition_item("default:mese_crystal_fragment")
|
||||
nether.register_portal_ignition_item(
|
||||
"default:mese_crystal_fragment",
|
||||
{name = "nether_portal_ignition_failure", gain = 0.3}
|
||||
)
|
||||
|
||||
|
||||
-- Use the Portal API to add a portal type which goes to the Nether
|
||||
@ -111,29 +114,34 @@ The expedition parties have found no diamonds or gold, and after an experienced
|
||||
end
|
||||
end,
|
||||
|
||||
on_ignite = function(portalDef, anochorPos, orientation)
|
||||
on_ignite = function(portalDef, anchorPos, orientation)
|
||||
|
||||
local make_sparks_fly = function(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 14,
|
||||
time = 0.1,
|
||||
minpos = {x = pos.x - 0.25, y = pos.y - 0.25, z = pos.z - 0.25},
|
||||
maxpos = {x = pos.x + 0.25, y = pos.y + 0.25, z = pos.z + 0.25},
|
||||
minvel = {x = -5, y = -1, z = -5},
|
||||
maxvel = {x = 5, y = 1, z = 5},
|
||||
minacc = {x = 0, y = 0, z = 0},
|
||||
maxacc = {x = 0, y = 0, z = 0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.2,
|
||||
maxsize = 0.8,
|
||||
collisiondetection = false,
|
||||
texture = portalDef.particle_texture .. "^[colorize:#F4F:alpha",
|
||||
glow = 8
|
||||
})
|
||||
end
|
||||
-- make some sparks fly
|
||||
local p1, p2 = portalDef.shape:get_p1_and_p2_from_anchorPos(anchorPos, orientation)
|
||||
local pos = vector.divide(vector.add(p1, p2), 2)
|
||||
|
||||
local textureName = portalDef.particle_texture
|
||||
if type(textureName) == "table" then textureName = textureName.name end
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 110,
|
||||
time = 0.1,
|
||||
minpos = {x = pos.x - 0.5, y = pos.y - 1.2, z = pos.z - 0.5},
|
||||
maxpos = {x = pos.x + 0.5, y = pos.y + 1.2, z = pos.z + 0.5},
|
||||
minvel = {x = -5, y = -1, z = -5},
|
||||
maxvel = {x = 5, y = 1, z = 5},
|
||||
minacc = {x = 0, y = 0, z = 0},
|
||||
maxacc = {x = 0, y = 0, z = 0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.2 * portalDef.particle_texture_scale,
|
||||
maxsize = 0.8 * portalDef.particle_texture_scale,
|
||||
collisiondetection = false,
|
||||
texture = textureName .. "^[colorize:#F4F:alpha",
|
||||
animation = portalDef.particle_texture_animation,
|
||||
glow = 8
|
||||
})
|
||||
|
||||
portalDef.shape.apply_func_to_wormhole_nodes(anochorPos, orientation, make_sparks_fly)
|
||||
end
|
||||
|
||||
})
|
Reference in New Issue
Block a user