init.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. if mobs.mod and mobs.mod == "redo" then
  2. local SPRITE_VERSION = false -- set to true to use upright sprites instead of meshes
  3. -- local variables
  4. local l_spawn_in = {"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"}
  5. local l_spawn_near = {"default:sand","default:dirt","group:seaplants","group:seacoral"}
  6. local l_spawn_chance = 10000
  7. local l_cc_hand = 25
  8. local l_cc_net = 80
  9. local l_water_level = minetest.settings:get("water_level") - 1
  10. local l_anims = {
  11. speed_normal = 24, speed_run = 24,
  12. stand_start = 1, stand_end = 80,
  13. walk_start = 81, walk_end = 155,
  14. run_start = 81, run_end = 155
  15. }
  16. local l_visual = "mesh"
  17. local l_visual_size = {x=.75, y=.75}
  18. local l_clown_mesh = "animal_clownfish.b3d"
  19. local l_trop_mesh = "fish_blue_white.b3d"
  20. local l_clown_textures = {
  21. {"clownfish.png"},
  22. {"clownfish2.png"}
  23. }
  24. local l_trop_textures = {
  25. {"fish.png"},
  26. {"fish2.png"},
  27. {"fish3.png"}
  28. }
  29. if SPRITE_VERSION then
  30. l_visual = "upright_sprite"
  31. l_visual_size = {x=.5, y=.5}
  32. l_clown_mesh = nil
  33. l_trop_mesh = nil
  34. l_clown_textures = {{"animal_clownfish_clownfish_item.png"}}
  35. l_trop_textures = {{"animal_fish_blue_white_fish_blue_white_item.png"}}
  36. end
  37. -- Clownfish
  38. mobs:register_mob("mobs_fish:clownfish", {
  39. type = "animal",
  40. passive = true,
  41. hp_min = 1,
  42. hp_max = 4,
  43. armor = 100,
  44. collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
  45. rotate = 270,
  46. visual = l_visual,
  47. mesh = l_clown_mesh,
  48. textures = l_clown_textures,
  49. visual_size = l_visual_size,
  50. makes_footstep_sound = false,
  51. stepheight = 0.1,
  52. fly = true,
  53. fly_in = "default:water_source",
  54. fall_speed = 0,
  55. view_range = 8,
  56. water_damage = 0,
  57. lava_damage = 5,
  58. light_damage = 0,
  59. animation = l_anims,
  60. on_rightclick = function(self, clicker)
  61. mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, nil)
  62. end
  63. })
  64. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  65. mobs:spawn_specific("mobs_fish:clownfish", l_spawn_in, l_spawn_near, 5, 20, 30, l_spawn_chance, 5, -31000, l_water_level)
  66. mobs:register_egg("mobs_fish:clownfish", "Clownfish", "animal_clownfish_clownfish_item.png", 0)
  67. -- Tropical fish
  68. mobs:register_mob("mobs_fish:tropical", {
  69. type = "animal",
  70. passive = true,
  71. hp_min = 1,
  72. hp_max = 4,
  73. armor = 100,
  74. collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
  75. rotate = 270,
  76. visual = l_visual,
  77. mesh = l_trop_mesh,
  78. textures = l_trop_textures,
  79. visual_size = l_visual_size,
  80. makes_footstep_sound = false,
  81. stepheight = 0.1,
  82. fly = true,
  83. fly_in = "default:water_source",
  84. fall_speed = 0,
  85. view_range = 8,
  86. water_damage = 0,
  87. lava_damage = 5,
  88. light_damage = 0,
  89. animation = l_anims,
  90. on_rightclick = function(self, clicker)
  91. mobs:capture_mob(self, clicker, l_cc_hand, l_cc_net, 0, true, nil)
  92. end
  93. })
  94. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  95. mobs:spawn_specific("mobs_fish:tropical", l_spawn_in, l_spawn_near, 5, 20, 30, l_spawn_chance, 5, -31000, l_water_level)
  96. mobs:register_egg("mobs_fish:tropical", "Tropical fish", "animal_fish_blue_white_fish_blue_white_item.png", 0)
  97. end