init.lua 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. zombies = {
  2. skins = {}
  3. }
  4. minetest.register_craftitem('zombies:tooth', {
  5. description = 'Zombie Tooth',
  6. inventory_image = 'zombies_tooth.png',
  7. groups = {general_relic=-10}
  8. })
  9. --Skin gen
  10. local skin_base = {'zombies_skin-tan.png', 'zombies_skin-green.png', 'zombies_skin-ash.png'}
  11. local hair_base = {'zombies_hair-1.png', 'zombies_hair-2.png', 'zombies_hair-3.png', 'zombies_hair-4.png', 'zombies_blank.png'}
  12. local shirt_base = {'zombies_shirt-blue.png', 'zombies_shirt-white.png', 'zombies_shirt-rags.png', 'zombies_blank.png'}
  13. local pants_base = {'zombies_pants-blue.png', 'zombies_pants-green.png', 'zombies_pants-brown.png', 'zombies_pants-black.png', 'zombies_pants-purple.png', 'zombies_blank.png'}
  14. local face_base = {'zombies_face-1.png', 'zombies_face-2.png', 'zombies_face-3.png', 'zombies_face-4.png', 'zombies_face-5.png'}
  15. for i = 1, 16 do
  16. table.insert(zombies.skins, {skin_base[math.random(3)]..'^'..face_base[math.random(5)]..'^'..shirt_base[math.random(4)]..'^'..pants_base[math.random(4)]..'^'..hair_base[math.random(5)]})
  17. end
  18. local inventory = {
  19. {name = 'default:dirt', chance = 2, min = 3, max = 5},
  20. {name = 'default:apple', chance = 6, min = 2, max = 5},
  21. {name = 'default:clay_lump', chance = 10, min = 1, max = 4},
  22. {name = 'bonemeal:bone', chance = 3, min = 0, max = 10},
  23. {name = 'zombies:tooth', chance = 10, min = 0, max = 3},
  24. {name = 'maxhp:lifeforce1', chance = 7, min = 0, max = 4},
  25. {name = 'commoditymarket:gold_coins', chance = 50, min = 1, max = 20},
  26. {name = 'epic:float_crystal_shard', chance = 100, min = 1, max = 2},
  27. {name = 'epic:burlap_tattered', chance = 4, min = 1, max = 3},
  28. {name = 'stations:scroll_gunpowder', chance = 100, min = 0, max = 1},
  29. {name = 'stations:scroll_ash', chance = 5, min = 0, max = 1},
  30. {name = 'epic:slicer', chance = 1000, min = 0, max = 1}
  31. }
  32. local noise = {
  33. distance = 8,
  34. random = 'groan',
  35. -- random = 'eating-brains',
  36. }
  37. mobs:register_mob('zombies:1arm', {
  38. type = 'monster',
  39. passive = false,
  40. attack_type = 'dogfight',
  41. pathfinding = true,
  42. reach = 2,
  43. damage = 4,
  44. damage_max = 4,
  45. damage_chance = 75,
  46. hp_min = 3,
  47. hp_max = 30,
  48. armor = 80,
  49. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  50. visual = 'mesh',
  51. mesh = 'zombie_one-arm.b3d',
  52. textures = zombies.skins,
  53. blood_texture = 'default_wood.png',
  54. makes_footstep_sound = true,
  55. sounds = noise,
  56. walk_velocity = 2,
  57. run_velocity = 4,
  58. jump = true,
  59. view_range = 15,
  60. drops = inventory,
  61. lava_damage = 5,
  62. light_damage = 1,
  63. fall_damage = 2,
  64. animation = {
  65. speed_normal = 10,
  66. speed_run = 10,
  67. punch_speed = 20,
  68. walk_start = 0,
  69. walk_end = 20,
  70. run_start = 0,
  71. run_end = 20,
  72. punch_start = 21,
  73. punch_end = 51,
  74. },
  75. })
  76. mobs:register_mob('zombies:crawler', {
  77. type = 'monster',
  78. passive = false,
  79. attack_type = 'dogfight',
  80. pathfinding = true,
  81. reach = 2,
  82. damage = 4,
  83. damage_max = 4,
  84. damage_chance = 75,
  85. hp_min = 1,
  86. hp_max = 20,
  87. armor = 80,
  88. collisionbox = {-0.5, -.5, -0.4, 0.5, 0.2, 0.4},
  89. visual = 'mesh',
  90. mesh = 'zombie_crawler.b3d',
  91. textures = zombies.skins,
  92. blood_texture = 'default_wood.png',
  93. makes_footstep_sound = true,
  94. sounds = noise,
  95. walk_velocity = .5,
  96. run_velocity = 1,
  97. jump = true,
  98. view_range = 15,
  99. drops = inventory,
  100. lava_damage = 5,
  101. light_damage = 1,
  102. fall_damage = 2,
  103. animation = {
  104. speed_normal = 10,
  105. speed_run = 10,
  106. punch_speed = 60,
  107. walk_start = 0,
  108. walk_end = 40,
  109. run_start = 0,
  110. run_end = 40,
  111. punch_start = 41,
  112. punch_end = 71,
  113. },
  114. })
  115. mobs:register_mob('zombies:normal', {
  116. type = 'monster',
  117. passive = false,
  118. attack_type = 'dogfight',
  119. pathfinding = true,
  120. reach = 3,
  121. damage = 4,
  122. damage_max = 4,
  123. damage_chance = 75,
  124. hp_min = 1,
  125. hp_max = 40,
  126. armor = 80,
  127. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  128. visual = 'mesh',
  129. mesh = 'zombie_normal.b3d',
  130. textures = zombies.skins,
  131. blood_texture = 'default_wood.png',
  132. makes_footstep_sound = true,
  133. sounds = noise,
  134. walk_velocity = 2,
  135. run_velocity = 4,
  136. jump = true,
  137. view_range = 15,
  138. drops = inventory,
  139. lava_damage = 5,
  140. light_damage = 1,
  141. fall_damage = 2,
  142. animation = {
  143. speed_normal = 20,
  144. speed_run = 20,
  145. punch_speed = 20,
  146. stand_start = 0,
  147. stand_end = 40,
  148. walk_start = 41,
  149. walk_end = 101,
  150. run_start = 41,
  151. run_end = 101,
  152. punch_start = 102,
  153. punch_end = 142,
  154. },
  155. on_spawn = function(self)
  156. local phase = moon_phases.get_phase()
  157. if phase == 4 then
  158. self.object:set_properties({
  159. visual_size = {
  160. x = self.base_size.x * 2,
  161. y = self.base_size.y * 2
  162. },
  163. collisionbox = {
  164. self.base_colbox[1] * 2,
  165. self.base_colbox[2] * 2,
  166. self.base_colbox[3] * 2,
  167. self.base_colbox[4] * 2,
  168. self.base_colbox[5] * 2,
  169. self.base_colbox[6] * 2
  170. },
  171. })
  172. end
  173. end,
  174. on_rightclick = function(self, clicker)
  175. local item = clicker:get_wielded_item()
  176. local player = clicker:get_player_name()
  177. if item:get_name() == 'fantasy_mobs:fairy_dust' then
  178. minetest.chat_send_player(player, '[Zombie] Braaaaaiiiiiiiiiinnnnnnnssssssssssssss')
  179. self.owner = player
  180. self.order = 'stand'
  181. self.light_damage = 0
  182. item:take_item(1)
  183. clicker:set_wielded_item(item)
  184. end
  185. end,
  186. })
  187. --Spawn Functions
  188. mobs:spawn({
  189. name = 'zombies:1arm',
  190. nodes = {'defaut:dirt', 'default:cobble', 'default:gravel'},
  191. max_light = 9,
  192. min_height = -20,
  193. max_height = 150,
  194. interval = 30,
  195. chance = 500,
  196. active_object_count = 5,
  197. })
  198. mobs:spawn({
  199. name = 'zombies:crawler',
  200. nodes = {'defaut:dirt', 'default:cobble', 'default:gravel'},
  201. max_light = 9,
  202. min_height = -20,
  203. max_height = 150,
  204. interval = 30,
  205. chance = 500,
  206. active_object_count = 5,
  207. })
  208. mobs:spawn({
  209. name = 'zombies:normal',
  210. nodes = {'defaut:dirt', 'default:cobble', 'default:gravel'},
  211. max_light = 9,
  212. min_height = -20,
  213. max_height = 150,
  214. interval = 30,
  215. chance = 500,
  216. active_object_count = 5,
  217. })