(re)add rainbow arrows

This commit is contained in:
tchncs 2019-04-13 10:34:48 +02:00
parent dd28424be7
commit cb9ec2c5a5
2 changed files with 61 additions and 0 deletions

View File

@ -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
})

View File

@ -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