goat.lua 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. --[[
  2. Animation Data:
  3. 1-60 Eating
  4. 61-121 Tail wiggle
  5. 122-182 Walking
  6. 246-330 Attack
  7. ]]
  8. mobs:register_mob('farm_mobs:goat_she', {
  9. type = 'animal',
  10. passive = true,
  11. attack_type = 'dogfight',
  12. damage = 8,
  13. hp_min = 5, hp_max = 15, armor = 200,
  14. collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.75, 0.3},
  15. visual = 'mesh',
  16. mesh = 'farm_mobs_she_goat.b3d',
  17. textures = {
  18. {'farm_mobs_goat_brown.png'},
  19. {'farm_mobs_goat_grey.png'},
  20. },
  21. blood_texture = 'mobs_blood.png',
  22. visual_size = {x=2,y=2},
  23. makes_footstep_sound = true,
  24. sounds = {
  25. random = 'mobs_sheep',
  26. },
  27. walk_velocity = 1,
  28. run_velocity = 2,
  29. jump = true,
  30. stepheight = 1.1,
  31. drops = {
  32. {name = 'mobs:meat_raw', chance = 1, min = 1, max = 4},
  33. {name = 'mobs:leather', chance = 2, min = 1, max = 2},
  34. {name = 'bonemeal:bone', chance = 2, min = 1, max = 5},
  35. },
  36. water_damage = 0,
  37. lava_damage = 5,
  38. light_damage = 0,
  39. animation = {
  40. speed_normal = 30, speed_run = 45,
  41. stand_start = 1, stand_end = 60, -- head down/up
  42. walk_start = 122, walk_end = 182, -- walk
  43. run_start = 122, run_end = 182, -- walk
  44. punch_start = 246, punch_end = 330, -- attack
  45. },
  46. follow = 'farming:wheat',
  47. view_range = 7,
  48. replace_rate = 7,
  49. replace_what = {
  50. {'group:flora', 'air', 0},
  51. {'group:grain', 'air', 0},
  52. {'group:veggie', 'air', 0},
  53. {'epic:poison', 'air', 0}
  54. },
  55. on_replace = function(self, pos, oldnode, newnode)
  56. if oldnode.name == 'epic:poison' then
  57. self.health = 0
  58. end
  59. end,
  60. on_rightclick = function(self, clicker)
  61. if mobs:protect(self, clicker) then return end
  62. if mobs:feed_tame(self, clicker, 8, true, true) then
  63. return
  64. end
  65. mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
  66. local tool = clicker:get_wielded_item()
  67. local name = clicker:get_player_name()
  68. if tool:get_name() == 'bucket:bucket_empty' then
  69. if self.child == true then
  70. return
  71. end
  72. if self.gotten == true then
  73. minetest.chat_send_player(name,'Goat already milked!')
  74. return
  75. end
  76. local inv = clicker:get_inventory()
  77. tool:take_item()
  78. clicker:set_wielded_item(tool)
  79. if inv:room_for_item('main', {name = 'mobs:bucket_milk'}) then
  80. clicker:get_inventory():add_item('main', 'mobs:bucket_milk')
  81. else
  82. local pos = self.object:get_pos()
  83. pos.y = pos.y + 0.5
  84. minetest.add_item(pos, {name = 'mobs:bucket_milk'})
  85. end
  86. self.gotten = true -- milked
  87. return
  88. end
  89. end,
  90. })
  91. mobs:register_mob('farm_mobs:goat_he', {
  92. type = 'animal',
  93. passive = true,
  94. attack_type = 'dogfight',
  95. attack_npcs = false,
  96. damage = 10,
  97. hp_min = 5, hp_max = 15, armor = 200,
  98. collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.75, 0.3},
  99. visual = 'mesh',
  100. mesh = 'farm_mobs_he_goat.b3d',
  101. textures = {
  102. {'farm_mobs_goat_brown.png'},
  103. {'farm_mobs_goat_grey.png'},
  104. },
  105. blood_texture = 'mobs_blood.png',
  106. visual_size = {x=2,y=2},
  107. makes_footstep_sound = true,
  108. sounds = {
  109. random = 'mobs_sheep',
  110. },
  111. walk_velocity = 1,
  112. run_velocity = 2,
  113. jump = true,
  114. stepheight = 1.1,
  115. drops = {
  116. {name = 'mobs:meat_raw', chance = 1, min = 1, max = 4},
  117. {name = 'mobs:leather', chance = 2, min = 1, max = 2},
  118. {name = 'bonemeal:bone', chance = 2, min = 1, max = 5},
  119. },
  120. water_damage = 0,
  121. lava_damage = 5,
  122. light_damage = 0,
  123. animation = {
  124. speed_normal = 30, speed_run = 45,
  125. stand_start = 1, stand_end = 60, -- head down/up
  126. walk_start = 122, walk_end = 182, -- walk
  127. run_start = 122, run_end = 182, -- walk
  128. punch_start = 246, punch_end = 330, -- attack
  129. },
  130. follow = 'farming:wheat',
  131. view_range = 7,
  132. replace_rate = 7,
  133. replace_what = {
  134. {'group:flora', 'air', 0},
  135. {'group:grain', 'air', 0},
  136. {'group:veggie', 'air', 0},
  137. {'epic:poison', 'air', 0}
  138. },
  139. on_replace = function(self, pos, oldnode, newnode)
  140. if oldnode.name == 'epic:poison' then
  141. self.health = 0
  142. end
  143. end,
  144. on_rightclick = function(self, clicker)
  145. if mobs:protect(self, clicker) then return end
  146. if mobs:feed_tame(self, clicker, 8, true, true) then
  147. return
  148. end
  149. mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
  150. end,
  151. })
  152. mobs:spawn({
  153. name = 'farm_mobs:goat_she',
  154. nodes = {'default:dirt_with_grass', 'default:dirt_with_dry_grass', 'default:dirt'},
  155. min_height = -5,
  156. max_height = 100,
  157. interval = 63,
  158. chance = 10000,
  159. active_object_count = 5,
  160. })
  161. mobs:spawn({
  162. name = 'farm_mobs:goat_he',
  163. nodes = {'default:dirt_with_grass', 'default:dirt_with_dry_grass', 'default:dirt'},
  164. min_height = -5,
  165. max_height = 100,
  166. interval = 64,
  167. chance = 10000,
  168. active_object_count = 5,
  169. })
  170. mobs:register_egg('farm_mobs:goat_she', 'She Goat', 'default_grass.png', 1)
  171. mobs:register_egg('farm_mobs:goat_he', 'He Goat', 'default_grass.png', 1)