warthog.lua 2.0 KB

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