From ebffb3b65d9df9be4044d32d8c28cc62b3caf5f7 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:53:49 +0200 Subject: [PATCH] Update flipflop.js --- mods/flipflop.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index b9e29ae1..f111e2d8 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -10,18 +10,16 @@ elements.flipflop = { doBurning(pixel) doElectricity(pixel) - let Powerstate = pixel.powerstate let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - console.log(typeof Output) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 - if (Powerstate == "true" && Input.charge > 0.2) { - Powerstate = "false" + if (pixel.powerstate == "true" && Input.charge > 0.2) { + pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (Powerstate == false && Input.charge > 0.2) { - Powerstate = true + } else if (pixel.powerstate == "false" && Input.charge > 0.2) { + pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 }