sand_monster.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. local S = mobs.intllib_monster
  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. --specific_attack = {"player", "mobs_npc:npc"},
  33. --ignore_invisibility = true,
  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. {"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,
  54. jump = true,
  55. floats = 0,
  56. drops = {
  57. {name = "default:desert_sand", chance = 1, min = 3, max = 5}
  58. },
  59. water_damage = 3,
  60. lava_damage = 4,
  61. light_damage = 0,
  62. fear_height = 4,
  63. animation = {
  64. speed_normal = 15,
  65. speed_run = 15,
  66. stand_start = 0,
  67. stand_end = 39,
  68. walk_start = 41,
  69. walk_end = 72,
  70. run_start = 74,
  71. run_end = 105,
  72. punch_start = 74,
  73. punch_end = 105
  74. },
  75. immune_to = {
  76. {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
  77. {"default:shovel_stone", 3},
  78. {"default:shovel_bronze", 4},
  79. {"default:shovel_steel", 4},
  80. {"default:shovel_mese", 5},
  81. {"default:shovel_diamond", 7}
  82. },
  83. --[[
  84. custom_attack = function(self, p)
  85. local pos = self.object:get_pos()
  86. minetest.add_item(pos, "default:sand")
  87. end,
  88. ]]
  89. on_die = function(self, pos)
  90. pos.y = pos.y + 0.5
  91. mobs:effect(pos, 30, "mobs_sand_particles.png", .1, 2, 3, 5)
  92. pos.y = pos.y + 0.25
  93. mobs:effect(pos, 30, "mobs_sand_particles.png", .1, 2, 3, 5)
  94. end,
  95. --[[
  96. on_rightclick = function(self, clicker)
  97. local tool = clicker:get_wielded_item()
  98. local name = clicker:get_player_name()
  99. if tool:get_name() == "default:sand" then
  100. self.owner = name
  101. self.type = "npc"
  102. mobs:force_capture(self, clicker)
  103. end
  104. end,
  105. ]]
  106. })
  107. if not mobs.custom_spawn_monster then
  108. mobs:spawn({
  109. name = "mobs_monster:sand_monster",
  110. nodes = {"default:desert_sand"},
  111. chance = 7000,
  112. active_object_count = 2,
  113. min_height = 0
  114. })
  115. end
  116. mobs:register_egg("mobs_monster:sand_monster", S("Sand Monster"),
  117. "default_desert_sand.png", 1)
  118. mobs:alias_mob("mobs:sand_monster", "mobs_monster:sand_monster") -- compatibility