obsidianmonster.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. -- Localize for performance.
  2. local vector_round = vector.round
  3. mobs.register_mob("obsidianmonster:obsidianmonster", {
  4. type = "monster",
  5. passive = false,
  6. damage = 3,
  7. attack_type = "shoot",
  8. shoot_interval = 1.0,
  9. arrow = "obsidianmonster:arrow",
  10. shoot_offset = 2,
  11. hp_min = 10,
  12. hp_max = 25,
  13. armor = 80,
  14. armor_level = 3,
  15. collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  16. visual = "mesh",
  17. mesh = "obsidianmonster_obsidianmonster.x",
  18. textures = {
  19. {"obsidianmonster_obsidianmonster.png"},
  20. },
  21. blood_texture = "default_obsidian_shard.png",
  22. makes_footstep_sound = false,
  23. sounds = {
  24. random = "obsidianmonster_obsidianmonster",
  25. },
  26. view_range = 16,
  27. walk_velocity = 0.5,
  28. run_velocity = 2,
  29. jump = false,
  30. fly = true,
  31. --jump_height = 8,
  32. fall_damage = 0,
  33. fall_speed = -6,
  34. stepheight = 2.1,
  35. drops = {
  36. {name = "default:obsidian", chance = 2, min = 1, max = 6},
  37. {name = "default:obsidian_shard", chance = 2, min = 1, max = 9},
  38. },
  39. water_damage = 1,
  40. lava_damage = 1,
  41. light_damage = 0,
  42. animation = {
  43. speed_normal = 15,
  44. speed_run = 15,
  45. stand_start = 0,
  46. stand_end = 14,
  47. walk_start = 15,
  48. walk_end = 38,
  49. run_start = 40,
  50. run_end = 63,
  51. punch_start = 40,
  52. punch_end = 63,
  53. },
  54. })
  55. mobs.register_egg("obsidianmonster:obsidianmonster", "Obsidian Monster", "default_obsidian.png", 1)
  56. mobs.alias_mob("mobs:mese_monster", "obsidianmonster:obsidianmonster")
  57. mobs.alias_mob("mobs_monster:mese_monster", "obsidianmonster:obsidianmonster")
  58. mobs.register_arrow("obsidianmonster:arrow", {
  59. visual = "sprite",
  60. visual_size = {x = 0.5, y = 0.5},
  61. textures = {"default_obsidian_shard.png"},
  62. velocity = 10,
  63. hit_player = function(self, player)
  64. player:punch(self.object, 1.0, {
  65. full_punch_interval = 1.0,
  66. damage_groups = {fleshy = 2},
  67. }, nil)
  68. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 20)
  69. end,
  70. hit_mob = function(self, player)
  71. player:punch(self.object, 1.0, {
  72. full_punch_interval = 1.0,
  73. damage_groups = {fleshy = 2},
  74. }, nil)
  75. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 20)
  76. end,
  77. hit_node = function(self, pos, node)
  78. pos = vector_round(pos)
  79. if minetest.test_protection(pos, "") then
  80. return
  81. end
  82. local realnode = minetest.get_node(pos)
  83. -- Do not destroy bones.
  84. if realnode.name == "bones:bones" or realnode.name == "ignore" then
  85. return
  86. end
  87. minetest.add_node(pos, {name="fire:basic_flame"})
  88. end
  89. })