From 94ac9ca62414b09eb74d47470cd889b58cffb4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vest=C3=B8l?= Date: Sat, 29 Sep 2018 15:21:35 +0200 Subject: [PATCH] Added scenario_loader plugin, updated hotpatch (new saves now gives the starting items) --- .gitignore | 4 ++ lib/scenarios/Hotpatch/control.lua | 60 ++++++++++++++++--- lib/scenarios/Hotpatch/hotpatch/gui.lua | 6 +- lib/scenarios/Hotpatch/hotpatch/mod-tools.lua | 2 +- lib/scenarios/Hotpatch/locale/af/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ar/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/be/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/bg/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ca/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/cs/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/da/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/de/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/el/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/en/freeplay.cfg | 2 + lib/scenarios/Hotpatch/locale/eo/freeplay.cfg | 3 + .../Hotpatch/locale/es-ES/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/et/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/fi/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/fr/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/he/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/hu/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/it/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ja/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ko/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/lt/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/lv/freeplay.cfg | 2 + lib/scenarios/Hotpatch/locale/nl/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/no/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/pl/freeplay.cfg | 3 + .../Hotpatch/locale/pt-BR/freeplay.cfg | 3 + .../Hotpatch/locale/pt-PT/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ro/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/ru/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/sk/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/sl/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/sr/freeplay.cfg | 2 + .../Hotpatch/locale/sv-SE/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/th/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/tr/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/uk/freeplay.cfg | 3 + lib/scenarios/Hotpatch/locale/vi/freeplay.cfg | 3 + .../Hotpatch/locale/zh-CN/freeplay.cfg | 3 + .../Hotpatch/locale/zh-TW/freeplay.cfg | 3 + node_modules/_app/clusterTools/index.js | 4 +- sharedPlugins/scenario_loader/config.js | 10 ++++ sharedPlugins/scenario_loader/index.js | 53 ++++++++++++++++ 46 files changed, 240 insertions(+), 13 deletions(-) create mode 100644 lib/scenarios/Hotpatch/locale/af/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ar/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/be/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/bg/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ca/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/cs/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/da/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/de/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/el/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/en/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/eo/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/es-ES/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/et/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/fi/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/fr/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/he/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/hu/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/it/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ja/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ko/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/lt/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/lv/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/nl/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/no/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/pl/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/pt-BR/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/pt-PT/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ro/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/ru/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/sk/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/sl/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/sr/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/sv-SE/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/th/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/tr/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/uk/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/vi/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/zh-CN/freeplay.cfg create mode 100644 lib/scenarios/Hotpatch/locale/zh-TW/freeplay.cfg create mode 100644 sharedPlugins/scenario_loader/config.js create mode 100644 sharedPlugins/scenario_loader/index.js diff --git a/.gitignore b/.gitignore index b5f29114..654171b8 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,10 @@ sharedPlugins/* !sharedPlugins/globalChat/ !sharedPlugins/clusterioMod/ !sharedPlugins/serverManager/ +sharedPlugins/serverManager/database/* +sharedPlugins/serverManager/config.json +sharedPlugins/serverManager/secret-api-token.txt +!sharedPlugins/scenario_loader/ # File used for marking plugins as disabled sharedPlugins/*/DISABLED diff --git a/lib/scenarios/Hotpatch/control.lua b/lib/scenarios/Hotpatch/control.lua index 7fc77680..b5b66946 100644 --- a/lib/scenarios/Hotpatch/control.lua +++ b/lib/scenarios/Hotpatch/control.lua @@ -30,14 +30,60 @@ require 'hotpatch.gui' -- mod code goes here --- Single-file test ---[[ -hotpatch_tools.static_mod('test', '1.0.0', [===[ - script.on_init(function() - log('test') - end) +-- This is the Factorio Freeplay scenario +-- This code, and the freeplay locale files in the zip file, is the property of Wube +-- As this is part of the base mod, the developers have given permission for modders to use/adapt the assets therein, for modding Factorio +-- Any other use would require licensing/permission from Wube +-- If you don't want to run this, either comment this out before creating your scenario, OR uninstall freeplay at runtime +hotpatch_tools.static_mod('freeplay', '1.0.0', [===[ +local silo_script = require("silo-script") +local version = 1 + +script.on_event(defines.events.on_player_created, function(event) + local player = game.players[event.player_index] + player.insert{name="iron-plate", count=8} + player.insert{name="pistol", count=1} + player.insert{name="firearm-magazine", count=10} + player.insert{name="burner-mining-drill", count = 1} + player.insert{name="stone-furnace", count = 1} + player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}}) + if (#game.players <= 1) then + game.show_message_dialog{text = {"msg-intro"}} + else + player.print({"msg-intro"}) + end + silo_script.on_player_created(event) +end) + +script.on_event(defines.events.on_player_respawned, function(event) + local player = game.players[event.player_index] + player.insert{name="pistol", count=1} + player.insert{name="firearm-magazine", count=10} +end) + +script.on_event(defines.events.on_gui_click, function(event) + silo_script.on_gui_click(event) +end) + +script.on_init(function() + global.version = version + silo_script.on_init() +end) + +script.on_event(defines.events.on_rocket_launched, function(event) + silo_script.on_rocket_launched(event) +end) + +script.on_configuration_changed(function(event) + if global.version ~= version then + global.version = version + end + silo_script.on_configuration_changed(event) +end) + +silo_script.add_remote_interface() +silo_script.add_commands() ]===]) ---]] -- Multi-file test --[[ diff --git a/lib/scenarios/Hotpatch/hotpatch/gui.lua b/lib/scenarios/Hotpatch/hotpatch/gui.lua index 61786362..06acdbb1 100644 --- a/lib/scenarios/Hotpatch/hotpatch/gui.lua +++ b/lib/scenarios/Hotpatch/hotpatch/gui.lua @@ -1,5 +1,5 @@ local hotpatch_tools = require 'hotpatch.mod-tools' -hotpatch_tools.static_mod('hotpatch-gui', '1.0.3', [===[ +hotpatch_tools.static_mod('hotpatch-gui', '1.0.4', [===[ --[[ Copyright 2018 Chrisgbk @@ -75,7 +75,7 @@ script.on_event(defines.events.on_player_joined_game, function(e) main.destroy() end - button = top.add{type = 'sprite-button', name = 'hotpatch-button', sprite='utility/heat_exchange_indication', tooltip = 'Hotpatch'} + button = top.add{type = 'sprite-button', name = 'hotpatch-button', sprite='utility/heat_exchange_indication', tooltip = 'Hotpatch', style = mod_gui.button_style} end) local on_gui_click_handlers @@ -119,7 +119,7 @@ on_gui_click_handlers = { local IDE = center['hotpatch-IDE'] if not IDE then - IDE = center.add{type = 'frame', name = 'hotpatch-IDE', direction = 'vertical', caption = 'Hotpatch IDE'} + IDE = center.add{type = 'frame', name = 'hotpatch-IDE', direction = 'vertical', caption = 'Hotpatch IDE', style = mod_gui.frame_style} local top_flow = IDE.add{type = 'flow', name = 'hotpatch-IDE-top', direction = 'horizontal'} top_flow.add{type = 'label', name = 'hotpatch-IDE-mod-label', caption = 'Mod: '} local IDE_dropdown = top_flow.add{type = 'drop-down', name = 'hotpatch-IDE-mod-selector'} diff --git a/lib/scenarios/Hotpatch/hotpatch/mod-tools.lua b/lib/scenarios/Hotpatch/hotpatch/mod-tools.lua index 53d9c6d3..c75d77ad 100644 --- a/lib/scenarios/Hotpatch/hotpatch/mod-tools.lua +++ b/lib/scenarios/Hotpatch/hotpatch/mod-tools.lua @@ -810,8 +810,8 @@ end run_mod = function(loaded_index) local mod = loaded_mods[loaded_index] - local mod_name = mod.name if mod then + local mod_name = mod.name local old_global = mod.env.global if strict_mode then mod.env.global = {} diff --git a/lib/scenarios/Hotpatch/locale/af/freeplay.cfg b/lib/scenarios/Hotpatch/locale/af/freeplay.cfg new file mode 100644 index 00000000..e3aafe93 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/af/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Hierdie is Factorio vryspel. Jou taak is om 'n vuurpyl in die buitenste ruimte in te stuur. Doen dit deur die bou van 'n Vuurpyl Silo en van daar af 'n vuurpyl te lanseer met a satelliet aan boord. Jy sal baie gevorderde tegnologiëe moet navors om die Vuurpyl Silo te ontsluit. Begin klein, werk jou pad op met outomatisering en moenie vergeet om jouself te beskerm teen die inboorlinge nie. + + diff --git a/lib/scenarios/Hotpatch/locale/ar/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ar/freeplay.cfg new file mode 100644 index 00000000..86b6801a --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ar/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=.نييلصألا ناكسلا نم كسفن ةيامح ىسنت الو ةياهنلا ىلإ لصتل كتقيرطب لمعأو ،رفصلا نم أدبتس .خيراوصلا عماوص حتف لجأ نم ةمدقتم ايجولونكت نع ثحبلل جاتحت فوس .ةيعانصلا رامقألاب خيراوصلا قالطإو خيراوصلا عماوص ءانب قيرط نع كلذب مايقلا عيطتست .ءاضفلل اخوراص قلطت نا يه كتمهم .Factorio ـل رحلا بعللا وه اذه + + diff --git a/lib/scenarios/Hotpatch/locale/be/freeplay.cfg b/lib/scenarios/Hotpatch/locale/be/freeplay.cfg new file mode 100644 index 00000000..04f8637c --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/be/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Гэта рэжым свабоднай гульні Factorio. Вашая мэта - запусціць ракету ў космас. Дзеля гэтага вам трэба пабудаваць ракетную шахту і саму ракету з спадарожнікам. Вы мусіце даследваць перадавыя тэхналогіі, каб навучыцца будаваць ракетную шахту. Пачынайце з малога, працуйце над аўтаматызацыяй вытворчасці, даследуйце новыя тэхналогіі і не забывайцеся на абарону ад "тутэйшых"! + + diff --git a/lib/scenarios/Hotpatch/locale/bg/freeplay.cfg b/lib/scenarios/Hotpatch/locale/bg/freeplay.cfg new file mode 100644 index 00000000..50ca9458 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/bg/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Това е режимът на свободна игра. Задачата ви е да изстреляте ракета в космоса. За това ще е нужно да построите ракетна шахта и изстреляте ракетата със спътник. Ще трябва да проучите развити технологии, които ще отключат ракетната шахта. Започнете с малко и постепенно автоматизирайте процеса, като не забравяте да се защитавате от местните форми на живот. + + diff --git a/lib/scenarios/Hotpatch/locale/ca/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ca/freeplay.cfg new file mode 100644 index 00000000..e563ebae --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ca/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Aquest és el mode lliure del Factorio. La vostra tasca és construir un coet i enviar-lo a l'espai. Ho haureu de fer construint un centre de coets espacials i llençant un coet amb un satèl·lit. Necessitareu investigar tecnologies avançades per poder-ho fer. Aneu pas a pas, avanceu cap a l'automatització i no oblideu protegir-vos dels natius. + + diff --git a/lib/scenarios/Hotpatch/locale/cs/freeplay.cfg b/lib/scenarios/Hotpatch/locale/cs/freeplay.cfg new file mode 100644 index 00000000..145e382e --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/cs/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Toto je volná hra Factorio. Tvým úkolem je vypustit raketu do vesmíru. Postav raketové silo a vypusť raketu se satelitem. Pro odemknutí raketového sila budeš muset vyzkoumat pokročilé technologie. Začni v malém, postupuj s automatizací a nezapomeň se chránit před domorodci. + + diff --git a/lib/scenarios/Hotpatch/locale/da/freeplay.cfg b/lib/scenarios/Hotpatch/locale/da/freeplay.cfg new file mode 100644 index 00000000..f06d6237 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/da/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Det her er Factorio fri leg. Din opgave er at affyre en raket for at udforske rummet. For at gøre det skal du bygge en raket silo og affyre en raket med en satellit i. Du bliver nød til at udforske avancerede teknologier for at at kunne bygge en raket silo. Start småt, og arbejd din vej op med hjælp af automatisering, glem ikke at beskytte dig fra de indfødte. + + diff --git a/lib/scenarios/Hotpatch/locale/de/freeplay.cfg b/lib/scenarios/Hotpatch/locale/de/freeplay.cfg new file mode 100644 index 00000000..b1f81ade --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/de/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Dies ist das freie Spiel von Factorio. Deine Aufgabe ist es, eine Rakete in den Weltraum zu starten. Dazu musst Du ein Raketensilo bauen und eine Rakete mit einem Satelliten starten. Du wirst erweiterte Technologien erforschen müssen, um das Raketensilo freizuschalten. Fange klein an, arbeite Dich durch Automatisierung hoch und vergiss nicht, Dich vor den Einheimischen zu schützen. + + diff --git a/lib/scenarios/Hotpatch/locale/el/freeplay.cfg b/lib/scenarios/Hotpatch/locale/el/freeplay.cfg new file mode 100644 index 00000000..769bc117 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/el/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Αυτό είναι το ελεύθερο παιχνίδι του Factorio. Ο στόχος σου είναι να εκτοξεύσεις έναν πύραυλο στο διάστημα. Αυτό το κάνεις κατασκευάζοντας ένα σιλό πυραύλου και εκτοξεύοντας έναν πυραύλο με δορυφόρο. Θα πρέπει να ερευνήσεις προηγμένες τεχνολογίες για να ξεκλειδώσεις το σιλό πυραύλου. Ξεκινάς περιορισμένος, δούλεψε με αυτοματισμούς για την άνοδο σου και μην ξεχνάς να προστατέψεις τον εαυτό σου από τους ντόπιους. + + diff --git a/lib/scenarios/Hotpatch/locale/en/freeplay.cfg b/lib/scenarios/Hotpatch/locale/en/freeplay.cfg new file mode 100644 index 00000000..10cc632d --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/en/freeplay.cfg @@ -0,0 +1,2 @@ +msg-intro=This is the Factorio freeplay. Your task is to launch a rocket into space. Do this by constructing a Rocket Silo and launching a rocket with a satellite. You will need to research advanced technologies in order to unlock the Rocket Silo. Start small, work your way up with automation and don't forget to protect yourself from the natives. + diff --git a/lib/scenarios/Hotpatch/locale/eo/freeplay.cfg b/lib/scenarios/Hotpatch/locale/eo/freeplay.cfg new file mode 100644 index 00000000..8cafc148 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/eo/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Tio estas la Factorio Libera Ludado. Via tasko estas ĵeti raketon en spacon. Fari tiun per konstruanta Raketo Silo kaj ĵeti raketon kun satelito. Vi bezonos esplori altnivelaj teknologioj por malŝlosi la Raketo Silo. Start malgranda, labori vian vojon supren per aŭtomatigo kaj ne forgesu protekti vin mem de la indiĝenoj. + + diff --git a/lib/scenarios/Hotpatch/locale/es-ES/freeplay.cfg b/lib/scenarios/Hotpatch/locale/es-ES/freeplay.cfg new file mode 100644 index 00000000..56ddef04 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/es-ES/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Este es el modo de juego libre de Factorio. Tu tarea es la de lanzar un cohete al espacio. Logra esto construyendo un Silo de Cohetes y lanzando un cohete con un satélite. Necesitarás investigar tecnologías avanzadas para poder desbloquear el Silo de Cohetes. Comienza poco a poco, trabaja en tu sistema de automatización y no te olvides de protegerte de los nativos. + + diff --git a/lib/scenarios/Hotpatch/locale/et/freeplay.cfg b/lib/scenarios/Hotpatch/locale/et/freeplay.cfg new file mode 100644 index 00000000..c029a340 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/et/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=See on Factorio vabamäng. Sinu eesmärgiks on saata rakett avakosmosesse. Seda saad teha ehitades Raketi Silotorni ja lennutades Raketti koos satelliidiga. Selleks pead õppima selgeks keerukad tehnoloogiaharud, et Raketi Silotorni lahti lukustada. Alusta väikselt ning liigu edasi automatiseerimise abil ja ära unusta ennast kaitsta kohalike eluvormide eest. + + diff --git a/lib/scenarios/Hotpatch/locale/fi/freeplay.cfg b/lib/scenarios/Hotpatch/locale/fi/freeplay.cfg new file mode 100644 index 00000000..07881fa2 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/fi/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Tämä on Factorion vapaapelimuoto. Tavoitteesi on lähettää satelliitti ulkoavaruuteen rakentamalla rakettisiilo ja laukaisemalla raketti. Rakettisiilon voit rakentaa vasta, kun olet kehittänyt siihen tarvittavat huipputeknologiat. Aloita pienestä ja automatisoi kaikki tarvittava, äläkä unohda suojella itseäsi alkuasukkailta. + + diff --git a/lib/scenarios/Hotpatch/locale/fr/freeplay.cfg b/lib/scenarios/Hotpatch/locale/fr/freeplay.cfg new file mode 100644 index 00000000..b60de722 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/fr/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Il s'agit du mode de jeu libre de Factorio. Votre tâche consiste à lancer une fusée dans l'espace. Ceci en construisant un silo à fusée, et en lançant un satellite avec la fusée. Vous aurez besoin de rechercher des technologies de pointe afin de débloquer le silo. Commencez petit, évoluez en automatisant et n'oubliez pas de vous protéger contre les autochtones. + + diff --git a/lib/scenarios/Hotpatch/locale/he/freeplay.cfg b/lib/scenarios/Hotpatch/locale/he/freeplay.cfg new file mode 100644 index 00000000..664c2751 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/he/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=.םיימוקמה םירוציה ינפמ םכמצע לע ןגהל וחכשת לאו ,יטמוטוא ןוכימ תועצמאב םכלש הישעתה תא וביחרה ,ןטקב וליחתה .ןקתמה תיינב תא רשפאל ידכ תומדקתמ תויגולונכט רוקחל םכילע היהי .ןייוול ליכמה ליט ותועצמאב רגשלו םיליט רוגיש ןקתמ תונבל םכילע .ללחל ליט רגשל איה םכתמישמ .ויִרֹוטְקַפ לש ישפוחה שיחרתה והז + + diff --git a/lib/scenarios/Hotpatch/locale/hu/freeplay.cfg b/lib/scenarios/Hotpatch/locale/hu/freeplay.cfg new file mode 100644 index 00000000..cfe12672 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/hu/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Ez a Factorio szabad játék módja. A feladatod az, hogy kilőj egy rakétát az űr felderítésére. Ehhez egy Rakétasilót kell építened, melyből aztán egy műholddal felszerelt rakétát kell kilőnöd. A Rakétasiló kifejlesztéséhez különféle technológiákat kell fejlesztened. Kezdj kicsiben és küzdd fel magad az automatizálásban. Ne felejts el védekezni a honos fajok ellen. + + diff --git a/lib/scenarios/Hotpatch/locale/it/freeplay.cfg b/lib/scenarios/Hotpatch/locale/it/freeplay.cfg new file mode 100644 index 00000000..8906d682 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/it/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Questa è la modalità libera di Factorio. Il tuo obiettivo è quello di lanciare il razzo nello spazio. Completalo costruendo un Silo per Razzi e lanciando il razzo con il satellite. Avrai bisogno di ricercare tecnologie avanzate per riuscire a sbloccare il Silo per Razzi. Inizia in piccolo, espandi con l'automazione e non dimenticare di proteggerti dai nativi. + + diff --git a/lib/scenarios/Hotpatch/locale/ja/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ja/freeplay.cfg new file mode 100644 index 00000000..83994d04 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ja/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=これは、Factorioのフリープレイです。ロケットサイロを建造し、衛星を載せたロケットを宇宙へ打ち上げるのがあなたの任務です。ロケットサイロをアンロックするためには高度な技術研究をする必要があります。小規模に始め、自動化しつつ進み、原住生物から身を守ることも忘れないでください。 + + diff --git a/lib/scenarios/Hotpatch/locale/ko/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ko/freeplay.cfg new file mode 100644 index 00000000..cfd96b36 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ko/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Factorio 자유플레이입니다. 당신의 목표는 우주로 로켓을 발사하는 것입니다. 로켓 격납고를 건설하고 인공위성을 탑재한 로켓을 발사하여 이 목표를 달성하세요. 로켓 격납고의 잠금을 해제하기 위해 고급 기술들을 연구할 필요가 있습니다. 작은 것부터 시작해 자동화로 차근차근 발전하고, 토착 생물로부터 자신을 보호하는 것도 잊지 마세요. + + diff --git a/lib/scenarios/Hotpatch/locale/lt/freeplay.cfg b/lib/scenarios/Hotpatch/locale/lt/freeplay.cfg new file mode 100644 index 00000000..3e3b01fe --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/lt/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Tai Factorio laisvas žaidimas. Jūsų užduotis - paleisti raketą į kosmosą. Tam reikia pastatyti Raketos šachtą ir paleisti raketą su palydovu. Reikės atrasti pažangias technologijas kad atrakintumėte Raketos šachtą. Pradėkite palengva, tobulinkite automatiką ir neužmirškite apsisaugoti nuo vietinių. + + diff --git a/lib/scenarios/Hotpatch/locale/lv/freeplay.cfg b/lib/scenarios/Hotpatch/locale/lv/freeplay.cfg new file mode 100644 index 00000000..581e4b52 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/lv/freeplay.cfg @@ -0,0 +1,2 @@ +msg-intro=Šis ir Factorio brīvais režīms. Tavs uzdevums ir palaist raķeti kosmosā. Lai to izdarītu, tev vajadzēs uzbūvēt palaišanas platformu un palaist raķeti ar satelītu. Tev būs jāizpēta sarežģītas tehnoloģijas, lai atbloķētu palaišanas platformu. Sāc no mazumiņa, strādā un neaizmirsti pasargāt sevi no šīs planētas iemītniekiem... + diff --git a/lib/scenarios/Hotpatch/locale/nl/freeplay.cfg b/lib/scenarios/Hotpatch/locale/nl/freeplay.cfg new file mode 100644 index 00000000..3086e01f --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/nl/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Dit is Factorio vrij spel. Je taak is om een raket te lanceren in de ruimte. Bouw hiervoor een raket-silo en lanceer een raket met een satelliet. Je zult geavanceerde technologieën moeten onderzoeken om de raket-silo vrij te spelen. Begin op kleine schaal, breidt uit en automatiseer je fabriek en vergeet niet jezelf te beschermen tegen de inheemse bewoners. + + diff --git a/lib/scenarios/Hotpatch/locale/no/freeplay.cfg b/lib/scenarios/Hotpatch/locale/no/freeplay.cfg new file mode 100644 index 00000000..5fb97c8f --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/no/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Dette er Factorio frispilling. Din oppgave er å sende en rakett til verdensrommet. Bygg en rakettsilo og send opp en rakett med en satellitt. Du blir nødt til å utforske avanserte teknologier for å få tilgang til rakettsiloen. Begynn i det små, jobb deg oppover med hjelp av automatisering, men ikke glem å beskytte deg mot de innfødte. + + diff --git a/lib/scenarios/Hotpatch/locale/pl/freeplay.cfg b/lib/scenarios/Hotpatch/locale/pl/freeplay.cfg new file mode 100644 index 00000000..323dfb81 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/pl/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=To jest swobodna rozgrywka Factorio. Twoim zadaniem jest wysłanie rakiety w kosmos. Skonstruuj silos rakietowy i wystrzel z niego rakietę z satelitą. Żeby odblokować silos rakietowy będziesz musiał odkryć zaawansowane technologie. Rozpocznij od podstaw, rozwijaj się wykorzystując automatyzację i nie zapomnij o obronie przed rodzimymi mieszkańcami planety. + + diff --git a/lib/scenarios/Hotpatch/locale/pt-BR/freeplay.cfg b/lib/scenarios/Hotpatch/locale/pt-BR/freeplay.cfg new file mode 100644 index 00000000..cdb5557d --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/pt-BR/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Este é o modo livre do Factorio. Sua missão é lançar um foguete no espaço. Para fazer isso construa um centro de lançamento de foguetes e lance o foguete com um satélite. Você vai precisar pesquisar tecnologias avançadas para conseguir desbloquear um Centro de lançamento. Comece do começo, continue na automação e não se esqueça de se proteger dos nativos. + + diff --git a/lib/scenarios/Hotpatch/locale/pt-PT/freeplay.cfg b/lib/scenarios/Hotpatch/locale/pt-PT/freeplay.cfg new file mode 100644 index 00000000..030b54ce --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/pt-PT/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Este é o jogo livre Factorio. A tua tarefa é lançar um foguetão para explorar o espaço. Faça isto, construindo um Silo de Foguetão e lançar um foguetão com um satélite. Tu vais precisar de pesquisar tecnologias avançadas para poderes desbloquear o Silo de Foguetão. Começa simples, trabalha e evolui com a automação e não te esqueças de proteger-te dos nativos. + + diff --git a/lib/scenarios/Hotpatch/locale/ro/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ro/freeplay.cfg new file mode 100644 index 00000000..134ce290 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ro/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Acesta este modul Factorio freeplay. Sarcina ta este de a lansa o rachetă în spațiu. Fă acest lucru prin construirea unui siloz de rachete și lansarea unei rachete cu satelit. Va trebui să cercetezi tehnologiile avansate pentru a debloca silozul de rachete. Începe încet, avansează cu automatizarea și nu uita să te protejezi de inamici. + + diff --git a/lib/scenarios/Hotpatch/locale/ru/freeplay.cfg b/lib/scenarios/Hotpatch/locale/ru/freeplay.cfg new file mode 100644 index 00000000..0cc1b040 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/ru/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Это режим свободной игры Factorio. Ваша задача запустить спутник в космос. Для его запуска потребуется создать ракету и ракетную шахту. Начните с малого, работайте над автоматизацией производства, исследуйте новые технологии и не забывайте о защите от местных форм жизни. + + diff --git a/lib/scenarios/Hotpatch/locale/sk/freeplay.cfg b/lib/scenarios/Hotpatch/locale/sk/freeplay.cfg new file mode 100644 index 00000000..ea4bb174 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/sk/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Toto je voľná hra Factorio. Tvojou úlohou je vypustiť raketu do vesmíru. Postav raketové silo a vypusti raketu so satelitom. Pre odomknutie raketového sila budeš musieť vyskúmať pokročilé technológie. Začni v malom, postupuj s automatizáciou a nezabnudni sa chrániť pred domácimi. + + diff --git a/lib/scenarios/Hotpatch/locale/sl/freeplay.cfg b/lib/scenarios/Hotpatch/locale/sl/freeplay.cfg new file mode 100644 index 00000000..b919dd8a --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/sl/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=To je Factorio freeplay. Vaša naloga je poslati raketo v vesolje. To storite tako, da zgradite silos za raketo in jo skupaj s satelitom izstrelite v vesolje. Raziskati bo potrebno napredne tehnologije, da bi lahko odklenili Raketni silos. Začnete z majhnim, nato nadgradite vse s pomočjo avtomatizacije in ne pozabite, zaščitite se pred domorodci. + + diff --git a/lib/scenarios/Hotpatch/locale/sr/freeplay.cfg b/lib/scenarios/Hotpatch/locale/sr/freeplay.cfg new file mode 100644 index 00000000..3a449cd4 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/sr/freeplay.cfg @@ -0,0 +1,2 @@ +msg-intro=Ово је Factorio freeplay. Твој задатак је да лансираш ракету са сателитом у свемир. Уради ово грађом ракетног силоса. Треба да истражиш пуно напредних технологија да би откључао ракетни силос. Почни мало, а онда напредуј са аутоматизацијом и не заборави да се заштитиш од ванземаљаца. + diff --git a/lib/scenarios/Hotpatch/locale/sv-SE/freeplay.cfg b/lib/scenarios/Hotpatch/locale/sv-SE/freeplay.cfg new file mode 100644 index 00000000..72fabb9b --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/sv-SE/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Det här är Factorio frispel. Ditt uppdrag är att avfyra en raket ut i rymden. Gör det genom att tillverka en raket silo och avfyra en raket med en satellit. Du kommer att behöva forska fram avancerade teknologier för att kunna låsa upp raket silon. Börja smått, jobba dig uppåt med hjälp av automatisering och glöm inte att försvara dig själv mot infödingarna. + + diff --git a/lib/scenarios/Hotpatch/locale/th/freeplay.cfg b/lib/scenarios/Hotpatch/locale/th/freeplay.cfg new file mode 100644 index 00000000..067594bd --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/th/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=นี้คือโหมดอิสระของ Factorio ภารกิจของคุณคือส่งจรวดสู่อวกาศ ซึ่งทำได้โดยการสร้างไซโลจรวดและส่งจรวดขึ้นไปพร้อมกับดาวเทียม คุณต้องวิจัยค้นคว้าเทคโนโลยีขั้นสูงเพื่อปลดล็อคไซโลจรวด เริ่มจากเล็กๆไปเรื่อยๆด้วยระบบอัตโนมัติและอย่าลืมป้องกันตัวเองจากคนพื้นเมืองด้วย + + diff --git a/lib/scenarios/Hotpatch/locale/tr/freeplay.cfg b/lib/scenarios/Hotpatch/locale/tr/freeplay.cfg new file mode 100644 index 00000000..321f0ea9 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/tr/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Bu Factorio'nun serbest oynanışı. Görevin roketleri uzaya yollamak. Bunu Roket Silosu yaparak ve uyduyla roket yollayarak yapacaksın. Roket Silo'sunu açmak için gelişmiş teknolojileri sırayla açmalısın. Yavaş başla, otomatikleş ve yerlilerden kendini korumayı untuma. + + diff --git a/lib/scenarios/Hotpatch/locale/uk/freeplay.cfg b/lib/scenarios/Hotpatch/locale/uk/freeplay.cfg new file mode 100644 index 00000000..1c494050 --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/uk/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Це один з типів гри в Factorio - "Вільна гра". Ваше завдання - запустити ракету у космічний простір. Зробіть це, побудувавши ракетну шахту та запустивши ракету зі супутником. Вам потрібно дослідити передові технології, щоб мати змогу побудувати ракетну шахту. Починайте з малого, розвивайтеся за допомогою автоматизації, але не забувайте і про оборону! + + diff --git a/lib/scenarios/Hotpatch/locale/vi/freeplay.cfg b/lib/scenarios/Hotpatch/locale/vi/freeplay.cfg new file mode 100644 index 00000000..a158815c --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/vi/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=Đầy là chế độ freeplay của Factorio. Nhiệm cụ của bạn là phóng một chiếc tên lửa lên vũ trụ. Hãy xây dựng một bệ phóng tên lửa để phóng một chiếc tên lửa kèm theo vệ tinh. Bạn sẽ cần phải nghiên cứu nhiều công nghệ tiên tiến để có thể xây dựng bệ phóng tên lửa. Bắt đầu từ quy mô nhỏ, phát triển dần dần bằng tự động hóa, và đừng quên bảo vệ bản thân mình khỏi những sinh vật sinh sống ở đây. + + diff --git a/lib/scenarios/Hotpatch/locale/zh-CN/freeplay.cfg b/lib/scenarios/Hotpatch/locale/zh-CN/freeplay.cfg new file mode 100644 index 00000000..122bf6fc --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/zh-CN/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=欢迎来到异星工厂标准模式,你的目标是要把火箭发射到太空。为此你需要研发一系列高等科技,解锁并修建火箭发射井,直到把携带有卫星的火箭发射出去。从小作坊生产起步,逐渐建立起属于自己的自动化大工厂吧!同时,别忘了防范异星虫子的骚扰 ... + + diff --git a/lib/scenarios/Hotpatch/locale/zh-TW/freeplay.cfg b/lib/scenarios/Hotpatch/locale/zh-TW/freeplay.cfg new file mode 100644 index 00000000..e4e9d1cb --- /dev/null +++ b/lib/scenarios/Hotpatch/locale/zh-TW/freeplay.cfg @@ -0,0 +1,3 @@ +msg-intro=這是異星工廠的自由模式。你的任務是發射火箭,探索外太空。請建造一個火箭發射井,並發射攜帶著衛星的火箭。你會需要研究大量的進階科技以解鎖火箭發射井。從頭開始,靠著自動化科技的協助向目標邁進時,也別忘記從外星住民手的中保護你自己啊! + + diff --git a/node_modules/_app/clusterTools/index.js b/node_modules/_app/clusterTools/index.js index 737b2d1d..40475890 100644 --- a/node_modules/_app/clusterTools/index.js +++ b/node_modules/_app/clusterTools/index.js @@ -7,7 +7,7 @@ Functions frequently needed from different places in the cluster. Ex: */ -module.exports = {config} => { +module.exports = ({config} = {}) => ({ /** async function to get Lua from a file, remove comments, minify and return. @@ -38,4 +38,4 @@ module.exports = {config} => { Promise resolves with a string of Lua. */ getCommand: require("./getCommand.js"), -} \ No newline at end of file +}) \ No newline at end of file diff --git a/sharedPlugins/scenario_loader/config.js b/sharedPlugins/scenario_loader/config.js new file mode 100644 index 00000000..98acf05e --- /dev/null +++ b/sharedPlugins/scenario_loader/config.js @@ -0,0 +1,10 @@ +/* + Clusterio plugin for loading softmod scenarios using Hotpatch + To load a scenario, simply drop it inside sharedPlugins/scenario_loader/scenarios/ +*/ +module.exports = { + name: "scenario_loader", + version: "1.0.0", + binary: "nodePackage", + description: "Simple way to load scenarios using Hotpatch" +} diff --git a/sharedPlugins/scenario_loader/index.js b/sharedPlugins/scenario_loader/index.js new file mode 100644 index 00000000..24c04a54 --- /dev/null +++ b/sharedPlugins/scenario_loader/index.js @@ -0,0 +1,53 @@ +const fs = require("fs-extra"); +const path = require("path"); +const clusterTools = require("_app/clusterTools")(); + +module.exports = class remoteCommands { + constructor(mergedConfig, messageInterface, extras){ + this.messageInterface = messageInterface; + this.config = mergedConfig; + + (async () => { + let hotpatchInstallStatus = await this.checkHotpatchInstallation(); + messageInterface("Hotpach installation status: "+hotpatchInstallStatus); + if(hotpatchInstallStatus){ + let scenarioDir = path.join(__dirname, "scenarios"); + await fs.ensureDir(scenarioDir) + let scenarios = await fs.readdir(scenarioDir); + for(let i = 0; i < scenarios.length; i++){ + let scenPath = path.join(scenarioDir, scenarios[i]); + let stat = await fs.stat(scenPath); + if(stat.isDirectory){ + let scenario = await fs.readdir(scenPath); + let files = {}; + for(let o = 0; o < scenario.length; o++){ + let fileName = scenario[o]; + if(fileName.split(".")[1] && fileName.split(".")[1].toLowerCase() == "lua"){ + messageInterface(`Loading ${scenarios[i]}/${fileName}`); + let code = await clusterTools.getLua(path.join(scenPath, fileName), false); + files[fileName.split(".")[0]] = code; + } + } + let fileImportString = `\{`; + for(let k in files){ + fileImportString += `${k} = '${files[k]}, '`; + } + fileImportString += `\}`; + + if(files.control) var returnValue = await messageInterface(`/silent-command remote.call('hotpatch', 'update', '${scenarios[i]}', '1.0.0', '${files.control}', ${fileImportString})`); + if(returnValue) messageInterface(returnValue); + } + } + } + })(); + } + async checkHotpatchInstallation(){ + let yn = await this.messageInterface("/silent-command if remote.interfaces['hotpatch'] then rcon.print('true') else rcon.print('false') end"); + yn = yn.replace(/(\r\n\t|\n|\r\t)/gm, ""); + if(yn == "true"){ + return true; + } else if(yn == "false"){ + return false; + } + } +}