diff --git a/items.lua b/items.lua index 0b92e2b..566d910 100644 --- a/items.lua +++ b/items.lua @@ -181,3 +181,17 @@ bows.register_arrow("arrow_toxic",{ {"group:arrow","default:papyrus"}, } }) + +bows.register_arrow("arrow_rainbow",{ + description="Rainbow arrow", + texture="bows_arrow_wood.png^bows_rainbow.png", + craft_count=8, + damage=11, +--[[ craft={ + {"group:arrow","group:arrow","group:arrow"}, + {"group:arrow","bows:rainbow","group:arrow"}, + {"group:arrow","group:arrow","group:arrow"} + },]] + on_step=bows.arrow_rainbow_step, + on_hit_object=bows.arrow_rainbow_object +}) diff --git a/items_functions.lua b/items_functions.lua index 02a4bea..1e3e913 100644 --- a/items_functions.lua +++ b/items_functions.lua @@ -42,3 +42,50 @@ bows.arrow_admin_node=function(self,pos,user,lastpos) bows.arrow_remove(self) return self end + +bows.arrow_rainbow_step=function(self,dtime,user,pos,lastpos) + minetest.add_particlespawner({ + amount = 20, + time =0.5, + minpos = pos, + maxpos =pos, + minvel = {x=-1, y=-1, z=-1}, + maxvel = {x=1, y=-0.5, z=1}, + minacc = {x=0, y=0, z=0}, + maxacc = {x=0, y=0, z=0}, + minexptime = 1.0, + maxexptime = 1.5, + minsize = 1.6, + maxsize = 0.2, + texture = "bows_rainbow.png", + }) + end + + bows.arrow_rainbow_object=function(self,target,hp,user,lastpos) + local pos=target:get_pos() + minetest.add_particle({ + pos = pos, + velocity = vector.new(), + acceleration = vector.new(), + expirationtime = 0.4, + size = 20, + collisiondetection = true, + vertical = false, + texture = "bows_rainbow.png", + }) + minetest.add_particlespawner({ + amount = 100, + time = 0.5, + minpos = vector.subtract(pos, 3), + maxpos = vector.add(pos, 3), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = 3, + maxsize = 9, + texture = "bows_rainbow.png", + }) + end \ No newline at end of file