obsidianmonster.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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*500,
  7. attack_type = "shoot",
  8. shoot_interval = 1.0,
  9. arrow = "obsidianmonster:arrow",
  10. shoot_offset = 2,
  11. hp_min = 10*500,
  12. hp_max = 25*500,
  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. fall_damage = 0,
  32. fall_speed = -6,
  33. stepheight = 2.1,
  34. drops = {
  35. {name = "default:obsidian", chance = 2, min = 1, max = 6},
  36. {name = "default:obsidian_shard", chance = 2, min = 1, max = 9},
  37. },
  38. water_damage = 1*500,
  39. lava_damage = 1*500,
  40. light_damage = 0,
  41. animation = {
  42. speed_normal = 15,
  43. speed_run = 15,
  44. stand_start = 0,
  45. stand_end = 14,
  46. walk_start = 15,
  47. walk_end = 38,
  48. run_start = 40,
  49. run_end = 63,
  50. punch_start = 40,
  51. punch_end = 63,
  52. },
  53. glow = 5,
  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. armor.notify_punch_reason({reason="arrow"})
  65. player:punch(self.object, 1.0, {
  66. full_punch_interval = 1.0,
  67. damage_groups = {snappy=1*500, arrow=1*500},
  68. }, nil)
  69. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 30)
  70. end,
  71. hit_mob = function(self, player)
  72. player:punch(self.object, 1.0, {
  73. full_punch_interval = 1.0,
  74. damage_groups = {snappy=1*500, arrow=1*500},
  75. }, nil)
  76. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 30)
  77. end,
  78. hit_node = function(self, pos, node)
  79. pos = vector_round(pos)
  80. if minetest.test_protection(pos, "") then
  81. return
  82. end
  83. local realnode = minetest.get_node(pos)
  84. -- Do not destroy bones.
  85. if realnode.name == "bones:bones" or realnode.name == "ignore" then
  86. return
  87. end
  88. minetest.add_node(pos, {name="fire:basic_flame"})
  89. end
  90. })