From 25477dd8618d2823939899707f1cf54144a86be0 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 5 May 2024 15:49:10 -0400 Subject: [PATCH] texturepack.js --- mods/10kelements.js | 8 ++++ mods/texturepack.js | 94 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 mods/texturepack.js diff --git a/mods/10kelements.js b/mods/10kelements.js index 957d4088..711a4ea6 100644 --- a/mods/10kelements.js +++ b/mods/10kelements.js @@ -74,6 +74,14 @@ if (Math.abs(settings.randomcount) == settings.randomcount){ }else(elements["element_"+i].desc += (" or " + reaction)) } } + for (var reaction in elements["element_" + i].reactions){ + if (elements[elements["element_"+i].reactions[reaction].elem1].category == "tools" || elements[elements["element_"+i].reactions[reaction].elem2].category == "tools"){ + console.log(i + " makes a tool...? when it touches " + reaction) + if (!elements["element_"+i].desc){ + elements["element_" + i].desc = "This breaks the laws of physics if it touches " + reaction + }else(elements["element_"+i].desc += (" or " + reaction)) + } + } } } else { for (var i = 1; i <= settings.randomcount; i++){ diff --git a/mods/texturepack.js b/mods/texturepack.js new file mode 100644 index 00000000..fdb9de06 --- /dev/null +++ b/mods/texturepack.js @@ -0,0 +1,94 @@ +if (!settings.texturepack){ + settings.texturepack = {} + saveSettings() +} +elements.clear_textures = { + color: "#dd0000", + onSelect: function(){ + var sure = prompt("Are you sure you wanna reset all texture data? Type \"yes\". Also, refresh once you've done this for the changes to apply!", "no"); + if (sure == "yes"){ + settings.texturepack = {} + saveSettings() + } + }, + canPlace: false, + category: "texture tools" +} +var addSave = null +elements.add_texture = { + color: elements.rainbow.color, + category: "texture tools", + canPlace: false, + onSelect: function(){ + var whoelement = prompt("What element would you like to change the texture of? Type no if this was a mistake.", (addSave||"no")) + if (whoelement != "no"){ + addSave = whoelement + var replacehm = prompt("Would you like to overwrite all textures or add? 1 for overwrite, 2 for add.", 2) + var colortodo = prompt("Hex code, please! Also, refresh once you've done this for the changes to apply!", "#ff0000") + if (replacehm == 1){ + if (!replacehm || !colortodo){return} + if (!settings.texturepack[whoelement]){settings.texturepack[whoelement] = []} + settings.texturepack[whoelement] = [colortodo] + elements[whoelement].color = settings.texturepack[whoelement] + saveSettings() + } else { + if (!replacehm || !colortodo){return} + if (!settings.texturepack[whoelement]){settings.texturepack[whoelement] = []} + settings.texturepack[whoelement].push(colortodo) + elements[whoelement].color = settings.texturepack[whoelement] + saveSettings() + } + } + } +} +elements.remove_a_texture = { + color: elements.void.color, + category: "texture tools", + canPlace: false, + onSelect: function(){ + var whoelement = prompt("What element would you like to change the texture of? Type no if this was a mistake.", "no") + if (whoelement != "no"){ + var replacehm = prompt("Would you like to delete all textures of the element or just one? Type 1 for all, 2 for just one.", 2) + var colortodo = prompt(("Ignore this if you chose 1. Index of the color you wanna delete. For reference, here are the current colors:" + settings.texturepack[whoelement]), 0) + if (replacehm == 1){ + delete settings.texturepack[whoelement] + saveSettings() + } else { + delete settings.texturepack[whoelement][colortodo] + elements[whoelement].color = settings.texturepack[whoelement] + saveSettings() + } + } + } +} +elements.list_all_textures = { + color: elements.mix.color, + category: "texture tools", + canPlace: false, + onSelect: function(){ + var whoelement = prompt("What element would you like to see the textures of?") + alert(whoelement + " has the following textures: " + settings.texturepack[whoelement]) + } +} +elements.texture_pack_share_or_load = { + color: elements.image.color, + category: "texture tools", + canPlace: false, + onSelect: function(){ + var whichSL = prompt("Would you like to copy the texture pack to your clipboard or load it from your clipboard? Type 1 for copy, 2 for load.", 1) + if (whichSL == 1){ + var text = JSON.stringify(settings.texturepack) + alert(text) + } else { + var text = prompt("Paste your texture pack here. It should be in the format of a JSON object.") + if (text){ + settings.texturepack = JSON.parse(text) + saveSettings() + } + } + } +} +if (settings.texturepack){ +for (var elementi in settings.texturepack){ + elements[elementi].color = settings.texturepack[elementi] +}} \ No newline at end of file