warthog.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. local S = mobs.intllib
  2. -- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
  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.b3d",
  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. drops = {
  35. {name = "mobs:pork_raw", chance = 1, min = 1, max = 3},
  36. },
  37. water_damage = 0,
  38. lava_damage = 5,
  39. light_damage = 0,
  40. fear_height = 2,
  41. animation = {
  42. speed_normal = 15,
  43. stand_start = 25,
  44. stand_end = 55,
  45. walk_start = 70,
  46. walk_end = 100,
  47. punch_start = 70,
  48. punch_end = 100,
  49. die_start = 1, -- we dont have a specific death animation so we will
  50. die_end = 2, -- re-use 2 standing frames at a speed of 1 fps and
  51. die_speed = 1, -- have mob rotate when dying.
  52. die_loop = false,
  53. die_rotate = true,
  54. },
  55. on_rightclick = function(self, clicker)
  56. if mobs:feed_tame(self, clicker, 8, true, true) then return end
  57. if mobs:protect(self, clicker) then return end
  58. if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
  59. end,
  60. })
  61. local spawn_on = {"default:dirt_with_grass"}
  62. local spawn_by = {"group:grass"}
  63. if minetest.get_mapgen_setting("mg_name") ~= "v6" then
  64. spawn_on = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"}
  65. spawn_by = {"group:dry_grass"}
  66. end
  67. if minetest.get_modpath("ethereal") then
  68. spawn_on = {"ethereal:mushroom_dirt"}
  69. spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"}
  70. end
  71. if not mobs.custom_spawn_animal then
  72. mobs:spawn({
  73. name = "mobs_animal:pumba",
  74. nodes = spawn_on,
  75. neighbors = spawn_by,
  76. min_light = 14,
  77. interval = 60,
  78. chance = 8000, -- 15000
  79. min_height = 0,
  80. max_height = 200,
  81. day_toggle = true,
  82. })
  83. end
  84. mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png")
  85. mobs:alias_mob("mobs:pumba", "mobs_animal:pumba") -- compatibility
  86. -- raw porkchop
  87. minetest.register_craftitem(":mobs:pork_raw", {
  88. description = S("Raw Porkchop"),
  89. inventory_image = "mobs_pork_raw.png",
  90. on_use = minetest.item_eat(4),
  91. groups = {food_meat_raw = 1, food_pork_raw = 1, flammable = 2},
  92. })
  93. -- cooked porkchop
  94. minetest.register_craftitem(":mobs:pork_cooked", {
  95. description = S("Cooked Porkchop"),
  96. inventory_image = "mobs_pork_cooked.png",
  97. on_use = minetest.item_eat(8),
  98. groups = {food_meat = 1, food_pork = 1, flammable = 2},
  99. })
  100. minetest.register_craft({
  101. type = "cooking",
  102. output = "mobs:pork_cooked",
  103. recipe = "mobs:pork_raw",
  104. cooktime = 5,
  105. })