fairy.lua 3.1 KB

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