land_guard.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. local S = mobs.intllib
  2. local guard_types = {
  3. { nodes = {
  4. "default:snow", "default:snowblock", "default:ice",
  5. "default:dirt_with_snow"
  6. },
  7. skins = {"mobs_land_guard6.png", "mobs_land_guard7.png", "mobs_land_guard8.png"},
  8. drops = {
  9. {name = "default:ice", chance = 1, min = 1, max = 4},
  10. {name = "mobs:leather", chance = 2, min = 0, max = 2},
  11. {name = "default:diamond", chance = 4, min = 0, max = 2},
  12. },
  13. },
  14. { nodes = {
  15. "ethereal:dry_dirt", "default:sand", "default:desert_sand",
  16. "default:dry_dirt_with_dry_grass", "default:dry_dirt"
  17. },
  18. skins = {"mobs_land_guard4.png", "mobs_land_guard5.png"},
  19. drops = {
  20. {name = "default:sandstone", chance = 1, min = 1, max = 4},
  21. {name = "mobs:leather", chance = 2, min = 0, max = 2},
  22. {name = "default:mese_crystal", chance = 4, min = 0, max = 2},
  23. },
  24. }
  25. }
  26. -- Land Guard
  27. mobs:register_mob("mobs_monster:land_guard", {
  28. type = "monster",
  29. passive = false,
  30. attack_type = "dogfight",
  31. group_attack = true,
  32. reach = 3,
  33. damage = 15,
  34. hp_min = 30,
  35. hp_max = 65,
  36. armor = 50,
  37. collisionbox = {-0.5, -1.01, -0.5, 0.5, 1.6, 0.5},
  38. visual_size = {x = 1, y = 1},
  39. visual = "mesh",
  40. mesh = "mobs_dungeon_master.b3d",
  41. textures = {
  42. {"mobs_land_guard.png"},
  43. {"mobs_land_guard2.png"},
  44. {"mobs_land_guard3.png"}
  45. },
  46. makes_footstep_sound = true,
  47. sounds = {
  48. random = "mobs_dungeonmaster",
  49. },
  50. walk_velocity = 1.5,
  51. run_velocity = 3.4,
  52. jump = true,
  53. jump_height = 2.0,
  54. floats = 0,
  55. view_range = 15,
  56. drops = {
  57. {name = "mobs:leather", chance = 2, min = 0, max = 2},
  58. {name = "default:mese_crystal", chance = 3, min = 0, max = 2},
  59. {name = "default:diamond", chance = 4, min = 0, max = 1},
  60. },
  61. water_damage = 0,
  62. lava_damage = 6,
  63. light_damage = 0,
  64. fear_height = 8,
  65. animation = {
  66. stand_start = 0,
  67. stand_end = 19,
  68. walk_start = 20,
  69. walk_end = 35,
  70. punch_start = 36,
  71. punch_end = 48,
  72. speed_normal = 15,
  73. speed_run = 20,
  74. },
  75. -- check surrounding nodes and spawn a specific guard
  76. on_spawn = function(self)
  77. local pos = self.object:get_pos() ; pos.y = pos.y - 1
  78. local tmp
  79. for n = 1, #guard_types do
  80. tmp = guard_types[n]
  81. if minetest.find_node_near(pos, 1, tmp.nodes) then
  82. self.base_texture = { tmp.skins[math.random(#tmp.skins)] }
  83. self.object:set_properties({textures = self.base_texture})
  84. self.docile_by_day = tmp.docile
  85. if tmp.drops then
  86. self.drops = tmp.drops
  87. end
  88. return true
  89. end
  90. end
  91. return true -- run only once, false/nil runs every activation
  92. end,
  93. })
  94. if not mobs.custom_spawn_monster then
  95. mobs:spawn({
  96. name = "mobs_monster:land_guard",
  97. nodes = {
  98. "default:snow", "default:ice", "default:stone",
  99. "default:dry_dirt_with_dry_grass", "ethereal:dry_dirt"
  100. },
  101. max_light = 7,
  102. chance = 25000,
  103. min_height = 0,
  104. active_object_count = 1,
  105. })
  106. end
  107. mobs:register_egg("mobs_monster:land_guard", S("Land Guard"), "default_ice.png", 1)