cavefreak.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. local cavefreak_sounds = {
  2. attack = 'fantasy_cavefreak_punch',
  3. death = 'fantasy_cavefreak_die',
  4. distance = 7,
  5. }
  6. function fire_splash(pos)
  7. minetest.sound_play('fantasy_fire_start',{pos = pos, max_hear_distance = 10, gain = 0.5})
  8. for z = -1,1 do
  9. for y = -1,0 do
  10. for x = -1,1 do
  11. local p = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
  12. local nn = minetest.get_node(p).name
  13. if nn == 'air' then
  14. minetest.set_node(p, {name='fire:basic_flame'})
  15. end
  16. end
  17. end
  18. end
  19. end
  20. mobs:register_mob('fantasy_mobs:cavefreak_fire', {
  21. description = 'Cavefreak',
  22. type = 'monster',
  23. damage = 15,
  24. damage_max = 20,
  25. damage_chance = 100,
  26. attack_type = 'shoot',
  27. shoot_interval = 2,
  28. arrow = 'fantasy_mobs:cavefreak_fire_arrow',
  29. shoot_offset = 1,
  30. hp_min = 100,
  31. hp_max = 200,
  32. armor = 75,
  33. collisionbox = {-0.4, -0.5, -0.4, 0.4, .5, 0.4},
  34. visual = 'mesh',
  35. mesh = 'fantasy_cavefreak.b3d',
  36. textures = {
  37. {'fantasy_cavefreak1.png^fantasy_cavefreak_fire.png'},
  38. {'fantasy_cavefreak2.png^fantasy_cavefreak_fire.png'},
  39. {'fantasy_cavefreak3.png^fantasy_cavefreak_fire.png'},
  40. },
  41. rotate = 180,
  42. visual_size = {x = 9, y = 9},
  43. sounds = cavefreak_sounds,
  44. walk_velocity = 2,
  45. run_velocity = 4,
  46. jump = true,
  47. water_damage = 5,
  48. lava_damage = -5,
  49. light_damage = 1,
  50. reach = 2,
  51. view_range = 8,
  52. drops = {
  53. {name = 'scorpion:shell', chance = 2, min = 1, max = 6},
  54. {name = 'epic:huntite', chance = 10, min = 0, max = 15},
  55. {name = 'tnt:gunpowder', chance = 3, min = 4, max = 20},
  56. {name = 'maxhp:lifeforce4', chance = 20, min = 0, max = 2},
  57. {name = 'fantasy_mobs:cave_freak_sketch', chance = 10, min = 1, max = 1}
  58. },
  59. animation = {
  60. die_start = 140,
  61. die_end = 180,
  62. die_loop = false,
  63. stand_start = 0,
  64. stand_end = 60,
  65. walk_start = 65,
  66. walk_end = 135,
  67. punch_start = 185,
  68. punch_end = 240,
  69. shoot_start = 245,
  70. shoot_end = 290,
  71. },
  72. makes_footstep_sound = true,
  73. })
  74. mobs:register_mob('fantasy_mobs:cavefreak_slash', {
  75. description = 'Cavefreak',
  76. type = 'monster',
  77. damage = 20,
  78. damage_max = 25,
  79. damage_chance = 150,
  80. attack_type = 'dogfight',
  81. hp_min = 100,
  82. hp_max = 200,
  83. armor = 75,
  84. collisionbox = {-0.4, -0.5, -0.4, 0.4, .5, 0.4},
  85. visual = 'mesh',
  86. mesh = 'fantasy_cavefreak.b3d',
  87. textures = {
  88. {'fantasy_cavefreak1.png'},
  89. {'fantasy_cavefreak2.png'},
  90. {'fantasy_cavefreak3.png'},
  91. },
  92. rotate = 180,
  93. visual_size = {x = 9, y = 9},
  94. sounds = cavefreak_sounds,
  95. walk_velocity = 2,
  96. run_velocity = 4,
  97. jump = true,
  98. water_damage = 5,
  99. lava_damage = -5,
  100. light_damage = 1,
  101. reach = 3,
  102. view_range = 8,
  103. drops = {
  104. {name = 'scorpion:shell', chance = 2, min = 1, max = 6},
  105. {name = 'epic:huntite', chance = 2, min = 0 , max = 1},
  106. {name = 'maxhp:lifeforce4', chance = 20, min = 0, max = 2},
  107. {name = 'fantasy_mobs:cave_freak_sketch', chance = 10, min = 1, max = 1}
  108. },
  109. animation = {
  110. die_start = 140,
  111. die_end = 180,
  112. die_loop = false,
  113. stand_start = 0,
  114. stand_end = 60,
  115. walk_start = 65,
  116. walk_end = 135,
  117. punch_start = 185,
  118. punch_end = 240,
  119. shoot_start = 245,
  120. shoot_end = 290,
  121. },
  122. makes_footstep_sound = true,
  123. })
  124. mobs:register_arrow('fantasy_mobs:cavefreak_fire_arrow', {
  125. visual = 'sprite',
  126. visual_size = {x = .5, y = .5},
  127. textures = {'fantasy_goblins_blood.png'},
  128. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  129. velocity = 7,
  130. on_activate = function(self, staticdata, dtime_s)
  131. self.object:set_armor_groups({immortal = 1, fleshy = 100})
  132. end,
  133. hit_player = function(self, player)
  134. local pos = player:get_pos()
  135. local current_player_pos = {
  136. x = math.floor(pos.x + 0.5),
  137. y = math.floor(pos.y + 1.2),
  138. z = math.floor(pos.z + 0.5)
  139. }
  140. fire_splash(current_player_pos)
  141. end,
  142. hit_mob = function(self, player)
  143. local pos = player:get_pos()
  144. local current_player_pos = {
  145. x = math.floor(pos.x + 0.5),
  146. y = math.floor(pos.y + 1.2),
  147. z = math.floor(pos.z + 0.5)
  148. }
  149. fire_splash(current_player_pos)
  150. end,
  151. hit_node = function(self, pos, node)
  152. fire_splash(pos)
  153. end
  154. })
  155. mobs:spawn({
  156. name = 'fantasy_mobs:cavefreak_fire',
  157. nodes = {'caverealms:stone_with_lichen', 'caverealms:stone_with_moss', 'caverealms:stone_with_algae'},
  158. max_light = 10,
  159. min_height = -21900,
  160. max_height = -500,
  161. interval = 213,
  162. chance = 3200,
  163. active_object_count = 1,
  164. })
  165. mobs:spawn({
  166. name = 'fantasy_mobs:cavefreak_slash',
  167. nodes = {'caverealms:stone_with_lichen', 'caverealms:stone_with_moss', 'caverealms:stone_with_algae'},
  168. max_light = 10,
  169. min_height = -21900,
  170. max_height = -500,
  171. interval = 132,
  172. chance = 1000,
  173. active_object_count = 4,
  174. })