stone_monster.lua 3.1 KB

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