ant_queen.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. mobs:register_mob("nssm:ant_queen", {
  2. type = "monster",
  3. hp_max = 220,
  4. hp_min = 220,
  5. collisionbox = {-0.6, 0.00, -0.6, 0.6, 1, 0.6},
  6. visual = "mesh",
  7. mesh = "ant_queen.x",
  8. textures = {
  9. {"ant_queen.png"}
  10. },
  11. visual_size = {x = 6, y = 6},
  12. makes_footstep_sound = true,
  13. view_range = 30,
  14. fear_height = 5,
  15. walk_velocity = 1.5,
  16. run_velocity = 2,
  17. lifetimer = 300,
  18. rotate = 270,
  19. sounds = {
  20. random = "ant",
  21. attack = "ant",
  22. },
  23. damage = 4,
  24. jump = true,
  25. drops = {
  26. {name = "nssm:life_energy", chance = 1, min = 5, max = 7},
  27. {name = "nssm:ant_queen_abdomen", chance = 1, min = 1, max = 1},
  28. {name = "nssm:ant_leg", chance = 2, min = 1, max = 6},
  29. {name = "nssm:ant_mandible", chance = 3, min = 1, max = 2},
  30. },
  31. reach = 8,
  32. armor = 40,
  33. drawtype = "front",
  34. water_damage = 2,
  35. lava_damage = 7,
  36. fire_damage = 7,
  37. light_damage = 0,
  38. blood_texture = "nssm_blood_blue.png",
  39. blood_amount = 50,
  40. stepheight = 2.1,
  41. knock_back = 0,
  42. jump_height = 12,
  43. attack_type = "dogfight",
  44. animation = {
  45. speed_normal = 20,
  46. speed_run = 25,
  47. stand_start = 1,
  48. stand_end = 50,
  49. walk_start = 120,
  50. walk_end = 160,
  51. run_start = 120,
  52. run_end = 160,
  53. punch_start = 170,
  54. punch_end = 190,
  55. },
  56. custom_attack = function(self)
  57. self.ant_queen_counter = (self.ant_queen_counter or 0) + 1
  58. if self.ant_queen_counter == 4 then
  59. self.ant_queen_counter = 0
  60. local counter = 0
  61. local s = self.object:get_pos()
  62. local p = self.attack:get_pos()
  63. p.y = p.y + 1.5
  64. s.y = s.y + 1.5
  65. if mobs:line_of_sight(self, p, s) == true then
  66. -- play attack sound
  67. if self.sounds.attack then
  68. minetest.sound_play(self.sounds.attack, {
  69. object = self.object,
  70. max_hear_distance = self.sounds.distance
  71. })
  72. end
  73. local pos1 = {
  74. x = s.x + math.random(-3, 3),
  75. y = s.y - 1,
  76. z = s.z + math.random(-3, 3)
  77. }
  78. local objects = minetest.get_objects_inside_radius(s, 10)
  79. for _,obj in ipairs(objects) do
  80. if (obj:get_luaentity()
  81. and obj:get_luaentity().name == "nssm:ant_soldier") then
  82. counter = counter + 1
  83. end
  84. end
  85. if ((pos1.x~=s.x) and (pos1.z~=s.z))
  86. and (minetest.get_node(pos1).name == "air")
  87. and (counter < 4) then
  88. explosion_particles(pos1, 1)
  89. minetest.add_entity(pos1, "nssm:ant_soldier")
  90. end
  91. end
  92. end
  93. end
  94. })