From c8ea492073360d006b8933ecb6884f35392dca4a Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:00:30 +0200 Subject: [PATCH] Update flipflop.js --- mods/flipflop.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index fac6e44a..73ee93f6 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -13,17 +13,20 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - if (typeof Output !== "undefined" && typeof Input !== "undefined") - if (pixel.powerstate == "true" && Input.charge > 0.2) { - Input.charge = 0 - pixel.powerstate = "false" - pixel.color = "#CF300D" - Output.charge = 0 - } else if (pixel.powerstate == "false" && Input.charge > 0.2) { - Input.charge = 0 - pixel.powerstate = "true" - pixel.color = "#94CF0D" - Output.charge = 5 + if (typeof Output !== "undefined" && typeof Input !== "undefined") { + if (Input.charge > 0.4) { + if (pixel.powerstate == "true") { + Input.charge = 0 + pixel.powerstate = "false" + pixel.color = "#CF300D" + Output.charge = 0 + } else { + Input.charge = 0 + pixel.powerstate = "true" + pixel.color = "#94CF0D" + Output.charge = 5 + } + } } } };