Steam mod compatibility

This commit is contained in:
slweeb 2025-08-27 19:49:45 -04:00
parent f1f025ae9f
commit 5a81639292
2 changed files with 34 additions and 26 deletions

View File

@ -4,9 +4,11 @@ let finalEraseElement = null;
elements.element_eraser = { elements.element_eraser = {
color: "#eeeeee", color: "#eeeeee",
onSelect: function() { 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)); promptInput("Please input the element you wish to delete. It will not work if you enter multiple element types while paused.", (answer) => {
if (!answer) { return } // 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));
finalEraseElement = mostSimilarElement(answer); if (!answer) { return }
finalEraseElement = mostSimilarElement(answer);
}, "Delete Element")
}, },
tool: function(pixel) { tool: function(pixel) {
if (pixel.element === finalEraseElement) { if (pixel.element === finalEraseElement) {
@ -21,9 +23,11 @@ let finalEraseElement2 = null;
elements.exclusive_element_eraser = { elements.exclusive_element_eraser = {
color: "#eeeeee", color: "#eeeeee",
onSelect: function() { 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)); promptInput("Please input the element you do not wish to delete. It will not work if you enter multiple element types while paused.", (answer2) => {
if (!answer2) { return } // 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));
finalEraseElement2 = mostSimilarElement(answer2); if (!answer2) { return }
finalEraseElement2 = mostSimilarElement(answer2);
}, "Don't Delete")
}, },
tool: function(pixel) { tool: function(pixel) {
if (pixel.element != finalEraseElement2) { if (pixel.element != finalEraseElement2) {

View File

@ -10,26 +10,30 @@ document.addEventListener("keydown", function(e) { //replace prompt listener
}); });
function replaceElementPrompt() { function replaceElementPrompt() {
var fromElement = prompt("Enter the element you want to change"); promptInput("Enter the element you want to change", (fromElement) => {
// replace spaces with underscores // var fromElement = prompt("Enter the element you want to change");
fromElement = fromElement.replace(/ /g, "_"); // replace spaces with underscores
fromElementS = mostSimilarElement(fromElement); fromElement = fromElement.replace(/ /g, "_");
if (fromElementS === null || fromElementS === undefined || fromElementS === "") { fromElementS = mostSimilarElement(fromElement);
alert("Element \"" + fromElement + "\" not found! Defaulting to rock."); if (fromElementS === null || fromElementS === undefined || fromElementS === "") {
fromElementS = "rock"; 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 promptInput("Enter what you want to replace \"" + fromElementS + "\" with", (toElement) => {
toElement = toElement.replace(/ /g, "_"); // var toElement = prompt("Enter what you want to replace \"" + fromElementS + "\" with");
toElementS = mostSimilarElement(toElement); // replace spaces with underscores
if (toElementS === null || toElementS === undefined || toElementS === "") { toElement = toElement.replace(/ /g, "_");
alert("Element \"" + toElement + "\" not found! Defaulting to sand."); toElementS = mostSimilarElement(toElement);
toElementS = "sand"; if (toElementS === null || toElementS === undefined || toElementS === "") {
}; alert("Element \"" + toElement + "\" not found! Defaulting to sand.");
replaceFrom = fromElementS; toElementS = "sand";
replaceTo = toElementS; };
updateReplaceDescriptions(); replaceFrom = fromElementS;
replaceTo = toElementS;
updateReplaceDescriptions();
},"Replace With")
},"Replace Element")
} }
function updateReplaceDescriptions() { function updateReplaceDescriptions() {