fairy.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. drops = {
  2. 'stations:scroll_teleport', 'stations:scroll_healing', 'stations:scroll_bloodstone_powder',
  3. 'stations:scroll_anti_fire', 'stations:scroll_chitin', 'stations:scroll_sulfur_dust',
  4. 'stations:scroll_gunpowder', 'stations:scroll_poison', 'epic:deed',
  5. }
  6. mobs:register_mob('fantasy_mobs:fairy', {
  7. description = 'Fairy',
  8. type = 'npc',
  9. passive = false,
  10. damage = 200,
  11. attack_monsters = true,
  12. attack_type = 'dogfight',
  13. hp_min = 400,
  14. hp_max = 500,
  15. armor = 5,
  16. collisionbox = {-.2,.7,-.2, .2,1.1,.2},
  17. visual = 'mesh',
  18. mesh = 'fantasy_fairy.b3d',
  19. textures = {
  20. {'fantasy_fairy.png'},
  21. },
  22. visual_size = {x = 4, y = 4},
  23. glow = 14,
  24. fly = true,
  25. fly_in = 'air',
  26. stand_chance = 0,
  27. stay_near = 'group:flower',
  28. replace_rate = 1,
  29. replace_what = {'group:flower'},
  30. replace_with = 'fantasy_mobs:fairy_mushroom',
  31. walk_velocity = .25,
  32. run_velocity = .5,
  33. water_damage = 100,
  34. lava_damage = 200,
  35. light_damage = 200,
  36. view_range = 5,
  37. animation = {
  38. fly_start = 0,
  39. fly_end = 60,
  40. stand_start = 0,
  41. stand_end = 60,
  42. punch_start = 0,
  43. punch_end = 60,
  44. },
  45. on_rightclick = function(self, clicker)
  46. local item = clicker:get_wielded_item()
  47. local pos = self.object:get_pos()
  48. local player_name = clicker:get_player_name()
  49. if item:get_name() == 'fantasy_mobs:fairy_mushroom' then
  50. minetest.add_item(pos, {name = drops[math.random(1, #drops)]})
  51. item:take_item(1)
  52. clicker:set_wielded_item(item)
  53. else
  54. minetest.chat_send_player(player_name, 'you fool, die!')
  55. clicker:set_hp(-50)
  56. end
  57. end,
  58. })
  59. mobs:spawn({
  60. name = 'fantasy_mobs:fairy',
  61. nodes = {'group:flower'},
  62. neighbors = 'default:dirt_with_grass',
  63. max_light = 8,
  64. min_height = -3,
  65. max_height = 150,
  66. interval = 30,
  67. chance = 200,
  68. active_object_count = 1,
  69. })
  70. --nodes
  71. minetest.register_node('fantasy_mobs:fairy_mushroom', {
  72. description = 'Fairy mushroom',
  73. drawtype = 'plantlike',
  74. tiles = {'fantasy_mushrooms.png'},
  75. groups = { snappy=3, flammable=2, flower=1, flora=1, attached_node=1, not_in_creative_inventory=1},
  76. sunlight_propagates = true,
  77. waving = 1,
  78. walkable = false,
  79. pointable = true,
  80. diggable = true,
  81. buildable_to = true,
  82. paramtype = 'light',
  83. light_source = 4,
  84. sounds = default.node_sound_leaves_defaults(),
  85. selection_box = {
  86. type = 'fixed',
  87. fixed = { -0.4, -0.5, -0.4, 0.4, 0.0, 0.4 },
  88. },
  89. })
  90. minetest.register_abm({
  91. nodenames = {'fantasy_mobs:fairy_mushroom'},
  92. interval = 100,
  93. chance = 10,
  94. action = function(pos, node)
  95. minetest.remove_node(pos)
  96. end,
  97. })