sand_monster.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. local S = mobs.intllib
  2. -- custom particle effects
  3. local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
  4. radius = radius or 2
  5. min_size = min_size or 0.5
  6. max_size = max_size or 1
  7. gravity = gravity or -10
  8. glow = glow or 0
  9. minetest.add_particlespawner({
  10. amount = amount,
  11. time = 0.25,
  12. minpos = pos,
  13. maxpos = pos,
  14. minvel = {x = -radius, y = -radius, z = -radius},
  15. maxvel = {x = radius, y = radius, z = radius},
  16. minacc = {x = 0, y = gravity, z = 0},
  17. maxacc = {x = -20, y = gravity, z = 15},
  18. minexptime = 0.1,
  19. maxexptime = 1,
  20. minsize = min_size,
  21. maxsize = max_size,
  22. texture = texture,
  23. glow = glow,
  24. })
  25. end
  26. -- Sand Monster by PilzAdam
  27. mobs:register_mob("mobs_monster:sand_monster", {
  28. type = "monster",
  29. passive = false,
  30. attack_type = "dogfight",
  31. pathfinding = true,
  32. reach = 2,
  33. damage = 2,
  34. damage_max = 6,
  35. damage_chance = 50,
  36. hp_min = 4,
  37. hp_max = 20,
  38. armor = 100,
  39. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  40. visual = "mesh",
  41. mesh = "mobs_sand_monster.b3d",
  42. textures = {
  43. {"mobs_sand_monster.png"},
  44. {"mobs_sand_monster2.png"}
  45. },
  46. blood_texture = "default_desert_sand.png",
  47. makes_footstep_sound = true,
  48. sounds = {
  49. random = "mobs_sandmonster",
  50. },
  51. walk_velocity = 1.5,
  52. run_velocity = 4,
  53. view_range = 8, --15
  54. jump = true,
  55. floats = 0,
  56. drops = {
  57. {name = "default:desert_sand", chance = 1, min = 3, max = 5},
  58. {name = "commoditymarket:gold_coins", chance = 9, min = 4, max = 12},
  59. },
  60. water_damage = 3,
  61. lava_damage = 4,
  62. light_damage = 0,
  63. fear_height = 4,
  64. animation = {
  65. speed_normal = 15,
  66. speed_run = 15,
  67. stand_start = 0,
  68. stand_end = 39,
  69. walk_start = 41,
  70. walk_end = 72,
  71. run_start = 74,
  72. run_end = 105,
  73. punch_start = 74,
  74. punch_end = 105,
  75. },
  76. immune_to = {
  77. {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
  78. {"default:shovel_stone", 3},
  79. {"default:shovel_bronze", 4},
  80. {"default:shovel_steel", 4},
  81. {"default:shovel_mese", 5},
  82. {"default:shovel_diamond", 7},
  83. },
  84. on_die = function(self, pos)
  85. pos.y = pos.y + 0.5
  86. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  87. pos.y = pos.y + 0.25
  88. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  89. end,
  90. })
  91. mobs:spawn({
  92. name = "mobs_monster:sand_monster",
  93. nodes = {"default:desert_sand"},
  94. chance = 7000,
  95. active_object_count = 2,
  96. min_height = 0,
  97. })
  98. mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"), "default_desert_sand.png", 1)
  99. mobs:alias_mob("mobs:sand_monster", "mobs_monster:sand_monster") -- compatibility