From 2e91266d3e24e8c4620ca5c56135333908ba0fe2 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sat, 23 Dec 2023 13:59:17 -0500 Subject: [PATCH] Update nousersthings.js --- mods/nousersthings.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index f7a52796..883ebdb1 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -1355,5 +1355,39 @@ elements.converter = { }, ignore: ["converter", "wall", "ewall", "border"], movable: false, +}, +elements.blackhole_storage = { + color: "#171717", + behavior: behaviors.WALL, + category: "machines", + tick: function(pixel) { + if (!pixel.bhcontents){ + pixel.bhcontents = []; + } else { + pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)]; + } + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y) && (!pixel.charge && !pixel.chargeCD)) { + var otherPixel = pixelMap[x][y]; + if (elements[otherPixel.element].movable == true){ + pixel.bhcontents.push(otherPixel); + deletePixel(otherPixel.x, otherPixel.y); + } + } else if (pixel.charge && isEmpty(x,y) && pixel.decidedcontent){ + var otherPixel = pixelMap[x][y]; + pixel.decidedcontent.x = x; + pixel.decidedcontent.y = y; + delete pixel.decidedcontent.del; + otherPixel = pixel.decidedcontent; + currentPixels.push(pixel.decidedcontent); + pixel.bhcontents.splice(pixel.bhcontents.indexOf(pixel.decidedcontent), 1); + pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)]; + } + } + }, + movable: false, + conduct: 1, } -