diff --git a/mods/flipflop.js b/mods/flipflop.js index c60957e7..7fe25bea 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,26 +1,27 @@ elements.flipflop = { + powerstate: "false", name: "Flip Flop", - color: "#CF300D", + color: "#CF300D", state: "solid", - category: "machines", + category: "machines", conduct: 1, tick: function(pixel) { doHeat(pixel) doBurning(pixel) doElectricity(pixel) - let Powerstate - let Output = pixelMap[pixel.x+1][pixel.y] - let Input = pixelMap[pixel.x-1][pixel.y] + let Powerstate = pixel.powerst + let Output = pixelMap[pixel.x+1][pixel.y] + let Input = pixelMap[pixel.x-1][pixel.y] Output.charge = 0 - if (Powerstate == true && Input.charge > 0.9) { - Powerstate == false - pixel.color = "#CF300D" - Output.charge = 0 + if (Powerstate == "true" && Input.charge > 0.9) { + Powerstate == "false" + pixel.color = "#CF300D" + Output.charge = 0 } else if (Powerstate == false && Input.charge < 0.9) { - Powerstate == true - pixel.color = "#94CF0D" - Output.charge = 5 - } + Powerstate == true + pixel.color = "#94CF0D" + Output.charge = 5 + } } };