weapons.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. bweapons.register_weapon({
  2. name = "bweapons_utility_pack:torch_bow",
  3. description = "Torch Bow",
  4. texture = "bweapons_utility_pack_torch_bow.png",
  5. has_durability = true,
  6. uses = 128,
  7. ammo_type = "default:torch",
  8. tool_repair = true,
  9. liquids_stop = true,
  10. damage = 5,
  11. spread = 0.08,
  12. cooldown = 2,
  13. hit_flare = "tnt_smoke.png",
  14. hit_flare_size = 2,
  15. hit_flare_glow = false,
  16. hit_particle = "bweapons_utility_pack_torch_bow_hit_particle.png",
  17. hit_particle_glow = true,
  18. hit_particle_amount = 16,
  19. hit_particle_size = 4,
  20. hit_particle_velocity = 3,
  21. hit_particle_gravity = -10,
  22. trail_particle = "bweapons_utility_pack_torch_bow_trail.png",
  23. trail_particle_size = 4,
  24. trail_particle_displacement = 0.15,
  25. trail_particle_amount = 2,
  26. trail_particle_velocity = 1.5,
  27. trail_particle_gravity = 2,
  28. trail_particle_glow = true,
  29. fire_sound = "bweapons_bows_pack_longbow_fire",
  30. fire_sound_gain = 1,
  31. reload_sound = "bweapons_bows_pack_longbow_reload",
  32. hit_sound = "bweapons_bows_pack_arrow_hit",
  33. hit_sound_gain = 0.5,
  34. projectile_speed = 30,
  35. projectile_gravity = -7.5,
  36. projectile_dampening = 0,
  37. projectile_timeout = 35,
  38. projectile_texture = "bweapons_utility_pack_torch_entity.png",
  39. projectile_glow = true,
  40. projectile_visual_size = 1,
  41. on_hit = function (projectile, target)
  42. if target.type == "node" then
  43. local target_pos = minetest.get_pointed_thing_position(target, false)
  44. local node = minetest.get_node_or_nil(target_pos)
  45. if node and not minetest.registered_nodes[node.name].walkable then return end
  46. if minetest.is_protected(target_pos, projectile.owner:get_player_name()) then return end
  47. local air_pos = minetest.find_node_near(target_pos, 2, "air", true)
  48. if air_pos ~= nil then
  49. local delta = {x = target_pos.x - air_pos.x, y = target_pos.y - air_pos.y, z = target_pos.z - air_pos.z}
  50. local rotation = minetest.dir_to_wallmounted(delta)
  51. local nodename
  52. if rotation == 0 then
  53. nodename = "default:torch_ceiling"
  54. elseif rotation == 1 then
  55. nodename = "default:torch"
  56. else
  57. nodename = "default:torch_wall"
  58. end
  59. minetest.set_node(air_pos, {name = nodename, nil, param2 = rotation})
  60. end
  61. end
  62. end,
  63. recipe={
  64. {
  65. {'fire:flint_and_steel', 'group:wood', 'farming:string'},
  66. {'group:wood', '', 'farming:string'},
  67. {'default:steel_ingot', 'group:wood', 'farming:string'}
  68. },
  69. },
  70. })