init.lua 5.4 KB

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