bunny.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. local S = mobs.intllib
  2. -- Bunny by ExeterDad
  3. mobs:register_mob("mobs_animal:bunny", {
  4. type = "animal",
  5. passive = true,
  6. reach = 1,
  7. hp_min = 1,
  8. hp_max = 4,
  9. armor = 200,
  10. collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
  11. visual = "mesh",
  12. mesh = "mobs_bunny.b3d",
  13. drawtype = "front",
  14. textures = {
  15. {"mobs_bunny_grey.png"},
  16. {"mobs_bunny_brown.png"},
  17. {"mobs_bunny_white.png"},
  18. },
  19. sounds = {
  20. random = "mobs_bunny",
  21. },
  22. makes_footstep_sound = false,
  23. walk_velocity = 1,
  24. run_velocity = 2,
  25. runaway = true,
  26. jump = true,
  27. drops = {
  28. {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
  29. },
  30. water_damage = 1,
  31. lava_damage = 4,
  32. light_damage = 0,
  33. fear_height = 2,
  34. animation = {
  35. speed_normal = 15,
  36. stand_start = 1,
  37. stand_end = 15,
  38. walk_start = 16,
  39. walk_end = 24,
  40. punch_start = 16,
  41. punch_end = 24,
  42. },
  43. follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"},
  44. view_range = 8,
  45. replace_rate = 10,
  46. replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
  47. replace_with = "air",
  48. on_rightclick = function(self, clicker)
  49. -- feed or tame
  50. if mobs:feed_tame(self, clicker, 4, true, true) then return end
  51. if mobs:protect(self, clicker) then return end
  52. if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
  53. -- Monty Python tribute
  54. local item = clicker:get_wielded_item()
  55. if item:get_name() == "mobs:lava_orb" then
  56. if not minetest.setting_getbool("creative_mode") then
  57. item:take_item()
  58. clicker:set_wielded_item(item)
  59. end
  60. self.object:set_properties({
  61. textures = {"mobs_bunny_evil.png"},
  62. })
  63. self.type = "monster"
  64. self.health = 20
  65. return
  66. end
  67. -- Azure
  68. if item:get_name() == "dye:blue" then
  69. if not minetest.setting_getbool("creative_mode") then
  70. item:take_item()
  71. clicker:set_wielded_item(item)
  72. end
  73. self.object:set_properties({
  74. textures = {"mobs_bunny_azure.png"},
  75. sounds = {
  76. random = "mobs_bunny_azure",
  77. },
  78. })
  79. self.health = 1
  80. return
  81. end
  82. end,
  83. attack_type = "dogfight",
  84. damage = 5,
  85. })
  86. local spawn_on = "default:dirt_with_grass"
  87. if minetest.get_modpath("ethereal") then
  88. spawn_on = "ethereal:prairie_dirt"
  89. end
  90. mobs:spawn({
  91. name = "mobs_animal:bunny",
  92. nodes = {spawn_on},
  93. min_light = 10,
  94. chance = 15000,
  95. min_height = 0,
  96. day_toggle = true,
  97. })
  98. mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0)
  99. mobs:alias_mob("mobs:bunny", "mobs_animal:bunny") -- compatibility