From edb3d7d8598c4e28350a6227f026f055a0795091 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 17 Mar 2024 17:05:46 -0400 Subject: [PATCH] bug fixes --- mods/a_mod_by_alice.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/mods/a_mod_by_alice.js b/mods/a_mod_by_alice.js index 873f89a3..0b5bda76 100644 --- a/mods/a_mod_by_alice.js +++ b/mods/a_mod_by_alice.js @@ -14,6 +14,13 @@ try { //ESSENTIAL COMMON FUNCTIONS (CODE LIBRARY) ## + //DEBUGGING + + function logAndReturn(thing) { + console.log(thing); + return thing + }; + //URL urlParams = new URLSearchParams(window.location.search); @@ -493,7 +500,7 @@ try { if(!color.startsWith("hsl(") || !color.endsWith(")")) { throw new Error(`The color ${color} is not a valid hsl() color`) }; - var colorTempArray = color.split(",") + var colorTempArray = color.split(",").map(x => x.trim()) if(colorTempArray.length !== 3) { throw new Error(`The color ${color} is not a valid hsl() color`) }; @@ -2101,6 +2108,8 @@ try { if(pixelIndex !== -1) { currentPixels.splice(pixelIndex,1) if (pixelMap[x][y]) { delete pixelMap[x][y] }; + } else { + return false }; //if (pixelMap[x][y]) {pixelMap[x][y].del = true} //if (pixelMap[x][y]) { delete pixelMap[x][y] }; @@ -21260,10 +21269,13 @@ Pixel size (rendering only): (Use if the save looks cut o tempLow: Math.min(rockInfo.tempHigh - 100,800), stateLow: rockName, density: rockInfo.density * 0.9, - hardness: rockInfo.density * 0.85, //breakInto: newName + "_gravel", _data: [rockData[0], rockData[1], hotData2Switch(rockData[2])], }; + + if(rockInfo.hardness) { + elements[newName].hardness = rockInfo.hardness * 0.85 + }; //console.log([elements[rockName].tempHigh,elements[rockName].stateHigh]); //console.log([elements[newName].tempLow,elements[newName].stateLow]) @@ -45937,14 +45949,15 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa //SPECIFY CURRENT ELEMENT ON LOAD ## window.addEventListener("load",function() { - //console.log(currentElement); currentElement = urlParams.get("currentElement") ?? "sand"; - //console.log(currentElement); if(!elementExists(currentElement)) { - //console.log(false); currentElement = "sand" - }// else { console.log(true) }; - //console.log(currentElement); + } + var size = urlParams.get("mouseSize") ?? 5; + if(isNaN(size)) { + size = 5; + }; + mouseSize = size }); //MISCELLANEOUS CHANGES ##