warthog.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. local S = mobs.intllib
  2. -- Warthog by KrupnoPavel
  3. mobs:register_mob("mobs_animal:pumba", {
  4. stepheight = 0.6,
  5. type = "animal",
  6. passive = false,
  7. attack_type = "dogfight",
  8. group_attack = true,
  9. owner_loyal = true,
  10. attack_npcs = false,
  11. reach = 2,
  12. damage = 2,
  13. hp_min = 5,
  14. hp_max = 15,
  15. armor = 200,
  16. collisionbox = {-0.4, -0.01, -0.4, 0.4, 0.95, 0.4},
  17. visual = "mesh",
  18. mesh = "mobs_pumba.x",
  19. textures = {
  20. {"mobs_pumba.png"},
  21. },
  22. makes_footstep_sound = true,
  23. sounds = {
  24. random = "mobs_pig",
  25. attack = "mobs_pig_angry",
  26. },
  27. walk_velocity = 2,
  28. run_velocity = 3,
  29. jump = true,
  30. jump_height = 6,
  31. pushable = true,
  32. follow = {"default:apple", "farming:potato"},
  33. view_range = 10,
  34. replace_what = {"group:veggies", "group:fruit"},
  35. replace_with = "air",
  36. drops = {
  37. {name = "mobs:pork_raw", chance = 1, min = 1, max = 3},
  38. },
  39. water_damage = 1,
  40. lava_damage = 5,
  41. light_damage = 0,
  42. fear_height = 2,
  43. animation = {
  44. speed_normal = 15,
  45. stand_start = 25,
  46. stand_end = 55,
  47. walk_start = 70,
  48. walk_end = 100,
  49. punch_start = 70,
  50. punch_end = 100,
  51. },
  52. on_rightclick = function(self, clicker)
  53. if mobs:feed_tame(self, clicker, 8, true, true) then return end
  54. if mobs:protect(self, clicker) then return end
  55. if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
  56. end,
  57. })
  58. mobs:spawn({
  59. name = "mobs_animal:pumba",
  60. nodes = 'default:dirt_with_grass',
  61. neighbors = 'group:grass',
  62. min_light = 14,
  63. interval = 60,
  64. chance = 8000, -- 15000
  65. min_height = 0,
  66. max_height = 200,
  67. day_toggle = true,
  68. })
  69. mobs:register_egg("mobs_animal:pumba", S("Warthog"), "wool.png^[multiply:#ff7dc8", 1)
  70. mobs:alias_mob("mobs:pumba", "mobs_animal:pumba") -- compatibility
  71. -- raw porkchop
  72. minetest.register_craftitem(":mobs:pork_raw", {
  73. description = S("Raw Porkchop"),
  74. inventory_image = "mobs_pork_raw.png",
  75. on_use = minetest.item_eat(4),
  76. groups = {food_meat_raw = 1, food_pork_raw = 1, flammable = 2},
  77. })
  78. -- cooked porkchop
  79. minetest.register_craftitem(":mobs:pork_cooked", {
  80. description = S("Cooked Porkchop"),
  81. inventory_image = "mobs_pork_cooked.png",
  82. on_use = minetest.item_eat(8),
  83. groups = {food_meat = 1, food_pork = 1, flammable = 2},
  84. })
  85. minetest.register_craft({
  86. type = "cooking",
  87. output = "mobs:pork_cooked",
  88. recipe = "mobs:pork_raw",
  89. cooktime = 5,
  90. })