init.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
  2. -- Check for translation method
  3. local S
  4. if minetest.get_translator ~= nil then
  5. S = minetest.get_translator("mobs_npc") -- 5.x translation function
  6. else
  7. if minetest.get_modpath("intllib") then
  8. dofile(minetest.get_modpath("intllib") .. "/init.lua")
  9. if intllib.make_gettext_pair then
  10. S = intllib.make_gettext_pair() -- new gettext method
  11. else
  12. S = intllib.Getter() -- old text file method
  13. end
  14. else -- boilerplate function
  15. S = function(str, ...)
  16. local args = {...}
  17. return str:gsub("@%d+", function(match)
  18. return args[tonumber(match:sub(2))]
  19. end)
  20. end
  21. end
  22. end
  23. mobs_npc = {S = S}
  24. -- Check for custom mob spawn file
  25. local input = io.open(path .. "spawn.lua", "r")
  26. if input then
  27. mobs.custom_spawn_npc = true
  28. input:close()
  29. input = nil
  30. end
  31. -- useful functions
  32. dofile(path .. "functions.lua")
  33. -- NPCs
  34. dofile(path .. "npc.lua") -- TenPlus1
  35. dofile(path .. "trader.lua")
  36. dofile(path .. "igor.lua")
  37. -- Load custom spawning
  38. if mobs.custom_spawn_npc then
  39. dofile(path .. "spawn.lua")
  40. end
  41. -- Lucky Blocks
  42. if minetest.get_modpath("lucky_block") then
  43. dofile(path .. "/lucky_block.lua")
  44. end
  45. print ("[MOD] Mobs Redo NPCs loaded")