dirt_monster.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. local S = mobs.intllib
  2. local dirt_types = {
  3. { nodes = {"ethereal:dry_dirt"},
  4. skins = {"mobs_dirt_monster3.png"},
  5. drops = {
  6. {name = "ethereal:dry_dirt", chance = 1, min = 0, max = 2}
  7. }
  8. }
  9. }
  10. -- Dirt Monster by PilzAdam
  11. mobs:register_mob("mobs_monster:dirt_monster", {
  12. type = "monster",
  13. passive = false,
  14. attack_type = "dogfight",
  15. pathfinding = true,
  16. reach = 2,
  17. damage = 2,
  18. hp_min = 3,
  19. hp_max = 27,
  20. armor = 100,
  21. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  22. visual = "mesh",
  23. mesh = "mobs_stone_monster.b3d",
  24. textures = {
  25. {"mobs_dirt_monster.png"},
  26. {"mobs_dirt_monster2.png"},
  27. },
  28. blood_texture = "default_dirt.png",
  29. makes_footstep_sound = true,
  30. sounds = {
  31. random = "mobs_dirtmonster",
  32. },
  33. view_range = 15,
  34. walk_velocity = 1,
  35. run_velocity = 3,
  36. jump = true,
  37. drops = {
  38. {name = "default:dirt", chance = 1, min = 0, max = 2},
  39. },
  40. water_damage = 1,
  41. lava_damage = 5,
  42. light_damage = 3,
  43. fear_height = 4,
  44. animation = {
  45. speed_normal = 15,
  46. speed_run = 15,
  47. stand_start = 0,
  48. stand_end = 14,
  49. walk_start = 15,
  50. walk_end = 38,
  51. run_start = 40,
  52. run_end = 63,
  53. punch_start = 40,
  54. punch_end = 63,
  55. },
  56. -- check surrounding nodes and spawn a specific monster
  57. on_spawn = function(self)
  58. local pos = self.object:get_pos() ; pos.y = pos.y - 1
  59. local tmp
  60. for n = 1, #dirt_types do
  61. tmp = dirt_types[n]
  62. if minetest.find_node_near(pos, 1, tmp.nodes) then
  63. self.base_texture = tmp.skins
  64. self.object:set_properties({textures = tmp.skins})
  65. if tmp.drops then
  66. self.drops = tmp.drops
  67. end
  68. return true
  69. end
  70. end
  71. return true -- run only once, false/nil runs every activation
  72. end
  73. })
  74. if not mobs.custom_spawn_monster then
  75. mobs:spawn({
  76. name = "mobs_monster:dirt_monster",
  77. nodes = {"default:dirt_with_grass", "ethereal:gray_dirt", "ethereal:dry_dirt"},
  78. min_light = 0,
  79. max_light = 7,
  80. chance = 6000,
  81. active_object_count = 2,
  82. min_height = 0,
  83. day_toggle = false,
  84. })
  85. end
  86. mobs:register_egg("mobs_monster:dirt_monster", S("Dirt Monster"), "default_dirt.png", 1)
  87. mobs:alias_mob("mobs:dirt_monster", "mobs_monster:dirt_monster") -- compatibility