pumpking.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. mobs:register_mob("nssm:pumpking", {
  2. type = "monster",
  3. hp_max = 220,
  4. hp_min = 220,
  5. collisionbox = {-0.4, 0.00, -0.4, 0.4, 3.2, 0.4},
  6. visual = "mesh",
  7. mesh = "pumpking.x",
  8. textures = {
  9. {"pumpking.png"}
  10. },
  11. visual_size = {x = 2.5, y = 2.5},
  12. makes_footstep_sound = true,
  13. lifetimer = 500,
  14. rotate = 270,
  15. fear_height = 4,
  16. view_range = 35,
  17. walk_velocity = 2,
  18. run_velocity = 4,
  19. sounds = {
  20. random = "king",
  21. explode = "tnt_explode",
  22. },
  23. damage = 13,
  24. jump = true,
  25. drops = {
  26. {name = "nssm:life_energy", chance = 1, min = 7, max = 9},
  27. {name = "nssm:cursed_pumpkin_seed", chance = 1, min = 1, max = 1},
  28. {name = "nssm:black_powder", chance = 1, min = 9, max = 12},
  29. },
  30. armor = 40,
  31. drawtype = "front",
  32. water_damage = 2,
  33. lava_damage = 5,
  34. fire_damage = 5,
  35. light_damage = 0,
  36. blood_texture = "nssm_blood.png",
  37. blood_amount = 25,
  38. stepheight = 2.1,
  39. knock_back = 0,
  40. jump_height = 12,
  41. attack_type = "dogfight",
  42. animation = {
  43. stand_start = 165, stand_end = 210,
  44. walk_start = 220, walk_end = 260,
  45. run_start = 220, run_end = 260,
  46. punch_start = 300, punch_end = 330,
  47. speed_normal = 15, speed_run = 15,
  48. },
  49. on_die=function(self,pos)
  50. self.object:remove()
  51. minetest.after(0.2, function(pos)
  52. tnt.boom(pos, {damage_radius = 5, radius = 4, ignore_protection = false})
  53. end, pos)
  54. end,
  55. custom_attack = function(self)
  56. self.pumpking_timer = self.pumpking_timer or os.time()
  57. if (os.time() - self.pumpking_timer) > 3 then
  58. mobs:set_animation(self, "punch")
  59. self.pumpking_timer = os.time()
  60. local s = self.object:get_pos()
  61. local p = self.attack:get_pos()
  62. p.y = p.y + 1.5
  63. s.y = s.y + 1.5
  64. if minetest.line_of_sight(p, s) == true then
  65. -- play attack sound
  66. if self.sounds.attack then
  67. minetest.sound_play(self.sounds.attack, {
  68. object = self.object,
  69. max_hear_distance = self.sounds.distance
  70. })
  71. end
  72. local pos1 = {
  73. x = s.x + math.random(-1, 1),
  74. y = s.y - 1.5,
  75. z = s.z + math.random(-1, 1)
  76. }
  77. minetest.after(1, function(pos1)
  78. minetest.set_node(pos1, {name = "nssm:pumpbomb"})
  79. minetest.get_node_timer(pos1):start(2)
  80. end, pos1)
  81. end
  82. end
  83. end
  84. })