init.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --Register Boomer with Mobs_Redo API, code based off of Mobs_MC under WTFPL.
  2. mobs:register_mob("mobs_boomer:boomer", {
  3. type = "monster",
  4. hp_min = 20,
  5. hp_max = 20,
  6. collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
  7. pathfinding = 1,
  8. visual = "mesh",
  9. mesh = "mobs_character.b3d",
  10. textures = {
  11. {"mobs_boomer.png"},
  12. },
  13. sounds = {
  14. attack = "tnt_ignite",
  15. --TODO: death = "",
  16. --TODO: damage = "",
  17. fuse = "tnt_ignite",
  18. explode = "tnt_explode",
  19. distance = 16,
  20. },
  21. makes_footstep_sound = true,
  22. walk_velocity = 1.05,
  23. run_velocity = 2.1,
  24. attack_type = "explode",
  25. explosion_radius = 3,
  26. reach = 2,
  27. explosion_damage_radius = 7,
  28. explosion_timer = 2,
  29. allow_fuse_reset = true,
  30. stop_to_explode = true,
  31. -- Force-ignite boomer with flint and steel and explode after 1.5 seconds.
  32. on_rightclick = function(self, clicker)
  33. if self._forced_explosion_countdown_timer ~= nil then
  34. return
  35. end
  36. local item = clicker:get_wielded_item()
  37. if item:get_name() == "fire:flint_and_steel" then
  38. if not minetest.settings:get_bool("creative_mode") then
  39. -- Wear tool
  40. local wdef = item:get_definition()
  41. item:add_wear(1000)
  42. -- Tool break sound
  43. if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
  44. minetest.sound_play(wdef.sound.breaks, {pos = clicker:getpos(), gain = 0.5})
  45. end
  46. clicker:set_wielded_item(item)
  47. end
  48. self._forced_explosion_countdown_timer = self.explosion_timer
  49. minetest.sound_play(self.sounds.attack, {pos = self.object:getpos(), gain = 1, max_hear_distance = 16})
  50. end
  51. end,
  52. do_custom = function(self, dtime)
  53. if self._forced_explosion_countdown_timer ~= nil then
  54. self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
  55. if self._forced_explosion_countdown_timer <= 0 then
  56. mobs:explosion(self.object:getpos(), self.explosion_radius, 0, 1, self.sounds.explode)
  57. self.object:remove()
  58. end
  59. end
  60. end,
  61. maxdrops = 2,
  62. drops = {
  63. {name = "tnt:gunpowder",
  64. chance = 1,
  65. min = 0,
  66. max = 2,},
  67. },
  68. animation = {
  69. speed_normal = 30,
  70. speed_run = 30,
  71. stand_start = 0,
  72. stand_end = 79,
  73. walk_start = 168,
  74. walk_end = 187,
  75. run_start = 168,
  76. run_end = 187,
  77. punch_start = 0,
  78. punch_end = 79,
  79. },
  80. floats = 1,
  81. fear_height = 4,
  82. water_damage = 1,
  83. lava_damage = 4,
  84. light_damage = 0,
  85. view_range = 16,
  86. blood_amount = 0,
  87. })
  88. -- Register Spawning attributes: spawns on solid blocks by air, anywhere in the world.
  89. mobs:spawn_specific("mobs_boomer:boomer", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air"}, 0, 7, 60, 20000, 2, -32000, 32000, false)
  90. -- Register Spawn Egg
  91. mobs:register_egg("mobs_boomer:boomer", "Boomer Spawn Egg", "wool_red.png", 1)