init.lua 861 B

123456789101112131415161718192021222324252627282930313233343536
  1. -- Mineunit CI
  2. require "mineunit"
  3. mineunit "core"
  4. if not minetest.get_translated_string then
  5. local ESCAPE_CHAR = string.char(0x1b)
  6. function _G.minetest.get_translated_string(_, s)
  7. return s:gsub(ESCAPE_CHAR .. "%(T@[^)]+%)", ""):gsub(ESCAPE_CHAR .. "[TFE]", "")
  8. end
  9. end
  10. if not minetest.safe_file_write then
  11. function _G.minetest.safe_file_write(fn, c)
  12. local f, e = io.open(fn, "wb")
  13. if not f then return error(e) end
  14. f:write(c)
  15. f:close()
  16. end
  17. end
  18. _G.advtrains = {
  19. wagon_prototypes = {},
  20. register_wagon = function(name, prototype, desc, invimg)
  21. advtrains.wagon_prototypes[name] = prototype
  22. minetest.register_craftitem(":"..name, {
  23. description = desc,
  24. inventory_image = invimg,
  25. wield_image = invimg,
  26. stack_max = 1,
  27. })
  28. advtrains_doc_integration.write_wagon_info_as_latex(name)
  29. end
  30. }
  31. fixture("advtrains_doc_integration/init")