master
runs 2020-05-13 17:33:08 +02:00
parent d05dbe7fb9
commit 703b842b23
2 changed files with 15 additions and 2 deletions

View File

@ -9,6 +9,7 @@ rcbows.register_arrow("farbows:e_arrow", {
name = "farbows:inv_arrow",
description = S("Arrow"),
inventory_image = "farbows_arrow.png",
stack_max = 64, --optional, 99 by default
}
})
```
@ -104,6 +105,8 @@ You can define some arrow effects
Replace the hit node for this one.
### trail_particle
Particle texture to create an arrow trail.
It can be a string with "texture" only, or a table for animated textures: {texture = "texture", animation = "animation"}.
### explosion
It requires "tnt" or "explosion" mods as an optional dependency.

View File

@ -226,6 +226,7 @@ function rcbows.register_arrow(name, def)
minetest.register_craftitem(def.inventory_arrow.name, {
description = def.inventory_arrow.description,
inventory_image = def.inventory_arrow.inventory_image,
stack_max = def.stack_max or 99,
})
end
@ -278,8 +279,16 @@ end
--PARTICLES EFFECTS
function rcbows.trail(old_pos, pos, trail_particle)
local texture, animation
if type(trail_particle) == 'table' then
texture = trail_particle.texture
animation = trail_particle.animation
else
texture = trail_particle
animation = ""
end
minetest.add_particlespawner({
texture = trail_particle,
texture = texture,
amount = 20,
time = 0.2,
minpos = old_pos,
@ -294,7 +303,8 @@ function rcbows.trail(old_pos, pos, trail_particle)
maxsize = 1.5,
collisiondetection = false,
vertical = false,
glow = 14
glow = 14,
animation = animation,
})
end