dustdevil.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. mobs:register_mob("mobs_flat:dustdevil", {
  2. type = "monster",
  3. passive = false,
  4. -- attack_type = "dogshoot",
  5. attack_type = "dogfight",
  6. dogshoot_switch = 1,
  7. dogshoot_count_max = 10, -- shoot for 10 seconds
  8. dogshoot_count2_max = 3, -- dogfight for 3 seconds
  9. reach = 1,
  10. shoot_interval = 2,
  11. arrow = "mobs_flat:spear",
  12. shoot_offset = 1,
  13. pathfinding = true,
  14. reach = 2,
  15. damage = 1,
  16. hp_min = 8,
  17. hp_max = 16,
  18. armor = 100,
  19. collisionbox = {-0.4, -1, -0.4, 0.4, 0.9, 0.4},
  20. visual = "upright_sprite",
  21. visual_size = {x=2, y=2},
  22. textures = {
  23. "mobs_flat_dustdevil_front.png",
  24. "mobs_flat_dustdevil_back.png",
  25. },
  26. makes_footstep_sound = false,
  27. sounds = {
  28. random = "mobs_dustdevil",
  29. },
  30. walk_velocity = 1,
  31. run_velocity = 3,
  32. view_range = 10,
  33. jump = true,
  34. drops = {},
  35. water_damage = 1,
  36. lava_damage = 4,
  37. light_damage = 0,
  38. fear_height = 4,
  39. floats = 1,
  40. })
  41. -- spear (weapon)
  42. mobs:register_arrow("mobs_flat:spear", {
  43. visual = "upright_sprite",
  44. drawtype = "side",
  45. visual_size = {x = 1, y = 1},
  46. textures = {"nodetest_spearwood.png"},
  47. velocity = 8,
  48. expire = 0.1,
  49. on_step = function(self)
  50. -- fall down
  51. local acceleration = self.object:get_acceleration()
  52. if not vector.equals(acceleration, {x = 0, y = -1, z = 0}) then
  53. self.object:set_acceleration({x = 0, y = -1, z = 0})
  54. end
  55. end,
  56. -- direct hit, no fire... just plenty of pain
  57. hit_player = function(self, player)
  58. player:punch(self.object, 1.0, {
  59. full_punch_interval = 1.0,
  60. damage_groups = {fleshy = 1},
  61. }, nil)
  62. end,
  63. hit_mob = function(self, player)
  64. player:punch(self.object, 1.0, {
  65. full_punch_interval = 1.0,
  66. damage_groups = {fleshy = 1},
  67. }, nil)
  68. end,
  69. })
  70. mobs:spawn({
  71. name = "mobs_flat:dustdevil",
  72. nodes = {"default:desert_stone"},
  73. chance = 7,
  74. })
  75. mobs:register_egg("mobs_flat:dustdevil", "Dust Devil", "default_desert_sand.png", 1)