larva.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. mobs:register_mob("nssm:larva", {
  2. type = "monster",
  3. hp_max = 12,
  4. hp_min = 8,
  5. collisionbox = {-0.3, 0, -0.3, 0.3, 0.41, 0.3},
  6. visual = "mesh",
  7. mesh = "larva.x",
  8. textures = {
  9. {"larva.png"}
  10. },
  11. visual_size = {x = 3, y = 3},
  12. makes_footstep_sound = false,
  13. view_range = 10,
  14. rotate = 90,
  15. jump = false,
  16. fear_height = 4,
  17. jump_height = 0,
  18. walk_velocity = 0.4,
  19. run_velocity = 0.4,
  20. sounds = {
  21. random = "sand",
  22. },
  23. damage = 1,
  24. reach = 1,
  25. drops = {
  26. {name = "nssm:life_energy", chance = 3, min = 1, max = 1},
  27. {name = "nssm:larva_meat", chance = 2, min = 1, max = 2},
  28. },
  29. armor = 80,
  30. drawtype = "front",
  31. water_damage = 2,
  32. lava_damage = 4,
  33. fire_damage = 4,
  34. light_damage = 0,
  35. group_attack = true,
  36. attack_animals = true,
  37. knock_back = 2,
  38. blood_texture = "nssm_blood_blue.png",
  39. attack_type = "dogfight",
  40. animation = {
  41. speed_normal = 20,
  42. speed_run = 20,
  43. stand_start = 0,
  44. stand_end = 80,
  45. walk_start = 100,
  46. walk_end = 160,
  47. run_start = 100,
  48. run_end = 160,
  49. punch_start = 180,
  50. punch_end = 230,
  51. },
  52. do_custom = function (self)
  53. self.metatimer = self.metatimer or os.time()
  54. if os.time() - self.metatimer > 20 then
  55. minetest.log("action",
  56. "metatimer expired, metamorphosis! ")
  57. local pos = self.object:get_pos()
  58. self.object:remove()
  59. minetest.add_particlespawner({
  60. amount = 200,
  61. time = 0.1,
  62. minpos = {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
  63. maxpos = {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
  64. minvel = {x = -0, y = -0, z = -0},
  65. maxvel = {x = 1, y = 1, z = 1},
  66. minacc = {x = -0.5, y = 5, z = -0.5},
  67. maxacc = {x = 0.5, y = 5, z = 0.5},
  68. minexptime = 0.1,
  69. maxexptime = 1,
  70. minsize = 3,
  71. maxsize = 4,
  72. collisiondetection = false,
  73. texture = "tnt_smoke.png"
  74. })
  75. if math.random(2) == 1 then
  76. minetest.add_entity(pos, "nssm:mantis")
  77. else
  78. minetest.add_entity(pos, "nssm:mantis_beast")
  79. end
  80. return
  81. end
  82. end
  83. })