init.lua 4.2 KB

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