oerkki.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. -- That flying thing. NOT supposed to be an oerkki, but not changing name now
  2. -- due to long usage.
  3. mobs.register_mob("oerkki:oerkki", {
  4. type = "monster",
  5. description = "Flying Menace",
  6. passive = false,
  7. attack_type = "dogfight",
  8. reach = 2,
  9. punch_reach = 3,
  10. damage = 3,
  11. hp_min = 8,
  12. hp_max = 34,
  13. armor = 100,
  14. armor_level = 2,
  15. --collisionbox = {-0.3, -1, -0.3, 0.3, 0.7, 0.3},
  16. collisionbox = {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4},
  17. visual = "mesh",
  18. mesh = "mobs_oerkki2.b3d",
  19. textures = {
  20. {"mobs_oerkki3.png"},
  21. },
  22. rotate = 270,
  23. makes_footstep_sound = false,
  24. sounds = {
  25. random = "mobs_oerkki",
  26. },
  27. walk_velocity = 2,
  28. run_velocity = 5,
  29. view_range = 15,
  30. jump = false,
  31. fly = true,
  32. fly_in = "air",
  33. drops = {
  34. {name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
  35. {name = "mobs:leather", chance = 2, min = 1, max = 1},
  36. },
  37. water_damage = 1,
  38. lava_damage = 100,
  39. light_damage = 1,
  40. fear_height = 0,
  41. animation = {
  42. stand_start = 1,
  43. stand_end = 29,
  44. walk_start = 1,
  45. walk_end = 29,
  46. run_start = 1,
  47. run_end = 29,
  48. punch_start = 30,
  49. punch_end = 60,
  50. speed_normal = 15,
  51. speed_run = 15,
  52. },
  53. replace_rate = 10,
  54. replace_what = {
  55. "torches:torch_floor",
  56. "torches:torch_wall",
  57. "torches:torch_ceiling",
  58. "torches:kalite_torch_floor",
  59. "torches:kalite_torch_wall",
  60. "torches:kalite_torch_ceiling",
  61. },
  62. replace_with = "air",
  63. replace_offset = 0,
  64. replace_range = 2,
  65. immune_to = {
  66. {"default:gold_lump", -10}, -- heals by 10 points
  67. },
  68. -- Throw player off things.
  69. punch_target = function(self, object, attack)
  70. if attack and attack:is_player() then
  71. local p1 = object:get_pos()
  72. local p2 = attack:get_pos()
  73. p1.y = p2.y
  74. local vel = vector.subtract(p2, p1)
  75. -- Quick hack to fix problems with null vectors.
  76. if vector.length(vel) < 0.01 then
  77. vel.x = 1
  78. end
  79. vel = vector.normalize(vel)
  80. vel = vector.add(vel, {x=0, y=0.5, z=0})
  81. vel = vector.multiply(vel, 10)
  82. -- The player needs to be kicked up 1 node manually, because otherwise
  83. -- the collision box of the menace prevents them from being thrown, very
  84. -- often.
  85. p2.y = p2.y + 1
  86. p1.y = p1.y - 1
  87. object:set_pos(p1)
  88. attack:set_pos(p2)
  89. minetest.after(0.3, function()
  90. attack:add_player_velocity(vel)
  91. end)
  92. end
  93. end,
  94. })
  95. mobs.register_egg("oerkki:oerkki", "Oerkki", "default_obsidian.png", 1)
  96. mobs.alias_mob("mobs_monster:oerkki2", "oerkki:oerkki")