warthog.lua 2.3 KB

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