From 5a81639292c5db0c25884f8c98844af94ebdaed1 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Wed, 27 Aug 2025 19:49:45 -0400 Subject: [PATCH] Steam mod compatibility --- mods/elementEraser.js | 16 ++++++++++------ mods/replace.js | 44 +++++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/mods/elementEraser.js b/mods/elementEraser.js index c2c5ceef..37f1b183 100644 --- a/mods/elementEraser.js +++ b/mods/elementEraser.js @@ -4,9 +4,11 @@ let finalEraseElement = null; elements.element_eraser = { color: "#eeeeee", onSelect: function() { - var answer = prompt("Please input the element you wish to delete. It will not work if you enter multiple element types while paused.",(finalEraseElement||undefined)); - if (!answer) { return } - finalEraseElement = mostSimilarElement(answer); + promptInput("Please input the element you wish to delete. It will not work if you enter multiple element types while paused.", (answer) => { + // var answer = prompt("Please input the element you wish to delete. It will not work if you enter multiple element types while paused.",(finalEraseElement||undefined)); + if (!answer) { return } + finalEraseElement = mostSimilarElement(answer); + }, "Delete Element") }, tool: function(pixel) { if (pixel.element === finalEraseElement) { @@ -21,9 +23,11 @@ let finalEraseElement2 = null; elements.exclusive_element_eraser = { color: "#eeeeee", onSelect: function() { - var answer = prompt("Please input the element you do not wish to delete. It will not work if you enter multiple element types while paused.",(finalEraseElement2||undefined)); - if (!answer2) { return } - finalEraseElement2 = mostSimilarElement(answer2); + promptInput("Please input the element you do not wish to delete. It will not work if you enter multiple element types while paused.", (answer2) => { + // var answer2 = prompt("Please input the element you do not wish to delete. It will not work if you enter multiple element types while paused.",(finalEraseElement2||undefined)); + if (!answer2) { return } + finalEraseElement2 = mostSimilarElement(answer2); + }, "Don't Delete") }, tool: function(pixel) { if (pixel.element != finalEraseElement2) { diff --git a/mods/replace.js b/mods/replace.js index c458b5bf..eaf374c4 100644 --- a/mods/replace.js +++ b/mods/replace.js @@ -10,26 +10,30 @@ document.addEventListener("keydown", function(e) { //replace prompt listener }); function replaceElementPrompt() { - var fromElement = prompt("Enter the element you want to change"); - // replace spaces with underscores - fromElement = fromElement.replace(/ /g, "_"); - fromElementS = mostSimilarElement(fromElement); - if (fromElementS === null || fromElementS === undefined || fromElementS === "") { - alert("Element \"" + fromElement + "\" not found! Defaulting to rock."); - fromElementS = "rock"; - }; - - var toElement = prompt("Enter what you want to replace \"" + fromElementS + "\" with"); - // replace spaces with underscores - toElement = toElement.replace(/ /g, "_"); - toElementS = mostSimilarElement(toElement); - if (toElementS === null || toElementS === undefined || toElementS === "") { - alert("Element \"" + toElement + "\" not found! Defaulting to sand."); - toElementS = "sand"; - }; - replaceFrom = fromElementS; - replaceTo = toElementS; - updateReplaceDescriptions(); + promptInput("Enter the element you want to change", (fromElement) => { + // var fromElement = prompt("Enter the element you want to change"); + // replace spaces with underscores + fromElement = fromElement.replace(/ /g, "_"); + fromElementS = mostSimilarElement(fromElement); + if (fromElementS === null || fromElementS === undefined || fromElementS === "") { + alert("Element \"" + fromElement + "\" not found! Defaulting to rock."); + fromElementS = "rock"; + }; + + promptInput("Enter what you want to replace \"" + fromElementS + "\" with", (toElement) => { + // var toElement = prompt("Enter what you want to replace \"" + fromElementS + "\" with"); + // replace spaces with underscores + toElement = toElement.replace(/ /g, "_"); + toElementS = mostSimilarElement(toElement); + if (toElementS === null || toElementS === undefined || toElementS === "") { + alert("Element \"" + toElement + "\" not found! Defaulting to sand."); + toElementS = "sand"; + }; + replaceFrom = fromElementS; + replaceTo = toElementS; + updateReplaceDescriptions(); + },"Replace With") + },"Replace Element") } function updateReplaceDescriptions() {