[Mod] Fireworks [fireworks]

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

[Mod] Fireworks [fireworks]

by InfinityProject » Tue Oct 23, 2012 01:44

The idea came from here: http://minetest.net/forum/viewtopic.php?pid=48489#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
Last edited by InfinityProject on Sun Nov 04, 2012 15:21, edited 1 time in total.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Oct 23, 2012 01:57

this is a really cool idea! Hey, any chance you could use the particles mod to make the fire parts? that would look sweet if it shot up into the air, then exploded into colours of light that then die just before they hit the ground.
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Tue Oct 23, 2012 01:58

That would look freaking awesome! Can your particles just be activated when a node is dug? Or can they be used for this purpose?
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Tue Oct 23, 2012 02:14

Intresting mod :)
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Oct 23, 2012 02:18

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-particles/blob/master/particles/init.lua

Change this:
Code: Select all
minetest.register_on_dignode(function(pos, oldnode, digger)


To this:
Code: Select all
fireworks.explode(function()


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-particles/tree/de92c558a5ba5c5b44e0ccd966dd6f81d1ae689a

version before pilzadam's overhaul: https://github.com/cornernote/minetest-particles/tree/1fb64627e698d58cff89bd1bb2d4b02a907c2001
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32
Location: Klach D'Kel Brakt, Canada

by mauvebic » Tue Oct 23, 2012 03:38

would be nicer more round :-)

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


though is each particle it's own entity? might lag :-/
Last edited by mauvebic on Tue Oct 23, 2012 03:38, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Oct 23, 2012 05:16

i think they should all start in the middle (about 100-200 of them), and explode outwards with great velocity, and gravity, then die after about 1-3 seconds.
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Wed Oct 24, 2012 00:51

Now, I am no good at all with entities so creating them would not be easy for me. Is there a way to perhaps just spawn the particles when the fireworks node is punched?

Also mauvebic I would love to use that somehow.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32
Location: Klach D'Kel Brakt, Canada

by mauvebic » Wed Oct 24, 2012 02:14

this is the relevant bit you need:

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


thats it. just check the nodename and the radius you want and you should be good 2 go :-) the codes already wtfpl
Last edited by mauvebic on Wed Oct 24, 2012 02:15, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Wed Oct 24, 2012 23:45

V0.2 Coming soon
[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.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32
Location: Klach D'Kel Brakt, Canada

by mauvebic » Thu Oct 25, 2012 00:33

Wow, that looks like the real deal :-) +1
"Fuck the hat." - Paulie Gualtieri
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Thu Oct 25, 2012 01:29

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.
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Thu Oct 25, 2012 01:42

[img=Fireworks blue]https://dl.dropbox.com/u/82668184/screenshot_92310120.png[/img]
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Thu Oct 25, 2012 02:24

that looks awesome! are you using nodes, or entities (register_node or register_entity)?

would love to see the current code so i can have a fiddle
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Thu Oct 25, 2012 02:26

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)
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Thu Oct 25, 2012 02:42

it seems...
in order to make them move, they have to be entities.
in order to make them light, they have to be nodes.

=(
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Thu Oct 25, 2012 02:46

What I want definately is for the fireworks to launch into the air and then explode. Could the node change into an entity and turn back to a node when it has hit a position? Say y+8
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Thu Oct 25, 2012 05:06

minetest.env:remove_node()
minetest.env:add_entity()

then in the onstep of the entity, after a timer expires, do the opposite.
 

User avatar
VanessaE
Moderator
 
Posts: 4058
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Thu Oct 25, 2012 15:53

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 (16-512px)
Tips (LTC): LZHSSMzqPVDT21ozmGD4xYWJtjqycy1mqq
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Fri Oct 26, 2012 02:46

Will look into that Vanessa.

Mod updated.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32
Location: Klach D'Kel Brakt, Canada

by mauvebic » Fri Oct 26, 2012 03:42

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 :-)
Last edited by mauvebic on Fri Oct 26, 2012 03:44, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Fri Oct 26, 2012 10:34

I had tried falling nodes but it didn't look very good. Why not keep the abm? It works well.
 

User avatar
Neuromancer
Member
 
Posts: 794
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Sun Oct 28, 2012 17:47

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?
Last edited by Neuromancer on Mon Oct 29, 2012 00:26, edited 1 time in total.
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Thu Nov 01, 2012 03:04

Nice neuromancer! Ill add that in next version. I'm gonna add green, yellow, purple, and rainbow. I will also attempt mesecon compatibility.
 

User avatar
Jordach
Member
 
Posts: 4436
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Nov 01, 2012 12:07

This means that mesecon clocks can be used!

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 6 guests