bug ficses 2

This commit is contained in:
An Orbit 2024-06-26 11:14:49 -04:00 committed by GitHub
parent fea3412270
commit 97555565fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 59 additions and 49 deletions

View File

@ -5117,7 +5117,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
else { else {
var rgb = elements[element].colorObject; // {r, g, b} var rgb = elements[element].colorObject; // {r, g, b}
// If rgb is an array, choose a random item // If rgb is an array, choose a random item
if (Array.isArray(rgb)) { while(Array.isArray(rgb)) {
rgb = rgb[Math.floor(Math.random() * rgb.length)]; rgb = rgb[Math.floor(Math.random() * rgb.length)];
} }
} }
@ -5129,7 +5129,14 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
} else { } else {
offsetAmount = elementInfo?.maxColorOffset ?? defaultColorOffset; offsetAmount = elementInfo?.maxColorOffset ?? defaultColorOffset;
}; };
if(typeof(rgb) !== "object") { rgb = convertColorFormats(rgb,"json") }; //somehow rgb can be a hex triplet even though it's pulled from the f*cking JSON color object and there's no logical way that that should be able to happen
var maxColorOffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * offsetAmount); var maxColorOffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * offsetAmount);
if((typeof(rgb?.r) !== "number") || (typeof(rgb?.g) !== "number") || (typeof(rgb?.b) !== "number")) {
console.log(pixel.element,pixel.color,"\n",rgb,customColor);
//this SHOULDN'T be necessary but SOMEHOW IT IS
var color_also_fxck_you = elementInfo.colorObject;
while(Array.isarray(color_also_fxck_you)) { color_also_fxck_you = randomChoice(color_also_fxck_you) }
};
var r = rgb.r + maxColorOffset; var r = rgb.r + maxColorOffset;
var g = rgb.g + maxColorOffset; var g = rgb.g + maxColorOffset;
var b = rgb.b + maxColorOffset; var b = rgb.b + maxColorOffset;
@ -5446,12 +5453,12 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
})} // shuffle the pixels if not paused*/ })} // shuffle the pixels if not paused*/
for (var i = 0; i < newCurrentPixels.length; i++) { for (var i = 0; i < newCurrentPixels.length; i++) {
pixel = newCurrentPixels[i]; pixel = newCurrentPixels[i];
if(typeof(elements[pixel.element]) == "undefined") { continue }; if(typeof(elements[pixel.element]) !== "object") { pixel.originalElement = pixel.element; pixel.element = "unknown" };
if(typeof(pixel) == "undefined") { continue }; if(typeof(pixel) == "undefined") { continue };
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue} //if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
if (pixel.del) {continue} if (pixel.del) {continue}
if (!paused || forceTick) { if (!paused || forceTick) {
if(typeof(elements[pixel.element]) == "undefined") { continue }; if(typeof(elements[pixel.element]) !== "object") { pixel.originalElement = pixel.element; pixel.element = "unknown" };
doVelocity(pixel); doVelocity(pixel);
if (elements[pixel.element].tick) { // Run tick function if it exists if (elements[pixel.element].tick) { // Run tick function if it exists
elements[pixel.element].tick(pixel); elements[pixel.element].tick(pixel);
@ -5496,6 +5503,9 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
var pixel = pixelDrawList[i]; var pixel = pixelDrawList[i];
if (pixelMap[pixel.x][pixel.y] == undefined) {continue} if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
if (pixel.con) { pixel = pixel.con } if (pixel.con) { pixel = pixel.con }
if((typeof(pixel.color) !== "string") || (pixel.color.indexOf("NaN") >= 0)) {
pixel.color = pixelColorPick(pixel)
};
var colorFunction = viewColorFunctions[view] ?? normalColorFunction; var colorFunction = viewColorFunctions[view] ?? normalColorFunction;
ctx.fillStyle = colorFunction(pixel); ctx.fillStyle = colorFunction(pixel);
if(find) { //if find and matching, override fill style with the find coloration if(find) { //if find and matching, override fill style with the find coloration
@ -43505,9 +43515,9 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa
if((typeof(ctx) == "object") && (ctx?.constructor?.name == "CanvasRenderingContext2D")) { return }; if((typeof(ctx) == "object") && (ctx?.constructor?.name == "CanvasRenderingContext2D")) { return };
if((typeof(ctx) == "undefined") || (typeof(ctx) == "object" && ctx === null)) { if((typeof(ctx) == "undefined") || (typeof(ctx) == "object" && ctx === null)) {
var canvases = document.getElementsByTagName("canvas"); var canvases = document.getElementsByTagName("canvas");
if(canvases.length == 0) { return }; if(canvases.length == 0) { return } else { console.log(canvases) };
canvas = canvases[0]; canvas = canvases[0];
ctx = canvas.getRenderingContext("2d"); if(typeof(canvas?.getRenderingContext) == "function") { ctx = logAndReturn(canvas.getRenderingContext("2d")) } else { console.log(canvas); return };
clearInterval(canvasGetterInterval) clearInterval(canvasGetterInterval)
} else { } else {
return return