init.lua 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. local mob_drops = {
  2. {name = 'default:mese_shard', chance = 3, min = 1, max = 2},
  3. {name = 'default:steel', chance = 4, min = 1, max = 2},
  4. {name = 'default:iron_lump', chance = 2, min = 1, max = 2},
  5. {name = 'default:meselamp', chance = 3, min = 1, max = 2},
  6. {name = 'default:mese_crystal', chance = 6, min = 1, max = 1},
  7. {name = 'default:diamond', chance = 5, min = 1, max = 1},
  8. {name = 'default:diamond_block', chance = 20, min = 1, max = 1},
  9. }
  10. local viron_queen_drops = {
  11. {name = 'default:mese_shard', chance = 3, min = 1, max = 2},
  12. {name = 'default:steel', chance = 4, min = 1, max = 2},
  13. {name = 'default:iron_lump', chance = 2, min = 1, max = 2},
  14. {name = 'default:meselamp', chance = 3, min = 1, max = 6},
  15. {name = 'default:mese_crystal', chance = 3, min = 1, max = 5},
  16. {name = 'default:diamond', chance = 2, min = 1, max = 2},
  17. {name = 'default:diamond_block', chance = 2, min = 1, max = 3},
  18. }
  19. local viron_selection_box = {-0.3, -0.3, -0.3, 0.3, 1.5, 0.3}
  20. local viron_visual_size = {x = 1, y = 1}
  21. mobs:register_mob('viron:viron_mob', {
  22. type = 'monster',
  23. hp_min = 35,
  24. hp_max = 80,
  25. armor = 75,
  26. passive = false,
  27. walk_velocity = 4,
  28. stand_chance = 60,
  29. walk_chance = 10,
  30. jump = true,
  31. jump_height = 8,
  32. run_velocity = 6,
  33. stepheight = 1.6,
  34. stay_near = {
  35. nodes = {'asteroid:diamondore', 'asteroid:meseore',},
  36. },
  37. pushable = true,
  38. view_range = 15,
  39. damage = 15,
  40. knock_back = true,
  41. fear_height = 10,
  42. water_damage = 0,
  43. lava_damage = 0,
  44. light_damage = 0,
  45. suffocation = false,
  46. floats = false,
  47. follow = {
  48. 'default:diamond',
  49. 'default:mese_crystal',
  50. },
  51. reach = 2,
  52. attack_chance = 70,
  53. attack_monsters = false,
  54. attack_animals = true,
  55. attack_npcs = true,
  56. attack_players = true,
  57. group_attack = true,
  58. attack_type = 'dogfight',
  59. blood_texture = 'viron_blood.png',
  60. pathfinding = 1,
  61. makes_footstep_sound = false,
  62. sounds = {
  63. distance = 20,
  64. random = 'viron_viron_talk',
  65. war_cry = 'viron_viron_angry',
  66. attack = 'viron_viron_hit',
  67. damage = 'viron_viron_angry',
  68. death = 'viron_viron_die',
  69. jump = 'viron_viron_talk',
  70. },
  71. drops = mob_drops,
  72. visual = 'mesh',
  73. collisionbox = {-0.3, -0.5, -0.3, 0.3, 1.5, 0.3},
  74. mesh = 'viron_viron_mob.b3d',
  75. textures = {
  76. {'viron_viron_texture.png'}, {'viron_viron_texture1.png'}, {'viron_viron_texture2.png'},
  77. },
  78. glow = 10,
  79. animation = {
  80. stand_start = 40,
  81. stand_end = 85,
  82. stand_speed = 10,
  83. stand1_start = 87,
  84. stand1_end = 100,
  85. stand1_speed = 10,
  86. stand2_start = 103,
  87. stand2_end = 145,
  88. stand2_speed = 10,
  89. stand3_start = 140,
  90. stand3_end = 170,
  91. stand3_speed = 5,
  92. stand3_loop = false,
  93. walk_start = 0,
  94. walk_end = 30,
  95. walk_speed = 30,
  96. run_start = 0,
  97. run_end = 30,
  98. run_speed = 50,
  99. punch_start = 170,
  100. punch_end = 200,
  101. punch_speed = 27,
  102. },
  103. on_die = function(self, pos)
  104. local num = math.random(0, 2)
  105. for i=1,num do
  106. minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, 'viron:viron_larve')
  107. end
  108. end,
  109. })
  110. mobs:spawn({
  111. name = 'viron:viron_mob',
  112. nodes = {'asteroid:redstone', 'asteroid:stone', 'asteroid:gravel', 'asteroid:redgravel'},
  113. chance = 7,
  114. interval = 30,
  115. active_object_count = 3,
  116. min_height = 5000,
  117. max_height = 7000,
  118. })
  119. mobs:register_egg('viron:viron_mob', 'Viron', 'viron_viron_egg.png', 1)
  120. --Queen
  121. mobs:register_mob('viron:viron_queen', {
  122. type = 'monster',
  123. hp_min = 100,
  124. hp_max = 600,
  125. armor = 80,
  126. passive = false,
  127. walk_velocity = 5,
  128. stand_chance = 60,
  129. walk_chance = 10,
  130. fall_speed = -4,
  131. jump = true,
  132. jump_height = 40,
  133. run_velocity = 10,
  134. stepheight = 20,
  135. stay_near = {
  136. nodes = {'asteroid:diamondore', 'asteroid:meseore',},
  137. },
  138. pushable = true,
  139. view_range = 15,
  140. damage = 90,
  141. knock_back = true,
  142. fear_height = 20,
  143. water_damage = 0,
  144. lava_damage = 0,
  145. light_damage = 0,
  146. suffocation = false,
  147. floats = false,
  148. follow = {
  149. 'default:diamond',
  150. 'default:mese_crystal',
  151. },
  152. reach = 4,
  153. attack_chance = 70,
  154. attack_monsters = false,
  155. attack_animals = true,
  156. attack_npcs = true,
  157. attack_players = true,
  158. group_attack = true,
  159. attack_type = 'dogfight',
  160. blood_texture = 'viron_blood.png',
  161. pathfinding = 1,
  162. makes_footstep_sound = false,
  163. sounds = {
  164. distance = 25,
  165. random = 'viron_viron_talk',
  166. war_cry = 'viron_viron_angry',
  167. attack = 'viron_viron_hit',
  168. damage = 'viron_viron_angry',
  169. death = 'viron_viron_die',
  170. jump = 'viron_viron_talk',
  171. },
  172. drops = viron_queen_drops,
  173. visual = 'mesh',
  174. visual_size = {
  175. x = viron_visual_size.x * 4,
  176. y = viron_visual_size.y * 4,
  177. },
  178. collisionbox = {
  179. viron_selection_box[1] * 4,
  180. viron_selection_box[2] * 4,
  181. viron_selection_box[3] * 4,
  182. viron_selection_box[4] * 4,
  183. viron_selection_box[5] * 4,
  184. viron_selection_box[6] * 4,
  185. },
  186. selectionbox = {
  187. viron_selection_box[1] * 4,
  188. viron_selection_box[2] * 4,
  189. viron_selection_box[3] * 4,
  190. viron_selection_box[4] * 4,
  191. viron_selection_box[5] * 4,
  192. viron_selection_box[6] * 4,
  193. },
  194. mesh = 'viron_viron_mob.b3d',
  195. textures = {
  196. {'viron_viron_texture.png'}, {'viron_viron_texture1.png'}, {'viron_viron_texture2.png'},
  197. },
  198. glow = 12,
  199. animation = {
  200. stand_start = 40,
  201. stand_end = 85,
  202. stand_speed = 10,
  203. stand1_start = 87,
  204. stand1_end = 100,
  205. stand1_speed = 10,
  206. stand2_start = 103,
  207. stand2_end = 145,
  208. stand2_speed = 10,
  209. stand3_start = 140,
  210. stand3_end = 170,
  211. stand3_speed = 5,
  212. stand3_loop = false,
  213. walk_start = 0,
  214. walk_end = 30,
  215. walk_speed = 30,
  216. run_start = 0,
  217. run_end = 30,
  218. run_speed = 50,
  219. punch_start = 170,
  220. punch_end = 200,
  221. punch_speed = 27,
  222. },
  223. on_die = function(self, pos)
  224. local num = math.random(1, 5)
  225. for i=1,num do
  226. minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, 'viron:viron_mob')
  227. end
  228. end,
  229. })
  230. mobs:spawn({
  231. name = 'viron:viron_queen',
  232. nodes = {'asteroid:redstone', 'asteroid:stone', 'asteroid:gravel', 'asteroid:redgravel'},
  233. chance = 300,
  234. interval = 45,
  235. active_object_count = 2,
  236. min_height = 5000,
  237. max_height = 7000,
  238. })
  239. mobs:register_egg('viron:viron_queen', 'Viron Queen', 'viron_viron_egg.png', 1)
  240. ------------------------------Larve-----------------------------------------
  241. mobs:register_mob('viron:viron_larve', {
  242. type = 'monster',
  243. hp_min = 10,
  244. hp_max = 40,
  245. armor = 80,
  246. passive = false,
  247. walk_velocity = 2,
  248. stand_chance = 10,
  249. walk_chance = 60,
  250. jump = true,
  251. jump_height = 10,
  252. run_velocity = 5,
  253. fall_speed = -3,
  254. stepheight = 10,
  255. pushable = true,
  256. view_range = 15,
  257. damage = 15,
  258. knock_back = true,
  259. fear_height = 20,
  260. water_damage = 0,
  261. lava_damage = 0,
  262. light_damage = 0,
  263. suffocation = false,
  264. floats = false,
  265. follow = {
  266. 'default:diamond',
  267. 'default:mese_crystal',
  268. },
  269. reach = 1,
  270. attack_chance = 10,
  271. attack_monsters = false,
  272. attack_animals = true,
  273. attack_npcs = true,
  274. attack_players = false,
  275. runaway = true,
  276. group_attack = false,
  277. attack_type = 'dogfight',
  278. blood_texture = 'viron_blood.png',
  279. pathfinding = 1,
  280. makes_footstep_sound = false,
  281. sounds = {
  282. distance = 25,
  283. random = 'viron_viron_talk',
  284. war_cry = 'viron_viron_angry',
  285. attack = 'viron_viron_hit',
  286. damage = 'viron_viron_angry',
  287. death = 'viron_viron_die',
  288. jump = 'viron_viron_talk',
  289. },
  290. visual = 'mesh',
  291. visual_size = {
  292. x = viron_visual_size.x * .5,
  293. y = viron_visual_size.y * .5,
  294. },
  295. collisionbox = {
  296. viron_selection_box[1] * .5,
  297. viron_selection_box[2] * .5,
  298. viron_selection_box[3] * .5,
  299. viron_selection_box[4] * .5,
  300. viron_selection_box[5] * .5,
  301. viron_selection_box[6] * .5,
  302. },
  303. selectionbox = {
  304. viron_selection_box[1] * .5,
  305. viron_selection_box[2] * .5,
  306. viron_selection_box[3] * .5,
  307. viron_selection_box[4] * .5,
  308. viron_selection_box[5] * .5,
  309. viron_selection_box[6] * .5,
  310. },
  311. mesh = 'viron_viron_mob.b3d',
  312. textures = {
  313. {'viron_viron_texture.png'}, {'viron_viron_texture1.png'}, {'viron_viron_texture2.png'},
  314. },
  315. glow = 12,
  316. animation = {
  317. stand_start = 40,
  318. stand_end = 85,
  319. stand_speed = 10,
  320. stand1_start = 87,
  321. stand1_end = 100,
  322. stand1_speed = 10,
  323. stand2_start = 103,
  324. stand2_end = 145,
  325. stand2_speed = 10,
  326. stand3_start = 140,
  327. stand3_end = 170,
  328. stand3_speed = 5,
  329. stand3_loop = false,
  330. walk_start = 0,
  331. walk_end = 30,
  332. walk_speed = 30,
  333. run_start = 0,
  334. run_end = 30,
  335. run_speed = 50,
  336. punch_start = 170,
  337. punch_end = 200,
  338. punch_speed = 27,
  339. },
  340. do_custom = function(self,dtime)
  341. -- 20 sec timer, wait to grow the mob until it has been alive for 60 sec
  342. self.grow_timer = (self.grow_timer or 0) + dtime
  343. if self.grow_timer < 20 then
  344. return
  345. end
  346. local pos = self.object:get_pos()
  347. --if the code has gotten to here, the viron_larve has been alive for more than 60 second
  348. --so now we grow the mob by removing (killing) it and placing a viron.
  349. minetest.add_entity({x=pos.x, y=pos.y+1, z=pos.z}, 'viron:viron_mob')
  350. self.object:remove()
  351. return false
  352. end,
  353. })