init.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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*500,
  38. damage_min = 0*500,
  39. damage_max = 3*500,
  40. damage_group = "crumbly",
  41. hp_min = 8*500,
  42. hp_max = 30*500,
  43. armor = 100,
  44. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  45. visual = "mesh",
  46. mesh = "mobs_sand_monster.b3d",
  47. textures = {
  48. {"mobs_sand_monster.png"},
  49. },
  50. blood_texture = "default_desert_sand.png",
  51. makes_footstep_sound = true,
  52. sounds = {
  53. random = "mobs_sand_monster",
  54. },
  55. walk_velocity = 1.5,
  56. run_velocity = 4,
  57. view_range = 20, --15
  58. jump = true,
  59. floats = 0,
  60. drops = {
  61. {name = "bones:bones_type2", chance = 2, min = 1, max = 1},
  62. {name = "default:desert_sandstone", chance = 4, min = 1, max = 2},
  63. {name = "default:dry_shrub", chance = 4, min = 1, max = 1},
  64. {name = "default:dry_shrub2", chance = 4, min = 1, max = 1},
  65. },
  66. water_damage = 3*500,
  67. lava_damage = 4*500,
  68. light_damage = 1*500,
  69. fear_height = 4,
  70. animation = {
  71. speed_normal = 15,
  72. speed_run = 15,
  73. stand_start = 0,
  74. stand_end = 39,
  75. walk_start = 41,
  76. walk_end = 72,
  77. run_start = 74,
  78. run_end = 105,
  79. punch_start = 74,
  80. punch_end = 105,
  81. },
  82. immune_to = {
  83. {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
  84. {"default:shovel_stone", 3},
  85. {"default:shovel_bronze", 4},
  86. {"default:shovel_steel", 4},
  87. {"default:shovel_mese", 5},
  88. {"default:shovel_diamond", 7},
  89. },
  90. on_die = function(self, pos)
  91. pos.y = pos.y + 0.5
  92. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  93. pos.y = pos.y + 0.25
  94. effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
  95. end,
  96. on_despawn = function(self)
  97. local pos = self.object:get_pos()
  98. ambiance.sound_play("teleport", pos, 1.0, 20)
  99. preload_tp.spawn_particles(pos)
  100. -- Note: cannot call object:remove()!
  101. --self.object:remove()
  102. -- We must do this instead: mark object for removal by the mob API.
  103. self.mkrm = true
  104. end,
  105. })
  106. mobs.register_egg("sandman:sandman", "Jarkati Sand Native", "default_desert_sand.png", 1)
  107. -- Dirt Monster by PilzAdam
  108. mobs.register_mob("sandman:stoneman", {
  109. description = "Dirty Cave Dweller",
  110. type = "monster",
  111. passive = false,
  112. attack_type = "dogfight",
  113. group_attack = true,
  114. reach = 2,
  115. pathfinding = 1,
  116. damage = 2*500,
  117. damage_min = 2*500,
  118. damage_max = 3*500,
  119. damage_group = "crumbly",
  120. hp_min = 30*500,
  121. hp_max = 60*500,
  122. armor = 100,
  123. -- Require at least steel sword to get any drops.
  124. armor_level = 1,
  125. collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
  126. visual = "mesh",
  127. mesh = "mobs_stone_monster.b3d",
  128. textures = {
  129. {"mobs_dirt_monster.png"},
  130. },
  131. blood_texture = "default_dirt.png",
  132. makes_footstep_sound = true,
  133. sounds = {
  134. random = "mobs_dirtmonster",
  135. },
  136. view_range = 20,
  137. walk_velocity = 1,
  138. run_velocity = 3,
  139. jump = true,
  140. drops = {
  141. {name = "default:silver_sandstone", chance = 2, min = 0, max = 3},
  142. {name = "default:desert_cobble", chance = 3, min = 0, max = 2},
  143. },
  144. water_damage = 1*500,
  145. lava_damage = 5*500,
  146. light_damage = 3*500,
  147. fear_height = 4,
  148. animation = {
  149. speed_normal = 15,
  150. speed_run = 15,
  151. stand_start = 0,
  152. stand_end = 14,
  153. walk_start = 15,
  154. walk_end = 38,
  155. run_start = 40,
  156. run_end = 63,
  157. punch_start = 40,
  158. punch_end = 63,
  159. },
  160. hunt_chance = 5,
  161. })
  162. mobs.register_egg("sandman:stoneman", "Jarkati Cave Dweller", "default_dirt.png", 1)