init.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. -- custom particle effects
  2. local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
  3. radius = radius or 2
  4. min_size = min_size or 0.5
  5. max_size = max_size or 1
  6. gravity = gravity or -10
  7. glow = glow or 0
  8. minetest.add_particlespawner({
  9. amount = amount,
  10. time = 0.25,
  11. minpos = pos,
  12. maxpos = pos,
  13. minvel = {x = -radius, y = -radius, z = -radius},
  14. maxvel = {x = radius, y = radius, z = radius},
  15. minacc = {x = 0, y = gravity, z = 0},
  16. maxacc = {x = -20, y = gravity, z = 15},
  17. minexptime = 0.1,
  18. maxexptime = 1,
  19. minsize = min_size,
  20. maxsize = max_size,
  21. texture = texture,
  22. glow = glow,
  23. })
  24. end
  25. -- Sand Monster by PilzAdam
  26. mobs.register_mob("sandman:sandman", {
  27. description = "Sand Native",
  28. type = "monster",
  29. passive = false,
  30. attack_type = "dogfight",
  31. group_attack = true,
  32. -- Require at least steel sword to get any drops.
  33. armor_level = 1,
  34. despawns_in_dark_caves = true,
  35. daytime_despawn = true,
  36. reach = 2,
  37. damage = 1,
  38. damage_min = 0,
  39. damage_max = 3,
  40. hp_min = 8,
  41. hp_max = 30,
  42. armor = 100,
  43. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  44. visual = "mesh",
  45. mesh = "mobs_sand_monster.b3d",
  46. textures = {
  47. {"mobs_sand_monster.png"},
  48. },
  49. blood_texture = "default_desert_sand.png",
  50. makes_footstep_sound = true,
  51. sounds = {
  52. random = "mobs_sand_monster",
  53. },
  54. walk_velocity = 1.5,
  55. run_velocity = 4,
  56. view_range = 20, --15
  57. jump = true,
  58. floats = 0,
  59. drops = {
  60. {name = "bones:bones_type2", chance = 2, min = 1, max = 1},
  61. {name = "default:desert_sandstone", chance = 4, min = 1, max = 2},
  62. {name = "default:dry_shrub", chance = 2, min = 1, max = 1},
  63. },
  64. water_damage = 3,
  65. lava_damage = 4,
  66. light_damage = 1,
  67. fear_height = 4,
  68. animation = {
  69. speed_normal = 15,
  70. speed_run = 15,
  71. stand_start = 0,
  72. stand_end = 39,
  73. walk_start = 41,
  74. walk_end = 72,
  75. run_start = 74,
  76. run_end = 105,
  77. punch_start = 74,
  78. punch_end = 105,
  79. },
  80. immune_to = {
  81. {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
  82. {"default:shovel_stone", 3},
  83. {"default:shovel_bronze", 4},
  84. {"default:shovel_steel", 4},
  85. {"default:shovel_mese", 5},
  86. {"default:shovel_diamond", 7},
  87. },
  88. on_die = function(self, pos)
  89. pos.y = pos.y + 0.5
  90. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  91. pos.y = pos.y + 0.25
  92. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  93. end,
  94. on_despawn = function(self)
  95. local pos = self.object:get_pos()
  96. ambiance.sound_play("teleport", pos, 1.0, 20)
  97. preload_tp.spawn_particles(pos)
  98. -- Note: cannot call object:remove()!
  99. --self.object:remove()
  100. -- We must do this instead: mark object for removal by the mob API.
  101. self.mkrm = true
  102. end,
  103. })
  104. mobs.register_egg("sandman:sandman", "Jarkati Sand Native", "default_desert_sand.png", 1)
  105. -- Dirt Monster by PilzAdam
  106. mobs.register_mob("sandman:stoneman", {
  107. description = "Dirty Cave Dweller",
  108. type = "monster",
  109. passive = false,
  110. attack_type = "dogfight",
  111. group_attack = true,
  112. reach = 2,
  113. damage = 2,
  114. damage_min = 2,
  115. damage_max = 3,
  116. hp_min = 30,
  117. hp_max = 60,
  118. armor = 100,
  119. -- Require at least steel sword to get any drops.
  120. armor_level = 1,
  121. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  122. visual = "mesh",
  123. mesh = "mobs_stone_monster.b3d",
  124. textures = {
  125. {"mobs_dirt_monster.png"},
  126. },
  127. blood_texture = "default_dirt.png",
  128. makes_footstep_sound = true,
  129. sounds = {
  130. random = "mobs_dirtmonster",
  131. },
  132. view_range = 20,
  133. walk_velocity = 1,
  134. run_velocity = 3,
  135. jump = true,
  136. drops = {
  137. {name = "default:silver_sandstone", chance = 2, min = 0, max = 3},
  138. {name = "default:desert_cobble", chance = 3, min = 0, max = 2},
  139. },
  140. water_damage = 1,
  141. lava_damage = 5,
  142. light_damage = 3,
  143. fear_height = 4,
  144. animation = {
  145. speed_normal = 15,
  146. speed_run = 15,
  147. stand_start = 0,
  148. stand_end = 14,
  149. walk_start = 15,
  150. walk_end = 38,
  151. run_start = 40,
  152. run_end = 63,
  153. punch_start = 40,
  154. punch_end = 63,
  155. },
  156. })
  157. mobs.register_egg("sandman:stoneman", "Jarkati Cave Dweller", "default_dirt.png", 1)