cavefreak.lua 4.8 KB

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