wolf.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. local S = minetest.get_translator("animalworld")
  2. local random = math.random
  3. mobs:register_mob("animalworld:wolf", {
  4. stepheight = 2,
  5. type = "monster",
  6. passive = false,
  7. attack_type = "dogfight",
  8. attack_animals = true,
  9. reach = 2,
  10. damage = 9,
  11. hp_min = 25,
  12. hp_max = 45,
  13. armor = 100,
  14. collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.95, 0.5},
  15. visual = "mesh",
  16. mesh = "Wolf.b3d",
  17. visual_size = {x = 1.0, y = 1.0},
  18. textures = {
  19. {"texturewolf.png"},
  20. {"texturewolf2.png"},
  21. {"texturewolf.png"},
  22. {"texturewolf3.png"},
  23. {"texturewolf.png"},
  24. {"texturewolf.png"},
  25. },
  26. sounds = {
  27. random = "animalworld_wolf",
  28. attack = "animalworld_wolf2",
  29. damage = "animalworld_wolf3",
  30. },
  31. makes_footstep_sound = true,
  32. walk_velocity = 2,
  33. run_velocity = 3,
  34. runaway = false,
  35. jump = true,
  36. jump_height = 6,
  37. stepheight = 2,
  38. stay_near = {{"default:fern_1", "default:fern_2", "naturalbiomes:alpine_grass1", "naturalbiomes:alpine_grass2", "naturalbiomes:alpine_grass3", "naturalbiomes:alpine_dandelion", "naturalbiomes:alpine_edelweiss"}, 6},
  39. drops = {
  40. {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
  41. {name = "mobs:leather", chance = 1, min = 0, max = 2},
  42. },
  43. water_damage = 0,
  44. lava_damage = 4,
  45. light_damage = 0,
  46. fear_height = 4,
  47. animation = {
  48. speed_normal = 50,
  49. stand_start = 0,
  50. stand_end = 100,
  51. stand_start = 100,
  52. stand_end = 200,
  53. walk_start = 200,
  54. walk_end = 300,
  55. punch_speed = 100,
  56. punch_start = 300,
  57. punch_end = 400,
  58. die_start = 300,
  59. die_end = 400,
  60. die_speed = 50,
  61. die_loop = false,
  62. die_rotate = true,
  63. },
  64. follow = {
  65. "ethereal:fish_raw", "animalworld:rawfish", "mobs_fish:tropical",
  66. "mobs:meat_raw", "animalworld:rabbit_raw", "animalworld:pork_raw", "water_life:meat_raw", "xocean:fish_edible", "animalworld:chicken_raw", "mobs:meatblock_raw", "animalworld:chicken_raw", "livingfloatlands:ornithischiaraw", "livingfloatlands:largemammalraw", "livingfloatlands:theropodraw", "livingfloatlands:sauropodraw", "animalworld:raw_athropod", "animalworld:whalemeat_raw", "animalworld:rabbit_raw", "nativevillages:chicken_raw", "mobs:meat_raw", "animalworld:pork_raw", "people:mutton:raw"
  67. },
  68. view_range = 10,
  69. on_rightclick = function(self, clicker)
  70. -- feed or tame
  71. if mobs:feed_tame(self, clicker, 4, false, true) then return end
  72. if mobs:protect(self, clicker) then return end
  73. if mobs:capture_mob(self, clicker, 0, 25, 0, false, nil) then return end
  74. end,
  75. })
  76. if minetest.get_modpath("ethereal") then
  77. spawn_on = {"ethereal:dry_dirt"}
  78. end
  79. if not mobs.custom_spawn_animalworld then
  80. mobs:spawn({
  81. name = "animalworld:wolf",
  82. nodes = {"default:dirt_with_coniferous_litter", "naturalbiomes:alpine_litter", "naturalbiomes:heath_litter"},
  83. neighbors = {"default:pine_needles", "naturalbiomes:pine_leaves", "heath_juniper_leaves", "naturalbiomes:alppine1_leaves", "naturalbiomes:alppine2_leaves"},
  84. min_light = 0,
  85. interval = 60,
  86. chance = 500, -- 15000
  87. active_object_count = 4,
  88. min_height = 30,
  89. max_height = 31000,
  90. day_toggle = false,
  91. on_spawn = function(self, pos)
  92. local nods = minetest.find_nodes_in_area_under_air(
  93. {x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
  94. {x = pos.x + 4, y = pos.y + 3, z = pos.z + 4},
  95. {"default:dirt_with_coniferous_litter", "naturalbiomes:alpine_litter", "naturalbiomes:heath_litter"})
  96. if nods and #nods > 0 then
  97. -- min herd of 4
  98. local iter = math.min(#nods, 4)
  99. -- print("--- wolf at", minetest.pos_to_string(pos), iter)
  100. for n = 1, iter do
  101. local pos2 = nods[random(#nods)]
  102. local kid = random(4) == 1 and true or nil
  103. pos2.y = pos2.y + 2
  104. if minetest.get_node(pos2).name == "air" then
  105. mobs:add_mob(pos2, {
  106. name = "animalworld:wolf", child = kid})
  107. end
  108. end
  109. end
  110. end
  111. })
  112. end
  113. mobs:register_egg("animalworld:wolf", ("Wolf"), "awolf.png")