From 834826faa3160177e88dab3726d7e8e51077491d Mon Sep 17 00:00:00 2001 From: sq <134925668+SquareScreamYT@users.noreply.github.com> Date: Sun, 30 Mar 2025 18:03:12 +0800 Subject: [PATCH 1/2] Create modlangs.js --- mods/modlangs.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 mods/modlangs.js diff --git a/mods/modlangs.js b/mods/modlangs.js new file mode 100644 index 00000000..264e09ac --- /dev/null +++ b/mods/modlangs.js @@ -0,0 +1,53 @@ +function add_lang(langcode) { + for (element in elements) { + if (elements[element]["name_"+langcode]) { + lang[element] = elements[element]["name_"+langcode]; + } + } +} + +/* +INSTRUCTIONS + +put this code at the top of your mod: +set langcode to whatever language code (zh_cn is simplified chinese) + + + +langcode = "zh_cn" + +var mods_to_include = ["mods/modlangs.js"] + +var mods_included = mods_to_include.map(mod => enabledMods.includes(mod)); +var all_mods_included = mods_included.reduce(function(a,b) { return a && b }); + +if(!all_mods_included) { + var mods_needed = mods_to_include.filter(function(modPath) { return !(enabledMods.includes(modPath)) }); + + mods_needed.forEach(function(modPath) { + enabledMods.splice(enabledMods.indexOf("mods/modlangs"),0,modPath); + }); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); +} + +runAfterLoad(function() { + add_lang(langcode) +}) + + + +then you can add the name_ + langcode to your element like this: + +elements.eat = { + color: ["#ffba79","#efff79"], + tool: function(pixel) { + if (elements[pixel.element].isFood || elements[pixel.element].category === "food" || eLists.JUICEMIXABLE.includes(pixel.element) || elements[pixel.element].id === elements.uranium.id || elements[pixel.element].id === elements.mercury.id) { + deletePixel(pixel.x, pixel.y); + } + }, + category: "tools", + desc: "Eats pixels.", + name_zh_cn: "吃" +} + +*/ From 25f6f0ab6735351d80881eac0440d0dce678ef46 Mon Sep 17 00:00:00 2001 From: sq <134925668+SquareScreamYT@users.noreply.github.com> Date: Sun, 30 Mar 2025 18:05:24 +0800 Subject: [PATCH 2/2] modlangs thing --- mod-list.html | 1 + 1 file changed, 1 insertion(+) diff --git a/mod-list.html b/mod-list.html index 9d8433b3..22b01ff6 100644 --- a/mod-list.html +++ b/mod-list.html @@ -418,6 +418,7 @@