From c84eda85a9a5dcd8423a7350d7b02da093ae81a7 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 8 Mar 2023 17:03:42 -0500 Subject: [PATCH] fixed bug causing ghosting when the otherPixel was deleted probably no docs ever, so have a Kiss Later instead https://drive.google.com/file/d/1w3SesQe6rxwfrBD5ZX2BuiQSfRoKCuUD/view?usp=share_link --- mods/onTryMoveInto.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/onTryMoveInto.js b/mods/onTryMoveInto.js index 8fc15667..55374299 100644 --- a/mods/onTryMoveInto.js +++ b/mods/onTryMoveInto.js @@ -32,15 +32,21 @@ function tryMove(pixel,nx,ny,leaveBehind=undefined) { var info = elements[pixel.element]; var oob = outOfBounds(nx,ny); if (isEmpty(nx,ny,false,oob)) { // If coords is empty, move to coords + //console.log(`Moving ${pixel.element} (${pixel.x},${pixel.y}) to (${nx},${ny})`); movePixel(pixel,nx,ny,leaveBehind); return true; } else if (!oob) { + //console.log(`Moving ${pixel.element} (${pixel.x},${pixel.y}) to (${nx},${ny})`); // Reactions newPixel = pixelMap[nx][ny]; var newInfo = elements[newPixel.element]; if(newInfo.onTryMoveInto !== undefined) { newInfo.onTryMoveInto(newPixel,pixel); + if(!pixel || pixel.del) { + return "deleted"; + }; + return true; } var rr1 = false; if (info.reactions !== undefined && info.reactions[newPixel.element] !== undefined) {