spider.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. local S = mobs.intllib
  2. -- Spider by AspireMint (CC-BY-SA 3.0 license)
  3. mobs:register_mob("mobs_monster:spider", {
  4. --docile_by_day = true,
  5. group_attack = true,
  6. type = "monster",
  7. passive = false,
  8. attack_type = "dogfight",
  9. reach = 2,
  10. damage = 3,
  11. hp_min = 10,
  12. hp_max = 30,
  13. armor = 200,
  14. collisionbox = {-0.8, -0.5, -0.8, 0.8, 0, 0.8},
  15. visual_size = {x = 1, y = 1},
  16. visual = "mesh",
  17. mesh = "mobs_spider.b3d",
  18. textures = {
  19. {"mobs_spider_mese.png"},
  20. {"mobs_spider_orange.png"},
  21. {"mobs_spider_snowy.png"},
  22. {"mobs_spider_grey.png"},
  23. {"mobs_spider_crystal.png"},
  24. },
  25. makes_footstep_sound = false,
  26. sounds = {
  27. random = "mobs_spider",
  28. attack = "mobs_spider",
  29. },
  30. walk_velocity = 1,
  31. run_velocity = 3,
  32. jump = true,
  33. view_range = 15,
  34. floats = 0,
  35. drops = {
  36. {name = "farming:string", chance = 1, min = 0, max = 2},
  37. },
  38. water_damage = 5,
  39. lava_damage = 5,
  40. light_damage = 0,
  41. animation = {
  42. speed_normal = 15,
  43. speed_run = 20,--15,
  44. stand_start = 0,
  45. stand_end = 0,
  46. walk_start = 1,
  47. walk_end = 21,
  48. run_start = 1,
  49. run_end = 21,
  50. punch_start = 25,
  51. punch_end = 45,
  52. },
  53. -- what kind of spider are we spawning?
  54. on_spawn = function(self)
  55. local pos = self.object:get_pos() ; pos.y = pos.y - 1
  56. -- snowy spider
  57. if minetest.find_node_near(pos, 1,
  58. {"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
  59. self.base_texture = {"mobs_spider_snowy.png"}
  60. self.object:set_properties({textures = self.base_texture})
  61. self.docile_by_day = true
  62. -- tarantula
  63. elseif minetest.find_node_near(pos, 1,
  64. {"default:dirt_with_rainforest_litter", "default:jungletree"}) then
  65. self.base_texture = {"mobs_spider_orange.png"}
  66. self.object:set_properties({textures = self.base_texture})
  67. self.docile_by_day = true
  68. -- grey spider
  69. elseif minetest.find_node_near(pos, 1,
  70. {"default:stone", "default:gravel"}) then
  71. self.base_texture = {"mobs_spider_grey.png"}
  72. self.object:set_properties({textures = self.base_texture})
  73. -- mese spider
  74. elseif minetest.find_node_near(pos, 1,
  75. {"default:mese", "default:stone_with_mese"}) then
  76. self.base_texture = {"mobs_spider_mese.png"}
  77. self.object:set_properties({textures = self.base_texture})
  78. elseif minetest.find_node_near(pos, 1,
  79. {"ethereal:crystal_dirt", "ethereal:crystal_spike"}) then
  80. self.base_texture = {"mobs_spider_crystal.png"}
  81. self.object:set_properties({textures = self.base_texture})
  82. self.docile_by_day = true
  83. self.drops = {
  84. {name = "farming:string", chance = 1, min = 0, max = 2},
  85. {name = "ethereal:crystal_spike", chance = 15, min = 1, max = 2},
  86. }
  87. end
  88. return true -- run only once, false/nil runs every activation
  89. end,
  90. })
  91. -- above ground spawn
  92. mobs:spawn({
  93. name = "mobs_monster:spider",
  94. nodes = {
  95. "default:dirt_with_rainforest_litter", "default:snowblock",
  96. "default:snow", "ethereal:crystal_dirt"
  97. },
  98. min_light = 0,
  99. max_light = 8,
  100. chance = 7000,
  101. active_object_count = 1,
  102. min_height = 25,
  103. max_height = 31000,
  104. })
  105. -- below ground spawn
  106. mobs:spawn({
  107. name = "mobs_monster:spider",
  108. nodes = {"default:stone_with_mese", "default:mese", "default:stone"},
  109. min_light = 0,
  110. max_light = 7,
  111. chance = 7000,
  112. active_object_count = 1,
  113. min_height = -31000,
  114. max_height = -40,
  115. })
  116. mobs:register_egg("mobs_monster:spider", S("Spider"), "mobs_cobweb.png", 1)
  117. mobs:alias_mob("mobs_monster:spider2", "mobs_monster:spider") -- compatibility
  118. mobs:alias_mob("mobs:spider", "mobs_monster:spider")
  119. -- cobweb
  120. minetest.register_node(":mobs:cobweb", {
  121. description = S("Cobweb"),
  122. drawtype = "plantlike",
  123. visual_scale = 1.2,
  124. tiles = {"mobs_cobweb.png"},
  125. inventory_image = "mobs_cobweb.png",
  126. paramtype = "light",
  127. sunlight_propagates = true,
  128. liquid_viscosity = 11,
  129. liquidtype = "source",
  130. liquid_alternative_flowing = "mobs:cobweb",
  131. liquid_alternative_source = "mobs:cobweb",
  132. liquid_renewable = false,
  133. liquid_range = 0,
  134. walkable = false,
  135. groups = {snappy = 1, disable_jump = 1},
  136. drop = "farming:cotton",
  137. sounds = default.node_sound_leaves_defaults(),
  138. })
  139. minetest.register_craft({
  140. output = "mobs:cobweb",
  141. recipe = {
  142. {"farming:string", "", "farming:string"},
  143. {"", "farming:string", ""},
  144. {"farming:string", "", "farming:string"},
  145. }
  146. })