diff --git a/mod-list.html b/mod-list.html index bbe0402d..5ffc9e13 100644 --- a/mod-list.html +++ b/mod-list.html @@ -132,6 +132,7 @@ Official alchemy.jsStart with only 4 elements and unlock more by reacting them together (Most are not possible)R74n background_changer.jsPress 'B' to change canvas background to a URLR74n +borders.jsBlack borders around pixels (Use bright background)R74n building.jsBuilding generators and materialsR74n classic_explosives.jsRe-adds 4 explosives removed in v1.9.3R74n classic_textures.jsUse textures from early versions of the gameR74n @@ -415,6 +416,8 @@ Visual Effects acid_and_shapes.jsWeird visual effects enabled in settingsAlice asciiboxels.jsRenders pixels as ASCII charactersNekonico +background_changer.jsPress 'B' to change canvas background to a URLR74n +borders.jsBlack borders around pixels (Use bright background)R74n clouds.jsMoving clouds, sky.js recommendedRedBirdly customBackground.jsSet your background to an image linkJayd fast_lightmap.jsLight sources glow, but fasterRedBirdly diff --git a/mods/borders.js b/mods/borders.js new file mode 100644 index 00000000..a55500c4 --- /dev/null +++ b/mods/borders.js @@ -0,0 +1,60 @@ +window.addEventListener("load", () => { + let oldPreRenderer = viewInfo[1].pre; + let oldPixelRenderer = viewInfo[1].pixel; + viewInfo[1].pre = function(ctx) { + if (oldPreRenderer) oldPreRenderer(ctx); + currentPixels.forEach(pixel => { + if (elements[pixel.element].movable !== true || elements[pixel.element].isGas === true) return; + let edge = false; + for (var i = 0; i < adjacentCoords.length; i++) { + var coords = adjacentCoords[i]; + var x = pixel.x + coords[0]; + var y = pixel.y + coords[1]; + if (isEmpty(x,y)) { + // if (elements[pixelMap[x][y].element].id !== elements[pixel.element].id || elements[pixelMap[x][y].element].state !== elements[pixel.element].id) continue + edge = true; + break; + } + } + if (edge) drawSquare(ctx,"rgb(0,0,0)",pixel.x-0.5,pixel.y-0.5,2); + }) + } + + viewInfo[1].pixel = function(pixel, ctx) { + if (elements[pixel.element].movable) return oldPixelRenderer(pixel, ctx); + let edge = false; + for (var i = 0; i < adjacentCoords.length; i++) { + var coords = adjacentCoords[i]; + var x = pixel.x + coords[0]; + var y = pixel.y + coords[1]; + if (isEmpty(x,y) || (!outOfBounds(x,y) && + elements[pixelMap[x][y].element].movable + )) { + // if (elements[pixelMap[x][y].element].id !== elements[pixel.element].id || elements[pixelMap[x][y].element].state !== elements[pixel.element].id) continue + edge = true; + break; + } + } + if (edge) drawSquare(ctx,"rgb(0,0,0)",pixel.x,pixel.y); + else oldPixelRenderer(pixel, ctx); + } + + // viewInfo[1].post = function(ctx) { + // currentPixels.forEach(pixel => { + // let edge = false; + // for (var i = 0; i < adjacentCoords.length; i++) { + // var coords = adjacentCoords[i]; + // var x = pixel.x + coords[0]; + // var y = pixel.y + coords[1]; + // if (!isEmpty(x,y,true) && elements[pixelMap[x][y].element].movable !== elements[pixel.element].movable) { + // // if (elements[pixelMap[x][y].element].id !== elements[pixel.element].id || elements[pixelMap[x][y].element].state !== elements[pixel.element].id) continue + // edge = true; + // break; + // } + // } + // if (edge) drawSquare(ctx,"rgb(0,0,0)",pixel.x-0.5,pixel.y-0.5,2); + // }) + // } + +}) +