[Mod] Fireworks [fireworks]
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
[Mod] Fireworks [fireworks]
The idea came from here: http://minetest.net/forum/viewtopic.php ... 489#p48489
Fireworks are cool right? Well I'm adding them to minetest. Here, have a screenshot:
[img=Fireworks]https://dl.dropbox.com/u/82668184/screenshot_3631640.png[/img]
What this mod does is when the fireworks are punched, the fire part appears in the sky and disappears in a few seconds.
Crafting w = wood and t = torch r = red fireworks b = blue y = yellow
Red Fireworks
www
wtw
www
Blue Fireworks
r
Yellow Fireworks
b
The rest are shapeless (can be crafted in any order.)
Orange Fireworks
r y
Green Fireworks
b y
Purple Fireworks
r b
Rainbow Fireworks
Just craft all of the colors together for 5 rainbow fireworks!
Download v0.3 (latest)
Download v0.2
Download v0.1
Changelog:
v0.1 Initial release
v0.2 Fireworks look more realistic, added blue.
v0.3 Fireworks now spawn in random locations in the sky, added orange, yellow, green, purple, and rainbow.
License: WTFPL
Depends: default
Fireworks are cool right? Well I'm adding them to minetest. Here, have a screenshot:
[img=Fireworks]https://dl.dropbox.com/u/82668184/screenshot_3631640.png[/img]
What this mod does is when the fireworks are punched, the fire part appears in the sky and disappears in a few seconds.
Crafting w = wood and t = torch r = red fireworks b = blue y = yellow
Red Fireworks
www
wtw
www
Blue Fireworks
r
Yellow Fireworks
b
The rest are shapeless (can be crafted in any order.)
Orange Fireworks
r y
Green Fireworks
b y
Purple Fireworks
r b
Rainbow Fireworks
Just craft all of the colors together for 5 rainbow fireworks!
Download v0.3 (latest)
Download v0.2
Download v0.1
Changelog:
v0.1 Initial release
v0.2 Fireworks look more realistic, added blue.
v0.3 Fireworks now spawn in random locations in the sky, added orange, yellow, green, purple, and rainbow.
License: WTFPL
Depends: default
Last edited by InfinityProject on Sun Nov 04, 2012 15:21, edited 1 time in total.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
You'd probably have to just copy some code from particles into your mod. I dont think its worth depending on particles.
Have a look here:
https://github.com/cornernote/minetest- ... s/init.lua
Change this:
To this:
You'll have to do a bit more than that inside the function, but once that is working, you can call fireworks.explode() to make your fireworks particles.
You may also find it useful to see older versions of particles mod, it was less complex to understand in earlier versions:
initial version: https://github.com/cornernote/minetest- ... 81d1ae689a
version before pilzadam's overhaul: https://github.com/cornernote/minetest- ... 2a907c2001
Have a look here:
https://github.com/cornernote/minetest- ... s/init.lua
Change this:
Code: Select all
minetest.register_on_dignode(function(pos, oldnode, digger)
Code: Select all
fireworks.explode(function()
You may also find it useful to see older versions of particles mod, it was less complex to understand in earlier versions:
initial version: https://github.com/cornernote/minetest- ... 81d1ae689a
version before pilzadam's overhaul: https://github.com/cornernote/minetest- ... 2a907c2001
would be nicer more round :-)
though is each particle it's own entity? might lag :-/
Code: Select all
for x=-radius,radius do
for y=-radius,radius do
for z=-radius,radius do
if x*x+y*y+z*z <= radius*radius then
add_particle({x=pos.x+x,y=pos.y+y,z=pos.z+z}) end
end
end
end
Last edited by mauvebic on Tue Oct 23, 2012 03:38, edited 1 time in total.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
this is the relevant bit you need:
thats it. just check the nodename and the radius you want and you should be good 2 go :-) the codes already wtfpl
Code: Select all
local radius = 6 -- feel free to change this
for x=-radius,radius do
for y=-radius,radius do
for z=-radius,radius do
if x*x+y*y+z*z <= radius*radius then
minetest.env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z},{name='fireworks:node'}) end
end
end
end
Last edited by mauvebic on Wed Oct 24, 2012 02:15, edited 1 time in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
V0.2 Coming soon
[img=fireworks2]https://dl.dropbox.com/u/82668184/screenshot_85123323.png[/img]
Edit: 800th post!
[img=fireworks2]https://dl.dropbox.com/u/82668184/screenshot_85123323.png[/img]
Edit: 800th post!
Last edited by InfinityProject on Wed Oct 24, 2012 23:48, edited 1 time in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
Thanks. I changed the node's drawtype to plantlike. It's actually amazing how good it looks. I want Corenernote's particles to kind of fall to the ground when the node disappears. Also I'm adding sound and blue fireworks.
Last edited by InfinityProject on Thu Oct 25, 2012 01:30, edited 1 time in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
Nodes,
Code: Select all
function fireworks_activate (pos, node)
if
node.name == "fireworks:firework_red"
then
local radius = 4
for x=-radius,radius do
for y=-radius,radius do
for z=-radius,radius do
if x*x+y*y+z*z <= radius*radius then
minetest.env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z},{name='fireworks:red'}) end
end
end
end
minetest.sound_play("fireworks.ogg",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
elseif
node.name == "fireworks:firework_blue"
then
local radius = 4
for x=-radius,radius do
for y=-radius,radius do
for z=-radius,radius do
if x*x+y*y+z*z <= radius*radius then
minetest.env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z},{name='fireworks:blue'}) end
end
end
end
minetest.sound_play("fireworks.ogg",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
end
end
minetest.register_on_punchnode(fireworks_activate)
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Suggestion for the light issue: Register entities for the sparks so they can move, but also register a single "light node" with light level set to maximum, and place a whole bunch of them in a more or less spherical formation. Give that node fully transparent (e.g. empty) textures so that it isn't actually visible. Then delete them randomly as the sparks dissipate.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
You can remove the nodes by generating a sphere of air from the same pos with the same radius, from your fireworks function using minetest.after(10,function() <--code--> end) Otherwise you could register them as falling nodes?
Please avoid entities, you'll inhibit your players ability to fire multiple fireworks at once, generating a sphere of nodes is consuming enough for most CPUs. Besides, it already looks quite nice :-)
Please avoid entities, you'll inhibit your players ability to fire multiple fireworks at once, generating a sphere of nodes is consuming enough for most CPUs. Besides, it already looks quite nice :-)
Last edited by mauvebic on Fri Oct 26, 2012 03:44, edited 1 time in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
- Neuromancer
- Member
- Posts: 958
- Joined: Tue Jun 12, 2012 22:28
- GitHub: Neuromancer56
This is a really cool mod.
I created some sound effects for you, and made it so they blow up in the air in random locations.
-You need to hit R to enable full viewing range to see them.
-place a bunch of red and a blue & red fireworks on the ground near enough so you can click them
-left click them in rapid succession and look up.
http://ompldr.org/vZzI2Zg
Tried this hooked up to my stereo system with some serious bass. The sounds got waaay better.
Note: I found a bug where if you left clicked on any node it would activate the firework. This has been fixed in the download above.
Does anyone have an idea on how to make the fireworks disappear faster? And/or to make them give off bright flashes of light or just more light?
I created some sound effects for you, and made it so they blow up in the air in random locations.
-You need to hit R to enable full viewing range to see them.
-place a bunch of red and a blue & red fireworks on the ground near enough so you can click them
-left click them in rapid succession and look up.
http://ompldr.org/vZzI2Zg
Tried this hooked up to my stereo system with some serious bass. The sounds got waaay better.
Note: I found a bug where if you left clicked on any node it would activate the firework. This has been fixed in the download above.
Does anyone have an idea on how to make the fireworks disappear faster? And/or to make them give off bright flashes of light or just more light?
Last edited by Neuromancer on Mon Oct 29, 2012 00:26, edited 1 time in total.
Mods:Immersive Sounds
Phonics
Eden Game Natural Beauty Textures
Try out dropbox and get me free space: https://db.tt/JjjTr7fl
Phonics
Eden Game Natural Beauty Textures
Try out dropbox and get me free space: https://db.tt/JjjTr7fl
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
Who is online
Users browsing this forum: No registered users and 16 guests