fix crash at edges

and add cooldown
This commit is contained in:
O-01-67 2022-09-15 10:08:00 -04:00 committed by GitHub
parent 332ed0bb8a
commit 521b96b31a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,7 @@
elements.amogus = { elements.amogus = {
name: "Amogus", name: "Amogus",
color: "#ffffff", color: "#ffffff",
cooldown: 6,
tick: function(pixel) { tick: function(pixel) {
pixel.arr=[["brick", "brick", "brick"], pixel.arr=[["brick", "brick", "brick"],
["brick", "glass", "glass"], ["brick", "glass", "glass"],
@ -28,13 +29,13 @@ elements.amogus = {
} }
for (let j = cc; j < dd; j++) { //Iterative placing and coloring of pixels for (let j = cc; j < dd; j++) { //Iterative placing and coloring of pixels
for (let i = aa; i < bb; i++) { for (let i = aa; i < bb; i++) {
if(!isEmpty(pixel.x+i,pixel.y+j) && !outOfBounds(pixel.x+i,pixel.y+j)) { if(!isEmpty(pixel.x+i,pixel.y+j,true)) {
if(pixel.arr[j+nc][i+na] != "null" || pixel.arr[j+nc][i+na] == "air") { if(pixel.arr[j+nc][i+na] !== "null") {
deletePixel(pixel.x+i,pixel.y+j) deletePixel(pixel.x+i,pixel.y+j)
} }
} }
if(pixel.arr[j+nc][i+na]) { if(pixel.arr[j+nc][i+na]) {
if(isEmpty(pixel.x+i,pixel.y+j,true) && pixel.arr[j+nc][i+na] != "null" && pixel.arr[j+nc][i+na] != "air") { if(isEmpty(pixel.x+i,pixel.y+j,false) && pixel.arr[j+nc][i+na] !== "null" && pixel.arr[j+nc][i+na] !== "air") {
createPixel(pixel.arr[j+nc][i+na],pixel.x+i,pixel.y+j) createPixel(pixel.arr[j+nc][i+na],pixel.x+i,pixel.y+j)
if(pixel.carr[j+nc][i+na]) { if(pixel.carr[j+nc][i+na]) {
if(!isEmpty(pixel.x+i,pixel.y+j,true) && pixel.carr[j+nc][i+na] != "null") { if(!isEmpty(pixel.x+i,pixel.y+j,true) && pixel.carr[j+nc][i+na] != "null") {
@ -55,6 +56,7 @@ elements.amogus = {
elements.amogus_seed = { elements.amogus_seed = {
name: "Amogus Seed", name: "Amogus Seed",
color: "#df2f47", color: "#df2f47",
cooldown: 6,
behavior: [ behavior: [
"DL:amogus_seed|DL:amogus_seed AND M2|DL:amogus_seed", "DL:amogus_seed|DL:amogus_seed AND M2|DL:amogus_seed",
"DL:amogus_seed|C2:amogus|DL:amogus_seed", "DL:amogus_seed|C2:amogus|DL:amogus_seed",