[Solved] Spawn particles on place of any node

Post Reply
User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

[Solved] Spawn particles on place of any node

by texmex » Post

How do I add a particle spawner to appear when placing nodes? I want it to be the same for all nodes.

Also, where are the current dig particle spawner located in code? I can't find it.
Last edited by texmex on Thu Jul 26, 2018 18:18, edited 1 time in total.

User avatar
AspireMint
Member
Posts: 415
Joined: Mon Jul 09, 2012 12:59
GitHub: AspireMint
IRC: AspireMint
In-game: AspireMint
Location: Stuck at spawn

Re: Spawn particles on place of any node

by AspireMint » Post

old thread, but for anyone who still dont know:

Code: Select all

minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
    minetest.add_particlespawner({
        ...
    })
end)
example:

Code: Select all

minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
    minetest.add_particlespawner({
        amount = 20,
        time = 1,
        minpos = pos,
        maxpos = pos,
        minvel = {x=1, y=0.5, z=-1},
        maxvel = {x=-1, y=5, z=1},
        minacc = {x=1, y=1, z=-1},
        maxacc = {x=-1, y=5, z=1},
        minexptime = 0.5,
        maxexptime = 1,
        minsize = 1,
        maxsize = 10,
        collisiondetection = false,
        vertical = false,
        texture = "image.png",
        playername = placer:get_player_name() -- only show to placer
    })
end)
https://dev.minetest.net/minetest.register_on_placenode
https://dev.minetest.net/minetest.add_particlespawner

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Spawn particles on place of any node

by texmex » Post

Ah, of course! Thank you, AspireMint.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests