Advertisement
Guest User

minetest crash script

a guest
Jan 7th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. local worldpath = minetest.get_worldpath()
  2.  
  3. local gamepath = string.gsub(worldpath, "/worlds/.*", "/games/mineclone/")
  4.  
  5. local schematics = {}
  6.  
  7. local ie = minetest.request_insecure_environment()
  8. local pathlist = ie.io.popen("find " .. gamepath .. " -name '*.mts'")
  9. for line in pathlist:lines() do
  10. table.insert(schematics, line)
  11. end
  12. ie = nil
  13.  
  14. minetest.register_chatcommand("schematics", {
  15. description = "dump registrations to file",
  16. params = "<action>",
  17. privs = {server = true},
  18. func = function(_, param)
  19. if not param or param == "" then return false end
  20.  
  21. if param == "check" then
  22. local outfilepath = worldpath .. "/schematics_check.txt"
  23. local file = io.open(outfilepath, "w")
  24. if not file then
  25. return false, "could not open file for output!"
  26. end
  27. local s
  28. for _, filename in ipairs(schematics) do
  29. minetest.log("report for ".. filename)
  30. file:write("report for ", filename, " :\n")
  31. file:flush()
  32. minetest.log("written header to ".. outfilepath)
  33. --s = minetest.read_schematic(filename, {write_yslice_prob = "all"})
  34. s = minetest.read_schematic(filename, {})
  35. minetest.log("read schematic ".. filename)
  36. local seen = {}
  37. for _, n in ipairs(s.data) do
  38. if n.param2 ~= 0 then
  39. minetest.log("node ".. n.name.. " has nonzero param2.")
  40. file:write("node ", n.name, " has nonzero param2.\n")
  41. end
  42. if not seen[n.name] then
  43. seen[n.name] = 1
  44. if not minetest.registered_nodes[n.name] then
  45. if minetest.registered_aliases[n.name] then
  46. minetest.log("node ".. n.name.. " is an alias.")
  47. file:write("node ", n.name, " is an alias.\n")
  48. else
  49. minetest.log("node ".. n.name.. " is not registered.")
  50. file:write("node ", n.name, " is not registered.\n")
  51. end
  52. end
  53. end
  54. end
  55. end
  56. file:flush()
  57. file:close()
  58.  
  59. end
  60. return true, "report written to " .. outfilepath
  61. end
  62. })
  63.  
  64.  
Tags: minetest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement