init.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. -- simple dog to use with animal mobs !!!
  2. -- This is a " kitten " version of the animal mobs, with some minor modifications.
  3. -- sounds :
  4. -- https://freesound.org/people/ScouseMouseJB/sounds/276267/
  5. -- https://freesound.org/people/TobiasKosmos/sounds/163280/
  6. local getInitialName = function(mobName)
  7. local isShowed = minetest.settings:get_bool("simpleanimals.initial_nametags")
  8. if isShowed then
  9. return mobName
  10. end
  11. end
  12. mobs:register_mob("dog:dog", {
  13. nametag = getInitialName("DOG"),
  14. type = "animal",
  15. specific_attack = {
  16. --"mobs_animal:kkitten",
  17. "mobs_skeletons:skeleton",
  18. "mobs_skeletons:skeleton_archer",
  19. "mobs_skeletons:skeleton_archer_dark",
  20. },
  21. damage = 3,
  22. attack_type = "dogfight",
  23. --attack_animals = true, -- so it can attack kitten?
  24. group_attack = true,
  25. reach = 2,
  26. stepheight = 1.1,
  27. passive = false,
  28. hp_min = 10,
  29. hp_max = 10,
  30. armor = 100,
  31. collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
  32. visual = "mesh",
  33. visual_size = {x = 0.5, y = 0.5},
  34. mesh = "dog.b3d",
  35. rotate = 180,
  36. textures = {
  37. {"dog.png"},
  38. {"dog_black.png"},
  39. {"dog_yellow.png"},
  40. {"dog_tabby.png"},
  41. },
  42. makes_footstep_sound = false,
  43. sounds = {
  44. random = "bark",
  45. death = "yelp",
  46. },
  47. walk_velocity = 2,
  48. walk_chance = 15,
  49. run_velocity = 3,
  50. runaway = true,
  51. jump = true,
  52. jump_height = 2,
  53. stepheight = 1,
  54. drops = {
  55. --{name = "", chance = 1, min = 0, max = 1},
  56. {name = 'bonemeal:bone', chance = 20, min = 0, max = 2}
  57. },
  58. water_damage = 1, --dogs unlike of water.
  59. lava_damage = 5,
  60. fear_height = 3,
  61. animation = {
  62. speed_normal = 20, -- 42
  63. --stoodup_start = 0,
  64. --stoodup_end = 0,
  65. walk_start = 20,
  66. walk_end = 40,
  67. stand_start = 50,
  68. stand_end = 109,
  69. },
  70. follow = {
  71. "mobs:chicken_raw",
  72. "mobs:meat_raw",
  73. "bonemeal:bone",
  74. },
  75. view_range = 10,
  76. runaway = true ,
  77. on_rightclick = function(self, clicker)
  78. if mobs:feed_tame(self, clicker, 4, true, true) then return end
  79. if mobs:protect(self, clicker) then return end
  80. if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end
  81. -- by right-clicking owner can switch between staying and walking
  82. if self.owner and self.owner == clicker:get_player_name() then
  83. minetest.sound_play("bark", {pos=self.object:get_pos(), gain=1.0, max_hear_distance = 5})
  84. if self.order ~= "stand" then
  85. self.order = "stand"
  86. self.state = "stand"
  87. self.object:set_velocity({x = 0, y = 0, z = 0})
  88. mobs:set_animation(self, "stand")
  89. else
  90. self.order = ""
  91. mobs:set_animation(self, "walk")
  92. end
  93. end
  94. end,
  95. })
  96. if not mobs.custom_spawn_animal then
  97. mobs:spawn({
  98. name = "dog:dog",
  99. nodes = {
  100. "default:dirt_with_grass",
  101. "ethereal:grove_dirt",
  102. },
  103. --neighbors = {"group:grass"},
  104. min_light = 4, --dogs hanter in night
  105. interval = 60,
  106. chance = 8000, --same the cat
  107. min_height = -5, --dogs exolore dig in surfaces caves
  108. max_height = 50,
  109. --day_toggle = true,
  110. })
  111. end
  112. mobs:register_egg("dog:dog", "Dog", "dog_egg.png", 1)