another error prevention if-block

This commit is contained in:
O-01-67 2022-10-08 22:19:34 -04:00 committed by GitHub
parent 670abff7c9
commit 8f6c8ef3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -429,7 +429,10 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
};
pixel.dirLocked = true;
} else if(Object.keys(badPixels).includes(newElement)) {
body.dir = -1; //flip dir
if(hasPixel(pX,pY+1,"body")) {
var body = pixelMap[pX][pY+1];
body.dir = -1; //run away
};
if(Math.random() > badPixels[newElement].panicIncreaseChance) {
pixel.panic += badPixels[newElement].panicIncrease;
};