me when t he logic again

This commit is contained in:
JustAGenericUsername 2024-01-24 13:32:08 -05:00
parent 62ecd7a8b0
commit 341c25fee8
1 changed files with 42 additions and 0 deletions

View File

@ -289,3 +289,45 @@ elements.E2L_button = {
}
}
}
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
}
}
}
}
}
}