mese_monster.lua 8.0 KB

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