stone_monster.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. local S = mobs.intllib_monster
  2. local stone_types = {
  3. { nodes = {"default:desert_stone"},
  4. skins = {"mobs_stone_monster3.png"},
  5. drops = {
  6. {name = "default:desert_cobble", chance = 1, min = 0, max = 2},
  7. {name = "default:iron_lump", chance = 5, min = 0, max = 2},
  8. {name = "default:gold_lump", chance = 5, min = 0, max = 2}
  9. }
  10. }
  11. }
  12. -- Stone Monster by PilzAdam
  13. mobs:register_mob("mobs_monster:stone_monster", {
  14. type = "monster",
  15. passive = false,
  16. attack_type = "dogfight",
  17. pathfinding = true,
  18. reach = 2,
  19. damage = 3,
  20. hp_min = 12,
  21. hp_max = 35,
  22. armor = 80,
  23. collisionbox = {-0.4, -1, -0.4, 0.4, 0.9, 0.4},
  24. visual = "mesh",
  25. mesh = "mobs_stone_monster.b3d",
  26. textures = {
  27. {"mobs_stone_monster.png"},
  28. {"mobs_stone_monster2.png"} -- by AMMOnym
  29. },
  30. makes_footstep_sound = true,
  31. sounds = {
  32. random = "mobs_stonemonster"
  33. },
  34. walk_velocity = 1,
  35. run_velocity = 2,
  36. jump_height = 0,
  37. stepheight = 1.1,
  38. floats = 0,
  39. view_range = 10,
  40. drops = {
  41. {name = "default:cobble", chance = 1, min = 0, max = 2},
  42. {name = "default:coal_lump", chance = 3, min = 0, max = 2},
  43. {name = "default:iron_lump", chance = 5, min = 0, max = 2}
  44. },
  45. water_damage = 0,
  46. lava_damage = 1,
  47. light_damage = 0,
  48. animation = {
  49. speed_normal = 15,
  50. speed_run = 15,
  51. stand_start = 0,
  52. stand_end = 14,
  53. walk_start = 15,
  54. walk_end = 38,
  55. run_start = 40,
  56. run_end = 63,
  57. punch_start = 40,
  58. punch_end = 63
  59. },
  60. immune_to = {
  61. {"default:pick_wood", 0}, -- wooden pick doesnt hurt stone monster
  62. {"default:pick_stone", 4}, -- picks deal more damage to stone monster
  63. {"default:pick_bronze", 5},
  64. {"default:pick_steel", 5},
  65. {"default:pick_mese", 6},
  66. {"default:pick_diamond", 7}
  67. },
  68. -- check surrounding nodes and spawn a specific spider
  69. on_spawn = function(self)
  70. local pos = self.object:get_pos() ; pos.y = pos.y - 1
  71. local tmp
  72. for n = 1, #stone_types do
  73. tmp = stone_types[n]
  74. if minetest.find_node_near(pos, 1, tmp.nodes) then
  75. self.base_texture = tmp.skins
  76. self.object:set_properties({textures = tmp.skins})
  77. if tmp.drops then
  78. self.drops = tmp.drops
  79. end
  80. return true
  81. end
  82. end
  83. return true -- run only once, false/nil runs every activation
  84. end
  85. })
  86. if not mobs.custom_spawn_monster then
  87. mobs:spawn({
  88. name = "mobs_monster:stone_monster",
  89. nodes = {"default:stone", "default:desert_stone", "default:sandstone"},
  90. max_light = 7,
  91. chance = 7000,
  92. max_height = 0
  93. })
  94. end
  95. mobs:register_egg("mobs_monster:stone_monster", S("Stone Monster"), "default_stone.png", 1)
  96. mobs:alias_mob("mobs:stone_monster", "mobs_monster:stone_monster") -- compatibility