From 341c25fee8167dc0096a45e479ddb3ecf1f244d9 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Wed, 24 Jan 2024 13:32:08 -0500 Subject: [PATCH] me when t he logic again --- mods/logicgates.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/mods/logicgates.js b/mods/logicgates.js index 50fd527c..0eca9be3 100644 --- a/mods/logicgates.js +++ b/mods/logicgates.js @@ -288,4 +288,46 @@ elements.E2L_button = { pixel.cooldown = pixel.cooldown - 1 } } +} +elements.L2E_constant = { + color: "#b2ba75", + behavior: behaviors.WALL, + state: "solid", + category: "logic", + tick: function(pixel){ + var foundOn = false; + for (var i = 0; i < adjacentCoords.length; i++) { + var coord = adjacentCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y,true)) { + if (pixelMap[x][y].element == "logic_wire" && pixelMap[x][y].lstate){ + foundOn = true; + } + } + } + if (foundOn){ + for (var i = 0; i < adjacentCoords.length; i++) { + var coord = adjacentCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y,true)) { + if (elements[pixelMap[x][y].element].conduct){ + pixelMap[x][y].charge = 1 + } + } + } + } else { + for (var i = 0; i < adjacentCoords.length; i++) { + var coord = adjacentCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y,true)) { + if (elements[pixelMap[x][y].element].conduct){ + pixelMap[x][y].charge = 0 + } + } + } + } + } } \ No newline at end of file