diff --git a/init.lua b/init.lua index 0a75bc6..bd265c3 100644 --- a/init.lua +++ b/init.lua @@ -526,6 +526,10 @@ minetest.register_craft({ }, }) -dofile(minetest.get_modpath("ta4_jetpack") .. "/manual.lua") -techage.add_manual_items({ta4_jetpack = "ta4_jetpack.png"}) +dofile(minetest.get_modpath("ta4_jetpack") .. "/manual_DE.lua") +dofile(minetest.get_modpath("ta4_jetpack") .. "/manual_EN.lua") + +techage.add_manual_items({ + ta4_jetpack = "ta4_jetpack.png", + ta4_jetpack_controller = 'ta4_jetpack_controller_inv.png'}) diff --git a/manual.lua b/manual.lua index db6d8e3..1b2126e 100644 --- a/manual.lua +++ b/manual.lua @@ -1,29 +1,32 @@ -techage.add_to_manual('EN', { +techage.add_to_manual('DE', { "1,TA4 Jetpack", - "2,Instructions", - "2,Important to know", + "2,Anleitung", + "2,Was du wissen solltest", }, { - "The Jetpack is inspired by the jetpack from spirit689 (https://github.com/spirit689/jetpack)\n".. - "and by the historical game Lunar Lander.\n".. + "Das Jetpack ist inspiriert vom Jetpack von spirit689 (https://github.com/spirit689/jetpack) und durch das historische Spiel Lunar Lander.\n".. "\n".. "\n".. "\n", - " - Craft TA4 Jetpack\\, Jetpack Controller and Training Mat\n".. - " - Use the armor extension (3d_armor) of the player menu to strap the Jetpack on your back\n".. - " - You can refuel the jetpack by left-clicking with the controller on a hydrogen tank\n".. - " - Turn the controller on by right-click and check the fuel tank level (the small colored bar below the controller icon)\n".. - " - Use the space bar to activate the Jetpack and the WASD keys to control the direction\n".. - " - Before your first flight you should do some training starts and landings on the Training Mat \n(The Jetpack is a bit stubborn\\, it takes some practice to keep the JetPack in the air)\n".. + " - TA4 Jetpack\\, Jetpack Controller und Trainingsmatte herstellen (craften)\n".. + " - Verwende die '3d_armor' Erweiterung des Spielermenüs\\, um das Jetpack auf deinem Rücken zu schnallen\n".. + " - Du kannst das Jetpack auftanken\\, indem du mit dem Controller und mit der linken Maustaste auf einen Wasserstofftanks klickst\n".. + " - Schalte den Controller mit der rechten Maustaste ein und überprüfe den Füllstand des Kraftstofftanks (der kleine farbige Balken unter dem Reglersymbol).\n".. + " - Verwende die Leertaste\\, um das Jetpack zu aktivieren und die WASD-Tasten\\, um die Richtung zu steuern\n".. + " - Vor dem ersten Flug solltest du einige Trainingsstarts und Landungen auf der Trainingsmatte durchführen\n (Das Jetpack ist etwas eigensinnig\\, es erfordert etwas Übung\\, das JetPack in der Luft zu halten.)\n".. + "\n".. + "\n".. "\n", - " - 12 units of hydrogen are sufficient for a flight of 6 minutes\n".. - " - Maximum 5 items stacks in your inventory are allowed including the controller.\nOtherwise you would be too heavy :-)\n".. - " - The Jetpack also wears out and can be used for approximately 10 flights\n".. - " - Always hold the controller tight during the flight\\, otherwise it will switch off :)\n".. + " - 12 Einheiten Wasserstoff reichen für einen Flug von 6 Minuten\n".. + " - Maximal 5 Stapel von Gegenständen im Spieler-Inventar sind zulässig\\, einschließlich des Controllers\n(Sonst wärst du zu schwer :-)\n".. + " - Das Jetpack nutzt sich ab und kann für ca. 10 Flüge verwendet werden\n".. + " - Halte den Controller während des Fluges immer fest\\, sonst schaltet er sich aus :)\n".. + "\n".. + "\n".. "\n", }, { "ta4_jetpack", - "", - "", + "ta4_jetpack_controller", + "ta4_jetpack_controller", }, { "", "", diff --git a/manual_DE.lua b/manual_DE.lua new file mode 100644 index 0000000..1b2126e --- /dev/null +++ b/manual_DE.lua @@ -0,0 +1,34 @@ +techage.add_to_manual('DE', { + "1,TA4 Jetpack", + "2,Anleitung", + "2,Was du wissen solltest", +}, { + "Das Jetpack ist inspiriert vom Jetpack von spirit689 (https://github.com/spirit689/jetpack) und durch das historische Spiel Lunar Lander.\n".. + "\n".. + "\n".. + "\n", + " - TA4 Jetpack\\, Jetpack Controller und Trainingsmatte herstellen (craften)\n".. + " - Verwende die '3d_armor' Erweiterung des Spielermenüs\\, um das Jetpack auf deinem Rücken zu schnallen\n".. + " - Du kannst das Jetpack auftanken\\, indem du mit dem Controller und mit der linken Maustaste auf einen Wasserstofftanks klickst\n".. + " - Schalte den Controller mit der rechten Maustaste ein und überprüfe den Füllstand des Kraftstofftanks (der kleine farbige Balken unter dem Reglersymbol).\n".. + " - Verwende die Leertaste\\, um das Jetpack zu aktivieren und die WASD-Tasten\\, um die Richtung zu steuern\n".. + " - Vor dem ersten Flug solltest du einige Trainingsstarts und Landungen auf der Trainingsmatte durchführen\n (Das Jetpack ist etwas eigensinnig\\, es erfordert etwas Übung\\, das JetPack in der Luft zu halten.)\n".. + "\n".. + "\n".. + "\n", + " - 12 Einheiten Wasserstoff reichen für einen Flug von 6 Minuten\n".. + " - Maximal 5 Stapel von Gegenständen im Spieler-Inventar sind zulässig\\, einschließlich des Controllers\n(Sonst wärst du zu schwer :-)\n".. + " - Das Jetpack nutzt sich ab und kann für ca. 10 Flüge verwendet werden\n".. + " - Halte den Controller während des Fluges immer fest\\, sonst schaltet er sich aus :)\n".. + "\n".. + "\n".. + "\n", +}, { + "ta4_jetpack", + "ta4_jetpack_controller", + "ta4_jetpack_controller", +}, { + "", + "", + "", +}) diff --git a/manual_DE.md b/manual_DE.md new file mode 100644 index 0000000..b2b4ea5 --- /dev/null +++ b/manual_DE.md @@ -0,0 +1,29 @@ +# TA4 Jetpack + +Das Jetpack ist inspiriert vom Jetpack von spirit689 (https://github.com/spirit689/jetpack) und durch das historische Spiel Lunar Lander. + +[ta4_jetpack|image] + + +## Anleitung + +- TA4 Jetpack, Jetpack Controller und Trainingsmatte herstellen (craften) +- Verwende die '3d_armor' Erweiterung des Spielermenüs, um das Jetpack auf deinem Rücken zu schnallen +- Du kannst das Jetpack auftanken, indem du mit dem Controller und mit der linken Maustaste auf einen Wasserstofftanks klickst +- Schalte den Controller mit der rechten Maustaste ein und überprüfe den Füllstand des Kraftstofftanks (der kleine farbige Balken unter dem Reglersymbol). +- Verwende die Leertaste, um das Jetpack zu aktivieren und die WASD-Tasten, um die Richtung zu steuern +- Vor dem ersten Flug solltest du einige Trainingsstarts und Landungen auf der Trainingsmatte durchführen + (Das Jetpack ist etwas eigensinnig, es erfordert etwas Übung, das JetPack in der Luft zu halten.) + +[ta4_jetpack_controller|image] + + +## Was du wissen solltest + +- 12 Einheiten Wasserstoff reichen für einen Flug von 6 Minuten +- Maximal 5 Stapel von Gegenständen im Spieler-Inventar sind zulässig, einschließlich des Controllers + (Sonst wärst du zu schwer :-) +- Das Jetpack nutzt sich ab und kann für ca. 10 Flüge verwendet werden +- Halte den Controller während des Fluges immer fest, sonst schaltet er sich aus :) + +[ta4_jetpack_controller|image] diff --git a/manual_EN.lua b/manual_EN.lua new file mode 100644 index 0000000..19222ed --- /dev/null +++ b/manual_EN.lua @@ -0,0 +1,35 @@ +techage.add_to_manual('EN', { + "1,TA4 Jetpack", + "2,Instructions", + "2,Important to know", +}, { + "The Jetpack is inspired by the jetpack from spirit689 (https://github.com/spirit689/jetpack)\n".. + "and by the historical game Lunar Lander.\n".. + "\n".. + "\n".. + "\n", + " - Craft TA4 Jetpack\\, Jetpack Controller and Training Mat\n".. + " - Use the armor extension (3d_armor) of the player menu to strap the Jetpack on your back\n".. + " - You can refuel the jetpack by left-clicking with the controller on a hydrogen tank\n".. + " - Turn the controller on by right-click and check the fuel tank level (the small colored bar below the controller icon)\n".. + " - Use the space bar to activate the Jetpack and the WASD keys to control the direction\n".. + " - Before your first flight you should do some training starts and landings on the Training Mat \n(The Jetpack is a bit stubborn\\, it takes some practice to keep the JetPack in the air)\n".. + "\n".. + "\n".. + "\n", + " - 12 units of hydrogen are sufficient for a flight of 6 minutes\n".. + " - Maximum 5 items stacks in your inventory are allowed including the controller.\nOtherwise you would be too heavy :-)\n".. + " - The Jetpack also wears out and can be used for approximately 10 flights\n".. + " - Always hold the controller tight during the flight\\, otherwise it will switch off :)\n".. + "\n".. + "\n".. + "\n", +}, { + "ta4_jetpack", + "ta4_jetpack_controller", + "ta4_jetpack_controller", +}, { + "", + "", + "", +}) diff --git a/manual.md b/manual_EN.md similarity index 94% rename from manual.md rename to manual_EN.md index 704a5c6..82cf6c8 100644 --- a/manual.md +++ b/manual_EN.md @@ -16,6 +16,8 @@ and by the historical game Lunar Lander. - Before your first flight you should do some training starts and landings on the Training Mat (The Jetpack is a bit stubborn, it takes some practice to keep the JetPack in the air) +[ta4_jetpack_controller|image] + ## Important to know @@ -25,3 +27,4 @@ and by the historical game Lunar Lander. - The Jetpack also wears out and can be used for approximately 10 flights - Always hold the controller tight during the flight, otherwise it will switch off :) +[ta4_jetpack_controller|image] diff --git a/markdown2lua.py b/markdown2lua.py index 925f5be..316b480 100644 --- a/markdown2lua.py +++ b/markdown2lua.py @@ -1,9 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# import re -import mistune +import mistune # install v0.8.4 with: pip install mistune + +__version__ = "1.0" class WikiLinkInlineLexer(mistune.InlineLexer): def enable_wiki_link(self): @@ -27,10 +28,8 @@ class WikiLinkInlineLexer(mistune.InlineLexer): return self.renderer.wiki_link(name, itype) class MarkdownToLua(mistune.Renderer): - def __init__(self, mod_name, dst_file_name, *args, **kwargs): + def __init__(self, *args, **kwargs): mistune.Renderer.__init__(self, *args, **kwargs) - self.mod_name = mod_name - self.dst_file_name = dst_file_name self.item_name = "" self.plan_table = "" self.is_first_header = True @@ -39,6 +38,7 @@ class MarkdownToLua(mistune.Renderer): self.lText = [] self.lItemName = [] self.lPlanTable = [] + print("Markdown-to-Lua v%s" % __version__) def m2l_formspec_escape(self, text): text = text.replace("\\", "") @@ -147,7 +147,7 @@ class MarkdownToLua(mistune.Renderer): pass def parse_md_file(self, src_name): - print("Read Lua file '%s'" % src_name) + print(" - Read MD file '%s'" % src_name) inline = WikiLinkInlineLexer(self) # enable the feature inline.enable_wiki_link() @@ -178,17 +178,22 @@ class MarkdownToLua(mistune.Renderer): lOut.append("}") return "\n".join(lOut) - def gen_lua_file(self, dest_name): - print("Write Lua file '%s'" % dest_name) + def gen_lua_file(self, dest_name, language="EN"): + print(" - Write Lua file '%s'" % dest_name) lOut = [] s = ", ".join([self.lua_table(self.lTitle), self.lua_text_table(self.lText), self.lua_table(self.lItemName), self.lua_table(self.lPlanTable)]) - open(dest_name, "w").write("techage.add_to_manual('EN', %s)\n" % s) + open(dest_name, "w").write("techage.add_to_manual('%s', %s)\n" % (language, s)) + print("done.") -m2l = MarkdownToLua("ta4_jetpack", "manual") -m2l.parse_md_file("./manual.md") -m2l.gen_lua_file("./manual.lua") +m2l = MarkdownToLua() +m2l.parse_md_file("./manual_EN.md") +m2l.gen_lua_file("./manual_EN.lua", "EN") + +m2l = MarkdownToLua() +m2l.parse_md_file("./manual_DE.md") +m2l.gen_lua_file("./manual_DE.lua", "DE")