edit converter

now no longer stores unnecessary dcN's
This commit is contained in:
O-01-67 2022-09-14 13:47:08 -04:00 committed by GitHub
parent 345df9429b
commit bc221baf65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 147 additions and 138 deletions

View File

@ -598,6 +598,7 @@ elements.void_first = {
elements.converter = {
color: "#2ec408",
tick: function(pixel) {
if(!pixel.changeTo) {
//store 4 touching pixels in variables if the variables don't exist
if(!outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) {
if(!pixel.dc1 && pixelMap[pixel.x][pixel.y-1].element != pixel.element) {
@ -765,6 +766,14 @@ elements.converter = {
}
}
}
} else if(pixel.changeTo) {
if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) {
delete pixel.dc1;
delete pixel.dc2;
delete pixel.dc3;
delete pixel.dc4;
}
}
neighbors = [[-1,0],[0,-1],[1,0],[0,1]]
for(i = 0; i < neighbors.length; i++) {
if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) {