javelin.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. minetest.register_craftitem("rangedweapons:thrown_javelin", {
  2. wield_scale = {x=2.0,y=2.0,z=1.0},
  3. inventory_image = "rangedweapons_thrown_javelin.png",
  4. })
  5. minetest.register_tool("rangedweapons:javelin", {
  6. description = "" ..core.colorize("#35cdff","Javelin\n") ..core.colorize("#FFFFFF", "Melee damage: 8\n") ..core.colorize("#FFFFFF", "Melee range: 4.5\n")..core.colorize("#FFFFFF", "Full punch interval: 1.25\n") ..core.colorize("#FFFFFF", "Ranged damage: 9\n") ..core.colorize("#FFFFFF", "Accuracy: 92%\n") ..core.colorize("#FFFFFF", "knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 11%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.5x\n") ..core.colorize("#FFFFFF", "Projectile gravity: 6\n") ..core.colorize("#FFFFFF", "Projectile velocity: 35\n") ..core.colorize("#FFFFFF", "Enemy penetration: 50%\n") ..core.colorize("#ffc000", "Right-click to throw, Left-click to stab\n")..core.colorize("#ffc000", "Throwing wears the javelin out 5x faster than stabbing.") ,
  7. wield_scale = {x=2.0,y=2.0,z=1.0},
  8. range = 4.5,
  9. inventory_image = "rangedweapons_javelin.png",
  10. tool_capabilities = {
  11. full_punch_interval = 1.25,
  12. max_drop_level = 0,
  13. groupcaps = {
  14. stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=66.6, maxlevel=2},
  15. },
  16. damage_groups = {fleshy=8,knockback=10},
  17. },
  18. RW_throw_capabilities = {
  19. throw_damage = {fleshy=9,knockback=10},
  20. throw_crit = 11,
  21. throw_critEffc = 2.5,
  22. throw_skill = {"throw_skill",20},
  23. throw_velocity = 40,
  24. throw_accuracy = 92,
  25. throw_cooldown = 0.0,
  26. throw_projectiles = 1,
  27. throw_gravity = 6,
  28. throw_sound = "rangedweapons_throw",
  29. throw_dps = 0,
  30. throw_mob_penetration = 50,
  31. throw_node_penetration = 0,
  32. throw_entity = "rangedweapons:shot_bullet",
  33. throw_visual = "wielditem",
  34. throw_texture = "rangedweapons:thrown_javelin",
  35. throw_projectile_size = 0.15,
  36. throw_glass_breaking = 1,
  37. has_sparks = 1,
  38. ignites_explosives = 0,
  39. throw_door_breaking = 0,
  40. OnCollision = function(player,bullet,target)
  41. local throwDur = 40
  42. if bullet.wear+(65535/throwDur) < 65535 then
  43. javStack = {name="rangedweapons:javelin",wear=(bullet.wear)+(65535/throwDur)}
  44. minetest.add_item(bullet.object:get_pos(),javStack) end end,
  45. },
  46. on_secondary_use = function(itemstack, user, pointed_thing)
  47. rangedweapons_yeet(itemstack, user)
  48. return itemstack
  49. end,
  50. })