morvy.lua 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. mobs:register_mob("nssm:morvy", {
  2. type = "monster",
  3. hp_max = 39,
  4. hp_min = 21,
  5. collisionbox = {-0.3, -0.1, -0.3, 0.3, 2.3, 0.3},
  6. visual = "mesh",
  7. mesh = "morvy.x",
  8. textures = {
  9. {"morvy.png"}
  10. },
  11. visual_size = {x = 6, y = 6},
  12. makes_footstep_sound = true,
  13. view_range = 35,
  14. fear_height = 5,
  15. walk_velocity = 0.7,
  16. run_velocity = 2,
  17. rotate = 270,
  18. damage = 4,
  19. sounds = {
  20. random = "morvy",
  21. },
  22. jump = true,
  23. drops = {
  24. {name = "nssm:life_energy", chance = 1, min = 5, max = 7},
  25. {name = "nssm:envious_soul_fragment", chance = 3, min = 1, max = 1},
  26. },
  27. reach = 8,
  28. armor = 60,
  29. drawtype = "front",
  30. water_damage = 0,
  31. lava_damage = 0,
  32. light_damage = 0,
  33. fire_damage = 0,
  34. group_attack = true,
  35. attack_animals = true,
  36. knock_back = 1,
  37. blood_texture = "morparticle.png",
  38. stepheight = 1.1,
  39. attack_type = "dogfight",
  40. animation = {
  41. speed_normal = 20,
  42. speed_run = 25,
  43. stand_start = 10,
  44. stand_end = 40,
  45. walk_start = 50,
  46. walk_end = 90,
  47. run_start = 50,
  48. run_end = 90,
  49. punch_start = 100,
  50. punch_end = 130,
  51. },
  52. custom_attack = function(self)
  53. mobs:set_animation(self, "stand")
  54. self.morvy_counter = (self.morvy_counter or 0) + 1
  55. if self.morvy_counter == 4 then
  56. mobs:set_animation(self, "punch")
  57. self.morvy_counter = 0
  58. local counter = 0
  59. local s = self.object:get_pos()
  60. local p = self.attack:get_pos()
  61. p.y = p.y + 1.5
  62. s.y = s.y + 1.5
  63. if mobs:line_of_sight(self, p, s) == true then
  64. --[[play attack sound
  65. if self.sounds.attack then
  66. minetest.sound_play(self.sounds.attack, {
  67. object = self.object,
  68. max_hear_distance = self.sounds.distance
  69. })
  70. end]]
  71. local pos1 = {
  72. x = s.x + math.random(-0.5, 0.5),
  73. y = s.y + 0.2,
  74. z = s.z + math.random(-0.5, 0.5)
  75. }
  76. local objects = minetest.get_objects_inside_radius(s, 10)
  77. for _,obj in ipairs(objects) do
  78. if (obj:get_luaentity()
  79. and ((obj:get_luaentity().name == "nssm:morbat1")
  80. or (obj:get_luaentity().name == "nssm:morbat2")
  81. or (obj:get_luaentity().name == "nssm:morbat3"))) then
  82. counter = counter + 1
  83. end
  84. end
  85. if minetest.get_node(pos1).name == "air"
  86. and counter < 5 then
  87. local bat
  88. local which = math.random(1,3)
  89. if which == 1 then
  90. bat = "nssm:morbat1"
  91. elseif which == 2 then
  92. bat = "nssm:morbat2"
  93. elseif which == 3 then
  94. bat = "nssm:morbat3"
  95. end
  96. if (bat=="nssm:morbat3") then
  97. pos1.y = pos1.y + 1.5
  98. end
  99. minetest.add_entity(pos1, bat)
  100. minetest.add_particlespawner({
  101. amount = 20,
  102. time = 0.1,
  103. minpos = {x=pos1.x-0.2, y=pos1.y-0.2, z=pos1.z-0.2},
  104. maxpos = {x=pos1.x+0.2, y=pos1.y+0.2, z=pos1.z+0.2},
  105. minvel = {x=0, y=0, z=0},
  106. maxvel = {x=0.1, y=0.3, z=0.1},
  107. minacc = {x=-0.5,y=1,z=-0.5},
  108. maxacc = {x=0.5,y=1,z=0.5},
  109. minexptime = 0.1,
  110. maxexptime = 4,
  111. minsize = 2,
  112. maxsize = 6,
  113. collisiondetection = false,
  114. texture = "morparticle.png"
  115. })
  116. end
  117. end
  118. end
  119. end
  120. })
  121. --Morbats
  122. mobs:register_mob("nssm:morbat1", {
  123. type = "monster",
  124. hp_max = 15,
  125. hp_min = 13,
  126. collisionbox = {-0.1, 0.2, -0.1, 0.1, 0.4, 0.1},
  127. visual = "mesh",
  128. mesh = "morbat.x",
  129. textures = {
  130. {"morbat1.png"}
  131. },
  132. visual_size = {x = 2, y = 2},
  133. view_range = 40,
  134. walk_velocity = 0.5,
  135. run_velocity = 3,
  136. fall_speed = 0,
  137. stepheight = 3,
  138. --[[ sounds = {
  139. random = "duck",
  140. },]]
  141. damage = 4,
  142. reach = 2,
  143. jump = true,
  144. rotate = 270,
  145. drops = {
  146. {name = "nssm:life_energy", chance = 1, min = 1, max = 2},
  147. },
  148. armor = 80,
  149. drawtype = "front",
  150. water_damage = 0,
  151. lava_damage = 0,
  152. fire_damage = 0,
  153. light_damage = 0,
  154. blood_texture="morparticle.png",
  155. fly = true,
  156. attack_type = "dogfight",
  157. animation = {
  158. speed_normal = 25,
  159. speed_run = 35,
  160. stand_start = 60,
  161. stand_end = 90,
  162. walk_start = 10,
  163. walk_end = 50,
  164. run_start = 10,
  165. run_end = 50,
  166. punch_start = 100,
  167. punch_end = 115,
  168. }
  169. })
  170. mobs:register_mob("nssm:morbat2", {
  171. type = "monster",
  172. hp_max = 13,
  173. hp_min = 5,
  174. collisionbox = {-0.1, 0.2, -0.1, 0.1, 0.4, 0.1},
  175. visual = "mesh",
  176. mesh = "morbat.x",
  177. textures = {
  178. {"morbat2.png"}
  179. },
  180. visual_size = {x = 2, y = 2},
  181. view_range = 40,
  182. walk_velocity = 0.5,
  183. run_velocity = 3,
  184. fall_speed = 0,
  185. stepheight = 3,
  186. --[[ sounds = {
  187. random = "duck",
  188. },]]
  189. damage = 4,
  190. reach = 1,
  191. jump = true,
  192. rotate = 270,
  193. drops = {
  194. {name = "nssm:life_energy", chance = 1, min = 1, max = 2},
  195. },
  196. armor = 100,
  197. drawtype = "front",
  198. water_damage = 0,
  199. lava_damage = 0,
  200. fire_damage = 0,
  201. light_damage = 0,
  202. blood_texture="morparticle.png",
  203. fly = true,
  204. attack_type = "explode",
  205. explosion_radius = 3,
  206. animation = {
  207. speed_normal = 25,
  208. speed_run = 35,
  209. stand_start = 60,
  210. stand_end = 90,
  211. walk_start = 10,
  212. walk_end = 50,
  213. run_start = 10,
  214. run_end = 50,
  215. punch_start = 100,
  216. punch_end = 115,
  217. }
  218. })
  219. mobs:register_mob("nssm:morbat3", {
  220. type = "monster",
  221. hp_max = 13,
  222. hp_min = 12,
  223. collisionbox = {-0.1, 0.2, -0.1, 0.1, 0.4, 0.1},
  224. visual = "mesh",
  225. mesh = "morbat.x",
  226. textures = {
  227. {"morbat3.png"}
  228. },
  229. visual_size = {x = 2, y = 2},
  230. view_range = 40,
  231. walk_velocity = 0.5,
  232. run_velocity = 3,
  233. fall_speed = 0,
  234. stepheight = 3,
  235. --[[ sounds = {
  236. random = "duck",
  237. },]]
  238. damage = 4,
  239. reach = 1,
  240. jump = true,
  241. rotate = 270,
  242. drops = {
  243. {name = "nssm:life_energy", chance = 1, min = 1, max = 2},
  244. },
  245. armor = 100,
  246. drawtype = "front",
  247. water_damage = 0,
  248. lava_damage = 0,
  249. fire_damage = 0,
  250. light_damage = 0,
  251. blood_texture = "morparticle.png",
  252. fly = true,
  253. attack_type = "shoot",
  254. arrow = "nssm:morarrow",
  255. shoot_interval = 3,
  256. animation = {
  257. speed_normal = 25,
  258. speed_run = 35,
  259. stand_start = 60,
  260. stand_end = 90,
  261. walk_start = 10,
  262. walk_end = 50,
  263. run_start = 10,
  264. run_end = 50,
  265. punch_start = 100,
  266. punch_end = 115,
  267. }
  268. })