From a334efa4bdd18ccdc52d1f1891ab471212e81dce Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Tue, 6 Aug 2024 01:10:47 -0400 Subject: [PATCH 1/5] Add files via upload --- mods/shader_by_jayd.js | 154 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 mods/shader_by_jayd.js diff --git a/mods/shader_by_jayd.js b/mods/shader_by_jayd.js new file mode 100644 index 00000000..9826cb1c --- /dev/null +++ b/mods/shader_by_jayd.js @@ -0,0 +1,154 @@ +elements.shader_test = { + color: "#FFFFFF", + category: "special", + renderer: function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,"#ffffff",x,y,1,0.25) + } + } +} +elements.fire.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.cold_fire.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.light.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 2); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.75) + } +} +elements.laser.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 2); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.75) + } +} +elements.plasma.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.5) + } +} +elements.electric.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 2); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.heat_ray.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.freeze_ray.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.flash.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.7) + } +} +elements.smoke.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 2); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.radiation.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 2); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + drawSquare(ctx,pixel.color,x,y,1,0.25) + } +} +elements.led_r.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + if (pixel.charge) { + drawSquare(ctx,pixel.color,x,y,1,0.5) + } + else { + drawSquare(ctx,pixel.color,pixel.x,pixel.y,1,1) + } + } +} +elements.led_g.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + if (pixel.charge) { + drawSquare(ctx,pixel.color,x,y,1,0.5) + } + else { + drawSquare(ctx,pixel.color,pixel.x,pixel.y,1,1) + } + } +} +elements.led_b.renderer = function(pixel,ctx) { + var circlec = circleCoords(pixel.x, pixel.y, 3); + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i]; + var x = coord.x; + var y = coord.y; + if (pixel.charge) { + drawSquare(ctx,pixel.color,x,y,1,0.5) + } + else { + drawSquare(ctx,pixel.color,pixel.x,pixel.y,1,1) + } + } +} From 8ea61ae57f1f011464e768a9348930c0589807f1 Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Tue, 6 Aug 2024 01:12:58 -0400 Subject: [PATCH 2/5] Update mod-list.html --- mod-list.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod-list.html b/mod-list.html index c246346a..683ca4f8 100644 --- a/mod-list.html +++ b/mod-list.html @@ -333,13 +333,14 @@ heatglow.jsRed glowing effect for hot metalsnousernamefound invisible_dye.jsAdds elements like Dye and Spray Paint that take the color of the backgroundAlice invisible_wall.jsAdds an element like Wall that takes the color of the backgroundAlice +lightmap.jsMakes light sources glowRedBirdly moreViews.jsMany new rendering modesggod onecolor.jsMakes all placed pixels single-colorednousernamefound paint_event.jsAdds a random event that randomly paints a circleAlice rainbow_tests.jsAdds variants of the rainbow element with different mathsAlice +shader_by_jayd.jsAdds a glow around light elementsJayd Shroomboxels.jsA variant of acid_and_shapes.js that uses a different trigonometric functionAlice singleColor.jsMakes all elements pick one color each time they're drawnstefanblox -lightmap.jsMakes light sources glowRedBirdly Compilations a_mod_by_alice.jsA mod combining most of Alice’s mods, and some other thingsAlice From 3d6dc689aa201ffc501b66c74f6d6a527de26c1b Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:28:02 -0400 Subject: [PATCH 3/5] new filler --- mods/nousersthings.js | 80 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index dc38e355..b24fe08e 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -3530,4 +3530,84 @@ elements.colored_filler = { } } } +} +let copycatfillerElem = "sand" +elements.copycat_filler = { + color: elements.random.color, + behavior:behaviors.WALL, + category: "special", + onSelect: function(){ + let ans1 = prompt("Enter the element you want to use for the copycat filler", copycatfillerElem||"sand") + copycatfillerElem = mostSimilarElement(ans1) + }, + tick: function(pixel){ + let fillerNeighbors = {} + if (!pixel.copycatElement){ + pixel.copycatElement = copycatfillerElem + } + if (!pixel.rSeed){ + pixel.rSeed = [Math.random(), Math.random(), Math.random(), Math.random()] + } + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (isEmpty(x,y)) { + createPixel("copycat_filler", x, y) + pixelMap[x][y].copycatElement = pixel.copycatElement + } + } + for (var i = 0; i < squareCoords.length; i++) { + var x = pixel.x+squareCoords[i][0]; + var y = pixel.y+squareCoords[i][1]; + if (!isEmpty(x, y, true)){ + var otherPixel = pixelMap[x][y]; + if (otherPixel.element == "copycat_filler" && otherPixel.copycatElement != pixel.copycatElement){ + fillerNeighbors[otherPixel.copycatElement] = (fillerNeighbors[otherPixel.copycatElement]||0)+1; + } + } + } + if(Object.keys(fillerNeighbors).length > 0){ + let mostSeenColor = highestValueObjectKey(fillerNeighbors) + let opposingCount = sumOfObjectValues(fillerNeighbors) + if (Math.random() < neighborRandomChance[opposingCount]){ + pixel.copycatElement = mostSeenColor; + } + } + }, + renderer: function(pixel, ctx){ + if (!pixel.copycatElement){pixel.copycatElement = copycatfillerElem} + if (!pixel.rSeed){pixel.rSeed = [Math.random(), Math.random(), Math.random(), Math.random()]} + if (typeof elements[pixel.copycatElement].color == "object"){ + let selectedColor = elements[pixel.copycatElement].color[Math.floor(pixel.rSeed[1]*elements[pixel.copycatElement].color.length)] + let rgb = { + r: parseInt(selectedColor.match(/\d+/g)[0]), + g: parseInt(selectedColor.match(/\d+/g)[1]), + b: parseInt(selectedColor.match(/\d+/g)[2]) + } + for (let c in rgb){ + rgb[c] += Math.floor(pixel.rSeed[0] * (pixel.rSeed[2] > 0.5 ? -1 : 1) * pixel.rSeed[3] * 15); + rgb[c] = Math.max(0, Math.min(255, rgb[c])); + } + if (elements[pixel.copycatElement].glow || elements[pixel.copycatElement].isGas){ + drawPlus(ctx, "rgb("+rgb.r+","+rgb.g+","+rgb.b+")", pixel.x, pixel.y, 1); + } else { + drawSquare(ctx, "rgb("+rgb.r+","+rgb.g+","+rgb.b+")", pixel.x, pixel.y); + } + } else { + let rgb = { + r: parseInt(elements[pixel.copycatElement].color.match(/\d+/g)[0]), + g: parseInt(elements[pixel.copycatElement].color.match(/\d+/g)[1]), + b: parseInt(elements[pixel.copycatElement].color.match(/\d+/g)[2]) + } + for (let c in rgb){ + rgb[c] += Math.floor(pixel.rSeed[0] * (pixel.rSeed[2] > 0.5 ? -1 : 1) * pixel.rSeed[3] * 15); + rgb[c] = Math.max(0, Math.min(255, rgb[c])); + } + if (elements[pixel.copycatElement].glow || elements[pixel.copycatElement].isGas){ + drawPlus(ctx, "rgb("+rgb.r+","+rgb.g+","+rgb.b+")", pixel.x, pixel.y, 1); + } else { + drawSquare(ctx, "rgb("+rgb.r+","+rgb.g+","+rgb.b+")", pixel.x, pixel.y); + } + } + } } \ No newline at end of file From 80dc8455242d1fed7c0efeee1e790d1b0693726d Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:51:28 -0400 Subject: [PATCH 4/5] hotfix --- index.html | 8 ++++---- mod-list.html | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 04fcedf3..750b14ce 100644 --- a/index.html +++ b/index.html @@ -15060,12 +15060,12 @@ behaviorRules = { categoryButton.setAttribute("current", true); } function setView(n) { - if (viewInfo[n]) { - view = n; - } - else { // reset view + if (!viewInfo[n] || n === 1) { // reset view view = null; } + else { + view = n; + } } function centerMouse() { mousePos = {x:width/2,y:height/2}; diff --git a/mod-list.html b/mod-list.html index 1878a711..07bba2b9 100644 --- a/mod-list.html +++ b/mod-list.html @@ -347,6 +347,7 @@ food_mods.jsA mod combining most food modsstefanblox, moss, Tisquares, SquareScreamYT, Adora, pixelegend4, Alice, Nubo318, Clide4, rottenEgghead Technical Libraries & Tests +1.10example.jsExamples for modern rendering modding and moreR74n a_bundle_of_tests.jsSeveral test functionsAlice all_stain.jsMakes every element stain solidsstefanblox betterMenuScreens.jsLibrary for mods to create their own menusggod From f23544ea9ce7a0b84093103dc0a886fc766c8411 Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Wed, 7 Aug 2024 01:16:47 -0400 Subject: [PATCH 5/5] Add files via upload --- mods/texture_pack_by_jayd.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 mods/texture_pack_by_jayd.js diff --git a/mods/texture_pack_by_jayd.js b/mods/texture_pack_by_jayd.js new file mode 100644 index 00000000..7c3ced5f --- /dev/null +++ b/mods/texture_pack_by_jayd.js @@ -0,0 +1,29 @@ +//texture_pack_by_jayd +document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")'; +gameDiv.style.border = "0px solid #ffffff"; +function drawCursor() { + canvas.style.backgroundColor = "#00000000"; + var layerCtx = canvasLayers.gui.getContext('2d'); + var mouseOffset = Math.trunc(mouseSize/2); + var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; + var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + // Draw a square around the mouse + layerCtx.strokeStyle = "#FFFFFF80"; + layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); + // draw one transparent pixel in the center + if (settings.precision) { + layerCtx.fillStyle = "#ffffffc8"; + layerCtx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize); + } + if (shaping) { + if (shaping === 1) { // Draw a white line from shapeStart.x to shapeStart.y + layerCtx.beginPath(); + layerCtx.strokeStyle = "#FFFFFF80"; + layerCtx.lineWidth = 2; + layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf); + layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf); + layerCtx.stroke(); + layerCtx.lineWidth = 1; + } + } +} \ No newline at end of file