igor.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. local S = mobs_npc.S
  2. -- Igor by TenPlus1
  3. mobs_npc.igor_drops = {
  4. "vessels:glass_bottle", "mobs:meat_raw", {"default:sword_steel", 2},
  5. "farming:bread", {"bucket:bucket_water", 2}, "flowers:mushroom_red",
  6. "default:jungletree", {"fire:flint_and_steel", 3}, "mobs:leather",
  7. "default:acacia_sapling", {"fireflies:bug_net", 3}, "default:clay_lump",
  8. "default:ice", "default:coral_brown", "default:iron_lump",
  9. "default:obsidian_shard", "default:mossycobble", {"default:obsidian", 2}
  10. }
  11. mobs:register_mob("mobs_npc:igor", {
  12. type = "npc",
  13. passive = false,
  14. damage = 5,
  15. attack_type = "dogfight",
  16. owner_loyal = true,
  17. pathfinding = true,
  18. reach = 2,
  19. attacks_monsters = true,
  20. hp_min = 20,
  21. hp_max = 30,
  22. armor = 100,
  23. collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
  24. visual = "mesh",
  25. mesh = "mobs_character.b3d",
  26. textures = {
  27. {"mobs_igor.png"}, -- skin by ruby32199
  28. {"mobs_igor2.png"},
  29. {"mobs_igor3.png"},
  30. {"mobs_igor4.png"},
  31. {"mobs_igor5.png"},
  32. {"mobs_igor6.png"},
  33. {"mobs_igor7.png"},
  34. {"mobs_igor8.png"}
  35. },
  36. makes_footstep_sound = true,
  37. sounds = {},
  38. walk_velocity = 1,
  39. run_velocity = 2,
  40. stepheight = 1.1,
  41. fear_height = 2,
  42. jump = true,
  43. drops = {
  44. {name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
  45. {name = "default:gold_lump", chance = 3, min = 1, max = 1}
  46. },
  47. water_damage = 1,
  48. lava_damage = 3,
  49. light_damage = 0,
  50. follow = {"mobs:meat_raw", "default:diamond"},
  51. view_range = 15,
  52. owner = "",
  53. order = "follow",
  54. animation = {
  55. speed_normal = 30,
  56. speed_run = 30,
  57. stand_start = 0,
  58. stand_end = 79,
  59. walk_start = 168,
  60. walk_end = 187,
  61. run_start = 168,
  62. run_end = 187,
  63. punch_start = 200,
  64. punch_end = 219
  65. },
  66. on_rightclick = function(self, clicker)
  67. -- feed to heal npc
  68. if mobs:feed_tame(self, clicker, 8, false, true) then return end
  69. if mobs:protect(self, clicker) then return end
  70. if mobs:capture_mob(self, clicker, nil, 5, 80, false, nil) then return end
  71. local item = clicker:get_wielded_item()
  72. local name = clicker:get_player_name()
  73. -- right clicking with gold lump drops random item from list
  74. if mobs_npc.drop_trade(self, clicker, "default:gold_lump",
  75. self.npc_drops or mobs_npc.igor_drops) then
  76. return
  77. end
  78. -- owner can right-click with stick to show control formspec
  79. if item:get_name() == "default:stick"
  80. and self.owner == name then
  81. minetest.show_formspec(name, "mobs_npc:controls",
  82. mobs_npc.get_controls_formspec(name, self))
  83. return
  84. end
  85. -- show simple dialog if enabled or idle chatter
  86. if mobs_npc.useDialogs == "Y" then
  87. simple_dialogs.show_dialog_formspec(name, self)
  88. else
  89. if self.state == "attack" then
  90. mobs_npc.npc_talk(self, clicker, {"Grr!", "Must Kill!"})
  91. else
  92. mobs_npc.npc_talk(self, clicker, {
  93. "Hey!", "What do you want?", "Go away!", "Go bother someone else!"})
  94. end
  95. end
  96. end
  97. })
  98. -- register spawn egg
  99. mobs:register_egg("mobs_npc:igor", S("Igor"), "mobs_meat_raw.png", 1)
  100. -- this is only required for servers that used the old mobs mod
  101. mobs:alias_mob("mobs:igor", "mobs_npc:igor")
  102. -- spawn Igor in world
  103. if not mobs.custom_spawn_npc then
  104. mobs:spawn({
  105. name = "mobs_npc:igor",
  106. nodes = {"mobs:meatblock"},
  107. neighbors = {"default:brick"},
  108. min_light = 10,
  109. chance = 10000,
  110. active_object_count = 1,
  111. min_height = 0,
  112. day_toggle = true
  113. })
  114. end