init.lua 4.0 KB

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