mese_dragon.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. mobs:register_mob("nssm:mese_dragon", {
  2. type = "monster",
  3. hp_max = 666,
  4. hp_min = 666,
  5. collisionbox = {-1, 0, -1, 1, 5, 1},
  6. visual = "mesh",
  7. mesh = "mese_dragon.x",
  8. textures = {
  9. {"mese_dragon.png"}
  10. },
  11. visual_size = {x = 12, y = 12},
  12. makes_footstep_sound = true,
  13. view_range = 45,
  14. rotate = 270,
  15. fear_height = 5,
  16. walk_velocity = 2,
  17. run_velocity = 4,
  18. sounds = {
  19. shoot_attack = "mesed",
  20. attack = "mese_dragon",
  21. distance = 60,
  22. },
  23. damage = 18,
  24. jump = true,
  25. jump_height = 10,
  26. drops = {
  27. {name = "nssm:rainbow_staff", chance = 1, min = 1, max = 1},
  28. {name = "nssm:energy_globe", chance = 1, min = 99, max = 99},
  29. },
  30. armor = 30,
  31. drawtype = "front",
  32. water_damage = 0,
  33. lava_damage = 0,
  34. fire_damage = 0,
  35. light_damage = 0,
  36. on_rightclick = nil,
  37. attack_type = "dogshoot",
  38. dogshoot_switch = true,
  39. blood_texture = "mese_blood.png",
  40. blood_amount = 30,
  41. stepheight = 3.1,
  42. knock_back = 0,
  43. jump_height = 12,
  44. dogshoot_count_max = 9,
  45. arrow = "nssm:roar_of_the_dragon",
  46. reach = 5,
  47. shoot_interval = 3,
  48. shoot_offset = -1,
  49. animation = {
  50. speed_normal = 15,
  51. speed_run = 25,
  52. stand_start = 60,
  53. stand_end = 120,
  54. walk_start = 161,
  55. walk_end = 205,
  56. run_start = 206,
  57. run_end = 242,
  58. punch_start = 242,
  59. punch_end = 275,
  60. punch2_start = 330,
  61. punch2_end = 370,
  62. dattack_start = 120,
  63. dattack_end = 160,
  64. },
  65. do_custom = function(self)
  66. midas_ability(self, "default:mese_block", self.run_velocity, 2, 3)
  67. end,
  68. custom_attack = function(self)
  69. if self.timer > 1 then
  70. self.timer = 0
  71. self.attack_rip = (self.attack_rip or 0) + 1
  72. local s = self.object:get_pos()
  73. if minetest.is_protected(s, "") then
  74. return
  75. end
  76. local p = self.attack:get_pos()
  77. p.y = p.y + 1.5
  78. s.y = s.y + 1.5
  79. if minetest.line_of_sight(p, s) == true then
  80. -- play attack sound
  81. if self.sounds.attack then
  82. minetest.sound_play(self.sounds.attack, {
  83. object = self.object,
  84. max_hear_distance = self.sounds.distance
  85. })
  86. end
  87. -- punch player
  88. self.attack:punch(self.object, 1.0, {
  89. full_punch_interval = 1.0,
  90. damage_groups = {fleshy = self.damage}
  91. }, nil)
  92. end
  93. if self.attack_rip >= 8 then
  94. self.attack_rip = 0
  95. self:set_animation("punch1")
  96. for dx = -17, 17 do
  97. for dz = -17, 17 do
  98. local k = {x = s.x + dx, y = s.y + 20, z = s.z + dz}
  99. local n = minetest.get_node(k).name
  100. if n == "air" and math.random(1, 23) == 1 then
  101. minetest.set_node(k, {name="nssm:mese_meteor"})
  102. minetest.check_single_for_falling(k)
  103. end
  104. end
  105. end
  106. end
  107. end
  108. end
  109. })