obsidianmonster.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. 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,
  39. lava_damage = 1,
  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. })
  54. mobs.register_egg("obsidianmonster:obsidianmonster", "Obsidian Monster", "default_obsidian.png", 1)
  55. mobs.alias_mob("mobs:mese_monster", "obsidianmonster:obsidianmonster")
  56. mobs.alias_mob("mobs_monster:mese_monster", "obsidianmonster:obsidianmonster")
  57. mobs.register_arrow("obsidianmonster:arrow", {
  58. visual = "sprite",
  59. visual_size = {x = 0.5, y = 0.5},
  60. textures = {"default_obsidian_shard.png"},
  61. velocity = 10,
  62. hit_player = function(self, player)
  63. player:punch(self.object, 1.0, {
  64. full_punch_interval = 1.0,
  65. damage_groups = {fleshy = 2},
  66. }, nil)
  67. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 20)
  68. end,
  69. hit_mob = function(self, player)
  70. player:punch(self.object, 1.0, {
  71. full_punch_interval = 1.0,
  72. damage_groups = {fleshy = 2},
  73. }, nil)
  74. ambiance.sound_play("default_punch", player:get_pos(), 1.0, 20)
  75. end,
  76. hit_node = function(self, pos, node)
  77. pos = vector_round(pos)
  78. if minetest.test_protection(pos, "") then
  79. return
  80. end
  81. local realnode = minetest.get_node(pos)
  82. -- Do not destroy bones.
  83. if realnode.name == "bones:bones" or realnode.name == "ignore" then
  84. return
  85. end
  86. minetest.add_node(pos, {name="fire:basic_flame"})
  87. end
  88. })