init.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. if not mobs.mod == "redo" then
  2. minetest.log("error", "[mobs_crocs] mobs redo flavor not found!")
  3. return
  4. end
  5. -- local variables
  6. local l_skins = {
  7. {"croco.png"},
  8. {"croco2.png"}
  9. }
  10. local l_anims = {
  11. speed_normal = 24, speed_run = 24,
  12. stand_start = 0, stand_end = 80,
  13. walk_start = 81, walk_end = 170,
  14. run_start = 81, run_end = 170,
  15. punch_start = 205, punch_end = 220
  16. }
  17. local l_model = "crocodile.x"
  18. local l_sounds = {random = "croco"}
  19. local l_egg_texture = "default_grass.png"
  20. local l_spawn_chance = 60000
  21. -- load settings
  22. local ENABLE_WALKERS = minetest.settings:get_bool("mobs_crocs.enable_walkers", true)
  23. local ENABLE_FLOATERS = minetest.settings:get_bool("mobs_crocs.enable_floaters", true)
  24. local ENABLE_SWIMMERS = minetest.settings:get_bool("mobs_crocs.enable_swimmers", true)
  25. if not ENABLE_WALKERS then
  26. l_spawn_chance = l_spawn_chance - 20000
  27. end
  28. if not ENABLE_FLOATERS then
  29. l_spawn_chance = l_spawn_chance - 20000
  30. end
  31. if not ENABLE_SWIMMERS then
  32. l_spawn_chance = l_spawn_chance - 20000
  33. end
  34. -- no float
  35. if ENABLE_WALKERS then
  36. mobs:register_mob("mobs_crocs:crocodile", {
  37. type = "monster",
  38. attack_type = "dogfight",
  39. damage = 8,
  40. reach = 3,
  41. hp_min = 20,
  42. hp_max = 25,
  43. armor = 200,
  44. collisionbox = {-0.85, -0.30, -0.85, 0.85, 1.5, 0.85},
  45. drawtype = "front",
  46. visual = "mesh",
  47. mesh = l_model,
  48. textures = l_skins,
  49. visual_size = {x=4, y=4},
  50. sounds = l_sounds,
  51. fly = false,
  52. floats = 0,
  53. stepheight = 1,
  54. view_range = 10,
  55. water_damage = 0,
  56. lava_damage = 10,
  57. light_damage = 0,
  58. animation = l_anims,
  59. drops = {
  60. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  61. {name = "mobs:leather", chance = 1, min = 0, max = 2},
  62. },
  63. })
  64. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  65. mobs:spawn_specific("mobs_crocs:crocodile",
  66. {"default:dirt_with_grass","default:dirt","default:jungle_grass","default:sand"},
  67. {"default:water_flowing","default:water_source","default:papyrus","dryplants:juncus","dryplants:reedmace"},
  68. -1, 18, 30, l_spawn_chance, 1, 0, 31000)
  69. mobs:register_egg("mobs_crocs:crocodile", "Crocodile", l_egg_texture, 1)
  70. end
  71. -- float
  72. if ENABLE_FLOATERS then
  73. mobs:register_mob("mobs_crocs:crocodile_float", {
  74. type = "monster",
  75. attack_type = "dogfight",
  76. damage = 8,
  77. reach = 2,
  78. hp_min = 20,
  79. hp_max = 25,
  80. armor = 200,
  81. collisionbox = {-0.638, -0.23, -0.638, 0.638, 1.13, 0.638},
  82. drawtype = "front",
  83. visual = "mesh",
  84. mesh = l_model,
  85. textures = l_skins,
  86. visual_size = {x=3, y=3},
  87. sounds = l_sounds,
  88. fly = false,
  89. stepheight = 1,
  90. view_range = 10,
  91. water_damage = 0,
  92. lava_damage = 10,
  93. light_damage = 0,
  94. animation = l_anims,
  95. drops = {
  96. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  97. {name = "mobs:leather", chance = 1, min = 0, max = 2},
  98. },
  99. })
  100. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  101. mobs:spawn_specific("mobs_crocs:crocodile_float",
  102. {"default:water_flowing","default:water_source"},
  103. {
  104. "default:dirt_with_grass","default:jungle_grass","default:sand","default:dirt",
  105. "default:papyrus","group:seaplants","dryplants:juncus","dryplants:reedmace"
  106. },
  107. -1, 18, 30, l_spawn_chance, 1, -3, 31000)
  108. mobs:register_egg("mobs_crocs:crocodile_float", "Crocodile (floater)", l_egg_texture, 1)
  109. end
  110. -- swim
  111. if ENABLE_SWIMMERS then
  112. mobs:register_mob("mobs_crocs:crocodile_swim", {
  113. type = "monster",
  114. attack_type = "dogfight",
  115. damage = 8,
  116. reach = 1,
  117. hp_min = 20,
  118. hp_max = 25,
  119. armor = 200,
  120. collisionbox = {-0.425, -0.15, -0.425, 0.425, 0.75, 0.425},
  121. drawtype = "front",
  122. visual = "mesh",
  123. mesh = l_model,
  124. textures = l_skins,
  125. visual_size = {x=2, y=2},
  126. sounds = l_sounds,
  127. fly = true,
  128. fly_in = "default:water_source",
  129. fall_speed = -1,
  130. floats = 0,
  131. view_range = 10,
  132. water_damage = 0,
  133. lava_damage = 10,
  134. light_damage = 0,
  135. animation = l_anims,
  136. drops = {
  137. {name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
  138. {name = "mobs:leather", chance = 1, min = 0, max = 2},
  139. },
  140. })
  141. --name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
  142. mobs:spawn_specific("mobs_crocs:crocodile_swim",
  143. {"default:water_flowing","default:water_source"},
  144. {"default:sand","default:dirt","group:seaplants"},
  145. -1, 18, 30, l_spawn_chance, 1, -8, 31000)
  146. mobs:register_egg("mobs_crocs:crocodile_swim", "Crocodile (swimmer)", l_egg_texture, 1)
  147. end