7 local function fireworks_pop(pos)
8 for _,color in pairs(colors) do
9 minetest.add_particlespawner({
14 minvel = vector.new(-16,-16,-16),
15 maxvel = vector.new(16,16,16),
16 minacc = {x=0, y=0, z=0},
17 maxacc = {x=0, y=0, z=0},
22 collisiondetection = false,
23 collision_removal = false,
25 texture = "smoke.png^[colorize:"..color..":255",
29 minetest.sound_play("fireworks_pop",{pos=pos,pitch=math.random(80,100)/100,gain=6.0,max_hear_distance = 128})
33 minetest.register_entity("fireworks:rocket", {
34 initial_properties = {
37 collide_with_objects = false,
38 collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
40 visual_size = {x = 1, y = 1},
41 textures = {"fireworks.png"},
48 on_activate = function(self, staticdata, dtime_s)
49 self.object:set_acceleration(vector.new(0,50,0))
50 minetest.add_particlespawner({
55 minvel = vector.new(0,-20,0),
56 maxvel = vector.new(0,-20,0),
57 minacc = {x=0, y=0, z=0},
58 maxacc = {x=0, y=0, z=0},
63 collisiondetection = false,
64 collision_removal = false,
66 attached = self.object,
67 texture = "smoke.png",
69 minetest.sound_play("fireworks_launch",{object=self.object,pitch=math.random(80,100)/100})
73 on_step = function(self, dtime)
74 self.timer = self.timer + dtime
75 if self.timer >= 1 then
76 fireworks_pop(self.object:get_pos())
83 minetest.register_craftitem("fireworks:rocket", {
84 description = "Fireworks",
85 inventory_image = "fireworks.png",
86 wield_image = "fireworks.png",
87 on_place = function(itemstack, placer, pointed_thing)
88 if not pointed_thing.type == "node" then
92 minetest.add_entity(pointed_thing.above, "fireworks:rocket")
100 minetest.register_craft({
102 output = "fireworks:rocket",
103 recipe = {"main:paper","mob:gunpowder"},