mese_monster.lua 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. local S = mobs.intllib_monster
  2. local mese_monster_types = {
  3. -- mese_monster_red
  4. {
  5. y_min = -20,
  6. y_max = -1000,
  7. damage = 2,
  8. reach = 3,
  9. hp_min = 15,
  10. hp_max = 25,
  11. armor = 80,
  12. skins = {"mobs_mese_monster_red.png"},
  13. immune_to = {
  14. {"default:pick_wood", 0},
  15. {"default:shovel_wood", 0},
  16. {"default:axe_wood", 0},
  17. {"default:sword_wood", 0}
  18. },
  19. drops = {
  20. {name = "default:mese_crystal", chance = 15, min = 0, max = 1},
  21. {name = "default:mese_crystal_fragment", chance = 2, min = 0, max = 1}
  22. },
  23. arrow_override = function(self)
  24. self.velocity = 6
  25. self.damage = 2
  26. end
  27. },
  28. -- mese_monster_green
  29. {
  30. y_min = -1001,
  31. y_max = -2000,
  32. damage = 3,
  33. reach = 3,
  34. hp_min = 20,
  35. hp_max = 30,
  36. armor = 75,
  37. skins = {"mobs_mese_monster_green.png"},
  38. immune_to = {
  39. {"default:pick_wood", 0},
  40. {"default:shovel_wood", 0},
  41. {"default:axe_wood", 0},
  42. {"default:sword_wood", 0},
  43. {"default:pick_stone", 0},
  44. {"default:shovel_stone", 0},
  45. {"default:axe_stone", 0},
  46. {"default:sword_stone", 0}
  47. },
  48. drops = {
  49. {name = "default:mese_crystal", chance = 12, min = 0, max = 1},
  50. {name = "default:mese_crystal_fragment", chance = 1, min = 0, max = 1}
  51. },
  52. arrow_override = function(self)
  53. self.velocity = 6
  54. self.damage = 2
  55. end
  56. },
  57. -- mese_monster_blue
  58. {
  59. y_min = -2001,
  60. y_max = -3000,
  61. damage = 3,
  62. reach = 4,
  63. hp_min = 25,
  64. hp_max = 35,
  65. armor = 70,
  66. skins = {"mobs_mese_monster_blue.png"},
  67. immune_to = {
  68. {"default:pick_wood", 0},
  69. {"default:shovel_wood", 0},
  70. {"default:axe_wood", 0},
  71. {"default:sword_wood", 0},
  72. {"default:pick_stone", 0},
  73. {"default:shovel_stone", 0},
  74. {"default:axe_stone", 0},
  75. {"default:sword_stone", 0},
  76. {"default:pick_bronze", 0},
  77. {"default:shovel_bronze", 0},
  78. {"default:axe_bronze", 0},
  79. {"default:sword_bronze", 0}
  80. },
  81. drops = {
  82. {name = "default:mese", chance = 15, min = 0, max = 1},
  83. {name = "default:mese_crystal", chance = 9, min = 0, max = 2},
  84. {name = "default:mese_crystal_fragment", chance = 1, min = 0, max = 2}
  85. },
  86. arrow_override = function(self)
  87. self.velocity = 7
  88. self.damage = 3
  89. end
  90. },
  91. -- mese_monster_purple
  92. {
  93. y_min = -3000,
  94. y_max = -31000,
  95. damage = 4,
  96. reach = 5,
  97. hp_min = 30,
  98. hp_max = 40,
  99. armor = 60,
  100. skins = {"mobs_mese_monster_purple.png"},
  101. immune_to = {
  102. {"default:pick_wood", 0},
  103. {"default:shovel_wood", 0},
  104. {"default:axe_wood", 0},
  105. {"default:sword_wood", 0},
  106. {"default:pick_stone", 0},
  107. {"default:shovel_stone", 0},
  108. {"default:axe_stone", 0},
  109. {"default:sword_stone", 0},
  110. {"default:pick_bronze", 0},
  111. {"default:shovel_bronze", 0},
  112. {"default:axe_bronze", 0},
  113. {"default:sword_bronze", 0},
  114. {"default:pick_steel", 0},
  115. {"default:shovel_steel", 0},
  116. {"default:axe_steel", 0},
  117. {"default:sword_steel", 0}
  118. },
  119. drops = {
  120. {name = "default:mese", chance = 9, min = 0, max = 1},
  121. {name = "default:mese_crystal", chance = 6, min = 0, max = 2},
  122. {name = "default:mese_crystal_fragment", chance = 1, min = 0, max = 3}
  123. },
  124. arrow_override = function(self)
  125. self.velocity = 8
  126. self.damage = 4
  127. end
  128. }}
  129. -- Mese Monster by SirrobZeroone
  130. mobs:register_mob("mobs_monster:mese_monster", {
  131. type = "monster",
  132. visual_size = {x = 10, y = 10}, -- Got scale wrong in blender by factor of 10 - S01
  133. passive = false,
  134. attack_type = "dogshoot",
  135. damage = 4,
  136. reach = 4,
  137. shoot_interval = 0.5,
  138. arrow = "mobs_monster:mese_arrow",
  139. shoot_offset = 0.75,
  140. -- arrow_override = function(self)
  141. -- self.velocity = 20
  142. -- end,
  143. knock_back = true,
  144. hp_min = 10,
  145. hp_max = 25,
  146. armor = 80,
  147. collisionbox = {-0.75, -0.5, -0.75, 0.75, 2.5, 0.75},
  148. visual = "mesh",
  149. mesh = "mobs_mese_monster.b3d",
  150. textures = {
  151. {"mobs_mese_monster_purple.png"}
  152. },
  153. blood_texture = "default_mese_crystal_fragment.png",
  154. makes_footstep_sound = false,
  155. sounds = {
  156. random = "mobs_mesemonster",
  157. damage = "default_glass_footstep"
  158. },
  159. view_range = 10,
  160. walk_velocity = 1,
  161. run_velocity = 3,
  162. jump = true,
  163. jump_height = 8,
  164. can_leap = true,
  165. fall_damage = 0,
  166. fall_speed = -6,
  167. stepheight = 2.1,
  168. immune_to = {
  169. {"default:pick_wood", 0},
  170. {"default:shovel_wood", 0},
  171. {"default:axe_wood", 0},
  172. {"default:sword_wood", 0}
  173. },
  174. drops = {
  175. {name = "default:mese_crystal", chance = 9, min = 0, max = 2},
  176. {name = "default:mese_crystal_fragment", chance = 1, min = 0, max = 2},
  177. },
  178. water_damage = 1,
  179. lava_damage = 1,
  180. light_damage = 0,
  181. animation = {
  182. speed_normal = 18,
  183. speed_run = 18,
  184. walk_start = 10,
  185. walk_end = 41,
  186. walk_speed = 20,
  187. run_start = 10,
  188. run_end = 41,
  189. run_speed = 30,
  190. stand_start = 60,
  191. stand_end = 83,
  192. shoot_start = 100,
  193. shoot_end = 113,
  194. die_start = 125,
  195. die_end = 141,
  196. death_speed = 25,
  197. die_loop = false,
  198. jump_start = 150 ,
  199. jump_end = 168,
  200. jump_loop = false,
  201. punch_start = 175,
  202. punch_end = 189
  203. },
  204. on_spawn = function(self)
  205. local pos = self.object:get_pos()
  206. -- quick update self function
  207. local function update(self, def)
  208. self.object:set_properties({textures = def.skins})
  209. -- added by mobs_redo
  210. self.hp_min = def.hp_min
  211. self.hp_max = def.hp_max
  212. self.health = math.random(self.hp_min, self.hp_max)
  213. self.damage = def.damage
  214. self.reach = def.reach
  215. self.armor = def.armor
  216. self.immune_to = def.immune_to
  217. self.drops = def.drops
  218. self.arrow_override = def.arrow_override
  219. end
  220. -- Normal spawn case
  221. for name, def in pairs(mese_monster_types) do
  222. if pos.y <= def.y_min and pos.y >= def.y_max then
  223. update(self, def)
  224. return true
  225. end
  226. end
  227. --[[
  228. -- player using egg
  229. -- direction sets type N = red, E = green, S = blue, W = purple
  230. -- Just for fun - S01
  231. local objects = minetest.get_objects_inside_radius(pos, 10)
  232. for i, obj in ipairs(objects) do
  233. if minetest.is_player(obj)
  234. and obj:get_wielded_item():get_name() == "mobs_monster:mese_monster" then
  235. local degree = (360 + math.deg(obj:get_look_horizontal())) % 360
  236. local compass_sel
  237. if degree > 45 and degree <= 135 then compass_sel = 4
  238. elseif degree > 135 and degree <= 225 then compass_sel = 3
  239. elseif degree > 225 and degree <= 315 then compass_sel = 2
  240. else compass_sel = 1
  241. end
  242. local def = mese_monster_types[compass_sel]
  243. update(self, def)
  244. return true
  245. end
  246. end
  247. ]]
  248. -- catch case if all else fails random it
  249. update(self, mese_monster_types[math.random(4)])
  250. return true
  251. end
  252. })
  253. -- mese arrow (weapon)
  254. minetest.register_craftitem("mobs_monster:mese_crystal_fragment_arrow", {
  255. description = S("Mese Monster Arrow"),
  256. inventory_image = "mobs_mese_arrow.png",
  257. groups = {not_in_creative_inventory = 1}
  258. })
  259. mobs:register_arrow("mobs_monster:mese_arrow", {
  260. visual = "wielditem",
  261. visual_size = {x = 0.25, y = 0.25},
  262. textures = {"mobs_monster:mese_crystal_fragment_arrow"},
  263. velocity = 8,
  264. rotate = 180,
  265. damage = 2,
  266. hit_player = function(self, player)
  267. player:punch(self.object, 1.0, {
  268. full_punch_interval = 1.0,
  269. damage_groups = {fleshy = self.damage}
  270. }, nil)
  271. end,
  272. hit_mob = function(self, player)
  273. player:punch(self.object, 1.0, {
  274. full_punch_interval = 1.0,
  275. damage_groups = {fleshy = self.damage}
  276. }, nil)
  277. end,
  278. hit_node = function(self, pos, node)
  279. end
  280. })
  281. if not mobs.custom_spawn_monster then
  282. mobs:spawn({
  283. name = "mobs_monster:mese_monster",
  284. nodes = {"default:stone"},
  285. max_light = 7,
  286. chance = 5000,
  287. active_object_count = 1,
  288. max_height = -20
  289. })
  290. end
  291. mobs:register_egg("mobs_monster:mese_monster", S("Mese Monster"), "default_mese_block.png", 1)
  292. mobs:alias_mob("mobs:mese_monster", "mobs_monster:mese_monster") -- compatiblity
  293. -- 9x mese crystal fragments = 1x mese crystal
  294. local f = "default:mese_crystal_fragment"
  295. minetest.register_craft({
  296. output = "default:mese_crystal",
  297. recipe = {{f, f, f}, {f, f, f}, {f, f, f}}
  298. })