sandboxels/mods/elementEraser.js

41 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-03-08 21:48:51 -05:00
// made by SquareScreamYT/sqec
let finalEraseElement = null;
elements.element_eraser = {
color: "#eeeeee",
onSelect: function() {
2025-08-27 19:49:45 -04:00
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")
2024-03-08 21:48:51 -05:00
},
tool: function(pixel) {
if (pixel.element === finalEraseElement) {
deletePixel(pixel.x,pixel.y)
}
},
category: "tools",
excludeRandom: true,
2024-03-25 20:43:05 -04:00
desc: "Use on pixels to delete specified element."
}
let finalEraseElement2 = null;
elements.exclusive_element_eraser = {
color: "#eeeeee",
onSelect: function() {
2025-08-27 19:49:45 -04:00
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")
2024-03-25 20:43:05 -04:00
},
tool: function(pixel) {
if (pixel.element != finalEraseElement2) {
deletePixel(pixel.x,pixel.y)
}
},
category: "tools",
excludeRandom: true,
desc: "Use on pixels to delete any element except the specified element."
2024-03-08 21:48:51 -05:00
}