init.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. -- =============================================================================
  2. -- SOUND: https://freesound.org/people/yaplasut1843/sounds/523307/
  3. -- =============================================================================
  4. local getInitialName = function(mobName)
  5. local isShowed = minetest.settings:get_bool("simpleanimals.initial_nametags")
  6. if isShowed then
  7. return mobName
  8. end
  9. end
  10. mobs:register_mob("birdie:birdie", {
  11. nametag = getInitialName("BIRD"),
  12. type = "animal",
  13. passive = true,
  14. pathfinding = true,
  15. -- reach = 0,
  16. -- damage = 0,
  17. hp_min = 8,
  18. hp_max = 8,
  19. armor = 100,
  20. collisionbox = {-0.3, -0.5, -0.3, 0.3, 0.1, 0.3},
  21. visual = "mesh",
  22. mesh = "bird.b3d",
  23. rotate = 180,
  24. textures = {
  25. {"bird_yellow.png"},
  26. {"bird_blue.png"},
  27. {"bird_brown.png"},
  28. {"bird_red.png"},
  29. {"bird_green.png"},
  30. {"bird_pink.png"}
  31. },
  32. --blood_texture = "",
  33. sounds = {
  34. random = "birdie",
  35. --death = "",
  36. },
  37. fly = true ,
  38. fly_in = "air",
  39. walk_velocity = 2,
  40. run_velocity = 4,
  41. jump_height = 3,
  42. stepheight = 2,
  43. floats = 0,
  44. view_range = 16, --smartphone player not see long distance.
  45. drops = {
  46. {name = "mobs:chicken_feather", chance = 3, min = 0, max = 1},
  47. },
  48. water_damage = 1,
  49. lava_damage = 2,
  50. light_damage = 0,
  51. animation = {
  52. speed_normal = 30,
  53. stand_start = 0,
  54. stand_end = 40,
  55. fly_start = 50,
  56. fly_end = 119,
  57. walk_start = 50,
  58. walk_end = 119,
  59. run_start = 50,
  60. run_end = 119,
  61. --punch_start = 0,
  62. --punch_end = 0,
  63. },
  64. follow = {
  65. "farming:seed_wheat",
  66. "farming:seed_cotton",
  67. },
  68. on_rightclick = function(self, clicker)
  69. if mobs:feed_tame(self, clicker, 4, true, true) then return end
  70. if mobs:protect(self, clicker) then return end
  71. if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end
  72. -- by right-clicking owner can switch between staying and walking
  73. if self.owner and self.owner == clicker:get_player_name() then
  74. minetest.sound_play("birdie", {pos=self.object:get_pos(), gain=1.0, max_hear_distance = 5})
  75. if self.order ~= "stand" then
  76. self.order = "stand"
  77. self.state = "stand"
  78. self.object:set_velocity({x = 0, y = 0, z = 0})
  79. mobs:set_animation(self, "stand")
  80. else
  81. self.order = ""
  82. mobs:set_animation(self, "fly")
  83. end
  84. end
  85. end,
  86. })
  87. mobs:spawn({
  88. name = "birdie:birdie",
  89. nodes = {
  90. --"air",
  91. "default:leaves",
  92. "default:jungleleaves",
  93. },
  94. min_light = 10,
  95. chance = 8000,
  96. min_height = 0,
  97. max_height = 200,
  98. day_toggle = true,
  99. })
  100. mobs:register_egg("birdie:birdie", "Birdie", "birdieegg.png", 1)