init.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. if mobs.mod and mobs.mod == "redo" then
  2. -- local variables
  3. local l_colors = {
  4. "#604000:175", --brown
  5. "#ffffff:150", --white
  6. "#404040:150", --dark_grey
  7. "#a0a0a0:150" --grey
  8. }
  9. local l_skins = {
  10. {"(shark_first.png^[colorize:"..l_colors[3]..")^(shark_second.png^[colorize:"..l_colors[4]..")^shark_third.png"},
  11. {"(shark_first.png^[colorize:"..l_colors[1]..")^(shark_second.png^[colorize:"..l_colors[2]..")^shark_third.png"},
  12. {"(shark_first.png^[colorize:"..l_colors[4]..")^(shark_second.png^[colorize:"..l_colors[2]..")^shark_third.png"}
  13. }
  14. local l_anims = {
  15. speed_normal = 24, speed_run = 24,
  16. stand_start = 1, stand_end = 80,
  17. walk_start = 80, walk_end = 160,
  18. run_start = 80, run_end = 160
  19. }
  20. local l_model = "mob_shark.b3d"
  21. local l_egg_texture = "mob_shark_shark_item.png"
  22. local l_spawn_in = {"default:water_flowing","default:water_source"}
  23. local l_spawn_near = {"default:water_flowing","default:water_source","seawrecks:woodship","seawrecks:uboot"}
  24. local l_spawn_chance = 60000
  25. -- load settings
  26. dofile(minetest.get_modpath("mobs_sharks").."/SETTINGS.txt")
  27. if not ENABLE_SHARK_LARGE then
  28. l_spawn_chance = l_spawn_chance - 20000
  29. end
  30. if not ENABLE_SHARK_MEDIUM then
  31. l_spawn_chance = l_spawn_chance - 20000
  32. end
  33. if not ENABLE_SHARK_SMALL then
  34. l_spawn_chance = l_spawn_chance - 20000
  35. end
  36. -- large
  37. if ENABLE_SHARK_LARGE then
  38. mobs:register_mob("mobs_sharks:shark_lg", {
  39. type = "monster",
  40. attack_type = "dogfight",
  41. damage = 10,
  42. reach = 3,
  43. hp_min = 20,
  44. hp_max = 25,
  45. armor = 150,
  46. collisionbox = {-0.75, -0.5, -0.75, 0.75, 0.5, 0.75},
  47. visual = "mesh",
  48. mesh = l_model,
  49. textures = l_skins,
  50. makes_footstep_sound = false,
  51. walk_velocity = 4,
  52. run_velocity = 6,
  53. fly = true,
  54. fly_in = "default:water_source",
  55. fall_speed = 0,
  56. rotate = 270,
  57. view_range = 10,
  58. water_damage = 0,
  59. lava_damage = 10,
  60. light_damage = 0,
  61. animation = l_anims,
  62. jump = false,
  63. stepheight = 0.1,
  64. drops = {
  65. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  66. },
  67. })
  68. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  69. mobs:spawn_specific("mobs_sharks:shark_lg", l_spawn_in, l_spawn_near, -1, 20, 30, l_spawn_chance, 1, -31000, 0)
  70. mobs:register_egg("mobs_sharks:shark_lg", "Shark (large)", l_egg_texture, 0)
  71. end
  72. -- medium
  73. if ENABLE_SHARK_MEDIUM then
  74. mobs:register_mob("mobs_sharks:shark_md", {
  75. type = "monster",
  76. attack_type = "dogfight",
  77. damage = 8,
  78. reach = 2,
  79. hp_min = 15,
  80. hp_max = 20,
  81. armor = 125,
  82. collisionbox = {-0.57, -0.38, -0.57, 0.57, 0.38, 0.57},
  83. visual = "mesh",
  84. visual_size = {x=0.75, y=0.75},
  85. mesh = l_model,
  86. textures = l_skins,
  87. makes_footstep_sound = false,
  88. walk_velocity = 2,
  89. run_velocity = 4,
  90. fly = true,
  91. fly_in = "default:water_source",
  92. fall_speed = -1,
  93. rotate = 270,
  94. view_range = 10,
  95. water_damage = 0,
  96. lava_damage = 10,
  97. light_damage = 0,
  98. animation = l_anims,
  99. jump = false,
  100. stepheight = 0.1,
  101. drops = {
  102. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  103. },
  104. })
  105. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  106. mobs:spawn_specific("mobs_sharks:shark_md", l_spawn_in, l_spawn_near, -1, 20, 30, l_spawn_chance, 1, -31000, 0)
  107. mobs:register_egg("mobs_sharks:shark_md", "Shark (medium)", l_egg_texture, 0)
  108. end
  109. -- small
  110. if ENABLE_SHARK_SMALL then
  111. mobs:register_mob("mobs_sharks:shark_sm", {
  112. type = "monster",
  113. attack_type = "dogfight",
  114. damage = 6,
  115. reach = 1,
  116. hp_min = 10,
  117. hp_max = 15,
  118. armor = 100,
  119. collisionbox = {-0.38, -0.25, -0.38, 0.38, 0.25, 0.38},
  120. visual = "mesh",
  121. visual_size = {x=0.5, y=0.5},
  122. mesh = l_model,
  123. textures = l_skins,
  124. makes_footstep_sound = false,
  125. walk_velocity = 2,
  126. run_velocity = 4,
  127. fly = true,
  128. fly_in = "default:water_source",
  129. fall_speed = -1,
  130. rotate = 270,
  131. view_range = 10,
  132. water_damage = 0,
  133. lava_damage = 10,
  134. light_damage = 0,
  135. animation = l_anims,
  136. jump = false,
  137. stepheight = 0.1,
  138. drops = {
  139. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  140. },
  141. })
  142. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  143. mobs:spawn_specific("mobs_sharks:shark_sm", l_spawn_in, l_spawn_near, -1, 20, 30, l_spawn_chance, 1, -31000, 0)
  144. mobs:register_egg("mobs_sharks:shark_sm", "Shark (small)", l_egg_texture, 0)
  145. end
  146. end