sand_monster.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. local S = mobs.intllib
  2. -- custom particle effects
  3. local effect = function(
  4. pos, amount, texture, min_size, max_size, radius, gravity, glow)
  5. radius = radius or 2
  6. min_size = min_size or 0.5
  7. max_size = max_size or 1
  8. gravity = gravity or -10
  9. glow = glow or 0
  10. minetest.add_particlespawner({
  11. amount = amount,
  12. time = 0.25,
  13. minpos = pos,
  14. maxpos = pos,
  15. minvel = {x = -radius, y = -radius, z = -radius},
  16. maxvel = {x = radius, y = radius, z = radius},
  17. minacc = {x = 0, y = gravity, z = 0},
  18. maxacc = {x = -20, y = gravity, z = 15},
  19. minexptime = 0.1,
  20. maxexptime = 1,
  21. minsize = min_size,
  22. maxsize = max_size,
  23. texture = texture,
  24. glow = glow,
  25. })
  26. end
  27. -- Sand Monster by PilzAdam
  28. mobs:register_mob("mobs_monster:sand_monster", {
  29. type = "monster",
  30. passive = false,
  31. attack_type = "dogfight",
  32. pathfinding = true,
  33. --specific_attack = {"player", "mobs_npc:npc"},
  34. reach = 2,
  35. damage = 1,
  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. },
  45. blood_texture = "default_desert_sand.png",
  46. makes_footstep_sound = true,
  47. sounds = {
  48. random = "mobs_sandmonster",
  49. },
  50. walk_velocity = 1.5,
  51. run_velocity = 4,
  52. view_range = 8, --15
  53. jump = true,
  54. floats = 0,
  55. drops = {
  56. {name = "default:desert_sand", chance = 1, min = 3, max = 5},
  57. },
  58. water_damage = 3,
  59. lava_damage = 4,
  60. light_damage = 0,
  61. fear_height = 4,
  62. animation = {
  63. speed_normal = 15,
  64. speed_run = 15,
  65. stand_start = 0,
  66. stand_end = 39,
  67. walk_start = 41,
  68. walk_end = 72,
  69. run_start = 74,
  70. run_end = 105,
  71. punch_start = 74,
  72. punch_end = 105,
  73. },
  74. immune_to = {
  75. {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
  76. {"default:shovel_stone", 3},
  77. {"default:shovel_bronze", 4},
  78. {"default:shovel_steel", 4},
  79. {"default:shovel_mese", 5},
  80. {"default:shovel_diamond", 7},
  81. },
  82. --[[
  83. custom_attack = function(self, p)
  84. local pos = self.object:get_pos()
  85. minetest.add_item(pos, "default:sand")
  86. end,
  87. ]]
  88. on_die = function(self, pos)
  89. pos.y = pos.y + 0.5
  90. mobs:effect(pos, 30, "mobs_sand_particles.png", .1, 2, 3, 5)
  91. pos.y = pos.y + 0.25
  92. mobs:effect(pos, 30, "mobs_sand_particles.png", .1, 2, 3, 5)
  93. end,
  94. --[[
  95. on_rightclick = function(self, clicker)
  96. local tool = clicker:get_wielded_item()
  97. local name = clicker:get_player_name()
  98. if tool:get_name() == "default:sand" then
  99. self.owner = name
  100. self.type = "npc"
  101. mobs:force_capture(self, clicker)
  102. end
  103. end,
  104. ]]
  105. })
  106. mobs:spawn({
  107. name = "mobs_monster:sand_monster",
  108. nodes = {"default:desert_sand"},
  109. chance = 7000,
  110. active_object_count = 2,
  111. min_height = 0,
  112. })
  113. mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"), "default_desert_sand.png", 1)
  114. mobs:alias_mob("mobs:sand_monster", "mobs_monster:sand_monster") -- compatibility