From 826395a5ac631dba515f74d998d40f471449bbe6 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:32:09 +0200 Subject: [PATCH 01/35] Create flipflop.js --- mods/flipflop.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 mods/flipflop.js diff --git a/mods/flipflop.js b/mods/flipflop.js new file mode 100644 index 00000000..c60957e7 --- /dev/null +++ b/mods/flipflop.js @@ -0,0 +1,26 @@ +elements.flipflop = { + name: "Flip Flop", + color: "#CF300D", + state: "solid", + 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] + 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 + } + } +}; From 7c55edc462a467214f8e48f2b5686c8c05cbb2be Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:38:08 +0200 Subject: [PATCH 02/35] Update flipflop.js --- mods/flipflop.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) 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 + } } }; From b90b6d90e535d299f96f686c90a72434af13f42e Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:05:49 +0200 Subject: [PATCH 03/35] Update flipflop.js --- mods/flipflop.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 7fe25bea..1efb30d4 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -13,15 +13,18 @@ elements.flipflop = { 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 - } else if (Powerstate == false && Input.charge < 0.9) { - Powerstate == true - pixel.color = "#94CF0D" - Output.charge = 5 - } + + if (isEmpty(Output.x,Output.y) == false && isEmpty(Input.x,Input.y)){ + 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 + } + } } }; From a81c89c2d21a5898858dfcac22a771fd1afd5341 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:13:17 +0200 Subject: [PATCH 04/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 1efb30d4..639f02cb 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,7 +14,7 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - if (isEmpty(Output.x,Output.y) == false && isEmpty(Input.x,Input.y)){ + if (Output.x != undefined && Input.x != undefined)){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.9) { Powerstate == "false" From 03e5678682f6558d1e64165b926be245f19240fe Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:18:48 +0200 Subject: [PATCH 05/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 639f02cb..3e5acc6c 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,7 +14,7 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - if (Output.x != undefined && Input.x != undefined)){ + if (Output.x != undefined && Input.x != undefined){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.9) { Powerstate == "false" From fd984eddaa4c78e9903cfe22c1bbf06dd6d14033 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:25:52 +0200 Subject: [PATCH 06/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 3e5acc6c..0c826582 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,7 +14,7 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - if (Output.x != undefined && Input.x != undefined){ + if (typeof Output.x !== "undefined" && typeof Input.x !== "undefined"){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.9) { Powerstate == "false" From d5066e46b3a5517a75e2a2c878998f11bfb94f4a Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:29:04 +0200 Subject: [PATCH 07/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 0c826582..c5a9ef68 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -13,8 +13,8 @@ elements.flipflop = { let Powerstate = pixel.powerst let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - - if (typeof Output.x !== "undefined" && typeof Input.x !== "undefined"){ + console.log(Output) + if (typeof Output !== "null" && typeof Input !== "null"){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.9) { Powerstate == "false" From 04e1bcd2db3ba31b6ab672523833d535237ca6a8 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:32:36 +0200 Subject: [PATCH 08/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index c5a9ef68..18460574 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -13,8 +13,8 @@ elements.flipflop = { let Powerstate = pixel.powerst let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - console.log(Output) - if (typeof Output !== "null" && typeof Input !== "null"){ + console.log(typeof Output) + if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.9) { Powerstate == "false" From 46110d56cb2fa8d9542bb813aeb00cba2020648f Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:42:08 +0200 Subject: [PATCH 09/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 18460574..ece81fb6 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -16,11 +16,11 @@ elements.flipflop = { console.log(typeof Output) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 - if (Powerstate == "true" && Input.charge > 0.9) { + if (Powerstate == "true" && Input.charge > 0.2) { Powerstate == "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (Powerstate == false && Input.charge < 0.9) { + } else if (Powerstate == false && Input.charge > 0.2) { Powerstate == true pixel.color = "#94CF0D" Output.charge = 5 From c9bea6dd89f642dbb2bf93911b01f679e03bb94d Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:44:41 +0200 Subject: [PATCH 10/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index ece81fb6..c00dc367 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -17,11 +17,11 @@ elements.flipflop = { if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 if (Powerstate == "true" && Input.charge > 0.2) { - Powerstate == "false" + Powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 } else if (Powerstate == false && Input.charge > 0.2) { - Powerstate == true + Powerstate = true pixel.color = "#94CF0D" Output.charge = 5 } From 92b23492d729ed3482b9fb4083e4859ee68af609 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:49:57 +0200 Subject: [PATCH 11/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index c00dc367..b9e29ae1 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -10,7 +10,7 @@ elements.flipflop = { doBurning(pixel) doElectricity(pixel) - let Powerstate = pixel.powerst + let Powerstate = pixel.powerstate let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] console.log(typeof Output) 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 12/35] 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 } From 53b47488de0112b99505dd578c82d4a2998ce79d Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:15:54 +0200 Subject: [PATCH 13/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index f111e2d8..a4a93ed6 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,11 +14,11 @@ elements.flipflop = { let Input = pixelMap[pixel.x-1][pixel.y] if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 - if (pixel.powerstate == "true" && Input.charge > 0.2) { + if (pixel.powerstate == "true" && pixel.charge > 0.2) { pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (pixel.powerstate == "false" && Input.charge > 0.2) { + } else if (pixel.powerstate == "false" && pixel.charge > 0.2) { pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 From a8999ba4dc92119b0c95f86bda045c4ad7967655 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:34:55 +0200 Subject: [PATCH 14/35] Update flipflop.js --- mods/flipflop.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index a4a93ed6..b96ae2cc 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,5 +1,7 @@ elements.flipflop = { - powerstate: "false", + properties: { + powerstate: "false", + }, name: "Flip Flop", color: "#CF300D", state: "solid", @@ -12,14 +14,17 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] + console.log(pixel.powerstate) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 if (pixel.powerstate == "true" && pixel.charge > 0.2) { pixel.powerstate = "false" pixel.color = "#CF300D" + console.log(pixel.powerstate+"y") Output.charge = 0 } else if (pixel.powerstate == "false" && pixel.charge > 0.2) { pixel.powerstate = "true" + console.log(pixel.powerstate+"n") pixel.color = "#94CF0D" Output.charge = 5 } From 0e9b52edc5be3a5f8fdfc2b42500c2c50c9bbd2d Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:39:19 +0200 Subject: [PATCH 15/35] Update flipflop.js --- mods/flipflop.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index b96ae2cc..6fef2f84 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -6,7 +6,6 @@ elements.flipflop = { color: "#CF300D", state: "solid", category: "machines", - conduct: 1, tick: function(pixel) { doHeat(pixel) doBurning(pixel) @@ -17,12 +16,12 @@ elements.flipflop = { console.log(pixel.powerstate) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 - if (pixel.powerstate == "true" && pixel.charge > 0.2) { + if (pixel.powerstate == "true" && Input.charge > 0.2) { pixel.powerstate = "false" pixel.color = "#CF300D" console.log(pixel.powerstate+"y") Output.charge = 0 - } else if (pixel.powerstate == "false" && pixel.charge > 0.2) { + } else if (pixel.powerstate == "false" && Input.charge > 0.2) { pixel.powerstate = "true" console.log(pixel.powerstate+"n") pixel.color = "#94CF0D" From 89b75ae78ece04d8e4c68b1e1d127ea17e3f76f9 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:45:07 +0200 Subject: [PATCH 16/35] Update flipflop.js --- mods/flipflop.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/flipflop.js b/mods/flipflop.js index 6fef2f84..2f6f9041 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -17,11 +17,13 @@ elements.flipflop = { if (typeof Output !== "undefined" && typeof Input !== "undefined"){ Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2) { + Input.charge = 0 pixel.powerstate = "false" pixel.color = "#CF300D" console.log(pixel.powerstate+"y") Output.charge = 0 } else if (pixel.powerstate == "false" && Input.charge > 0.2) { + Input.chare = 0 pixel.powerstate = "true" console.log(pixel.powerstate+"n") pixel.color = "#94CF0D" From a9fb0f1918e4f92304a9939ebbb36ccd018c0563 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:00:57 +0200 Subject: [PATCH 17/35] Update flipflop.js --- mods/flipflop.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 2f6f9041..e65b6265 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,7 +1,9 @@ elements.flipflop = { properties: { powerstate: "false", + cooldown: "0" }, + if (pixel.cooldown > 0) name: "Flip Flop", color: "#CF300D", state: "solid", @@ -10,11 +12,15 @@ elements.flipflop = { doHeat(pixel) doBurning(pixel) doElectricity(pixel) - + let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] console.log(pixel.powerstate) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ + if (pixel.cooldown > 0){ + Input.charge=0 + pixel.cooldown-- + } Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2) { Input.charge = 0 From ba4cc950893df65fc9a5a6bc1d70a907077bcebb Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:12:32 +0200 Subject: [PATCH 18/35] Update flipflop.js --- mods/flipflop.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index e65b6265..10996d7f 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -15,23 +15,23 @@ elements.flipflop = { let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] - console.log(pixel.powerstate) if (typeof Output !== "undefined" && typeof Input !== "undefined"){ if (pixel.cooldown > 0){ - Input.charge=0 - pixel.cooldown-- + Input.charge = 0 + pixel.cooldown-- + console.log(pixel.cooldown) } Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2) { Input.charge = 0 + pixel.cooldown = 3 pixel.powerstate = "false" pixel.color = "#CF300D" - console.log(pixel.powerstate+"y") Output.charge = 0 } else if (pixel.powerstate == "false" && Input.charge > 0.2) { Input.chare = 0 + pixel.cooldown = 3 pixel.powerstate = "true" - console.log(pixel.powerstate+"n") pixel.color = "#94CF0D" Output.charge = 5 } From 59077603327b813f4b6fd5ad95a015fa7e8ee4d9 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:22:44 +0200 Subject: [PATCH 19/35] Update flipflop.js --- mods/flipflop.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 10996d7f..d357e5e2 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,9 +1,8 @@ elements.flipflop = { properties: { powerstate: "false", - cooldown: "0" + cooldown: "0", }, - if (pixel.cooldown > 0) name: "Flip Flop", color: "#CF300D", state: "solid", From 3cb596cdd7709d957d8b5b49d388dab2bf31752d Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:25:48 +0200 Subject: [PATCH 20/35] Update flipflop.js --- mods/flipflop.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index d357e5e2..384ed391 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -16,18 +16,17 @@ elements.flipflop = { let Input = pixelMap[pixel.x-1][pixel.y] if (typeof Output !== "undefined" && typeof Input !== "undefined"){ if (pixel.cooldown > 0){ - Input.charge = 0 pixel.cooldown-- console.log(pixel.cooldown) } Output.charge = 0 - if (pixel.powerstate == "true" && Input.charge > 0.2) { + if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown > 0) { Input.charge = 0 pixel.cooldown = 3 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (pixel.powerstate == "false" && Input.charge > 0.2) { + } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown > 0) { Input.chare = 0 pixel.cooldown = 3 pixel.powerstate = "true" From 6f592dc3ef446c25bff52b8b24f43e251aa731f8 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:28:13 +0200 Subject: [PATCH 21/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 384ed391..dedc60bb 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -20,13 +20,13 @@ elements.flipflop = { console.log(pixel.cooldown) } Output.charge = 0 - if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown > 0) { + if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.charge = 0 pixel.cooldown = 3 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown > 0) { + } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.chare = 0 pixel.cooldown = 3 pixel.powerstate = "true" From 024ababf3cd031efdd12edf9d81ca07aac12dc04 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:35:40 +0200 Subject: [PATCH 22/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index dedc60bb..a748121d 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -22,13 +22,13 @@ elements.flipflop = { Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.charge = 0 - pixel.cooldown = 3 + pixel.cooldown = 7 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.chare = 0 - pixel.cooldown = 3 + pixel.cooldown = 7 pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 From 3c3b20d33dcaf2bdba944462b048647450d310ca Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:42:03 +0200 Subject: [PATCH 23/35] Update flipflop.js --- mods/flipflop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index a748121d..d2cfde8e 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -22,13 +22,13 @@ elements.flipflop = { Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.charge = 0 - pixel.cooldown = 7 + pixel.cooldown = 5 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.chare = 0 - pixel.cooldown = 7 + pixel.cooldown = 5 pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 From 82c897e70e8c82cf951e13c013a48d9f9f1845fb Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:06:19 +0200 Subject: [PATCH 24/35] Update flipflop.js --- mods/flipflop.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index d2cfde8e..53bfbfee 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -17,7 +17,6 @@ elements.flipflop = { if (typeof Output !== "undefined" && typeof Input !== "undefined"){ if (pixel.cooldown > 0){ pixel.cooldown-- - console.log(pixel.cooldown) } Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { @@ -27,7 +26,7 @@ elements.flipflop = { pixel.color = "#CF300D" Output.charge = 0 } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown < 1) { - Input.chare = 0 + Input.charge = 0 pixel.cooldown = 5 pixel.powerstate = "true" pixel.color = "#94CF0D" From f42131ad3f1dbf14ce535315801e72c943bf6ac8 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:12:48 +0200 Subject: [PATCH 25/35] Update flipflop.js --- mods/flipflop.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 53bfbfee..4404d1f3 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -17,8 +17,6 @@ elements.flipflop = { if (typeof Output !== "undefined" && typeof Input !== "undefined"){ if (pixel.cooldown > 0){ pixel.cooldown-- - } - Output.charge = 0 if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { Input.charge = 0 pixel.cooldown = 5 From c21cf97a4202b92f44b4343017db556433dfd2dc Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:13:59 +0200 Subject: [PATCH 26/35] Update flipflop.js --- mods/flipflop.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 4404d1f3..431020da 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,7 +1,6 @@ elements.flipflop = { properties: { powerstate: "false", - cooldown: "0", }, name: "Flip Flop", color: "#CF300D", @@ -14,18 +13,14 @@ 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.cooldown > 0){ - pixel.cooldown-- - if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) { + if (typeof Output !== "undefined" && typeof Input !== "undefined") + if (pixel.powerstate == "true" && Input.charge > 0.2) { Input.charge = 0 - pixel.cooldown = 5 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else if (pixel.powerstate == "false" && Input.charge > 0.2 && pixel.cooldown < 1) { + } else if (pixel.powerstate == "false" && Input.charge > 0.2) { Input.charge = 0 - pixel.cooldown = 5 pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 From e168be81c886bb8ebc045df5bfa47eb5f174b31b Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 08:18:12 +0200 Subject: [PATCH 27/35] Update flipflop.js --- mods/flipflop.js | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 431020da..fac6e44a 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -24,7 +24,6 @@ elements.flipflop = { pixel.powerstate = "true" pixel.color = "#94CF0D" Output.charge = 5 - } } } }; 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 28/35] 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 + } + } } } }; From 132dfa2a2e46fe5600a5d3af3f985d3910986962 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:03:19 +0200 Subject: [PATCH 29/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 73ee93f6..216ee166 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,7 +14,7 @@ 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 (Input.charge > 0.4) { + if (Input.charge > 0.7) { if (pixel.powerstate == "true") { Input.charge = 0 pixel.powerstate = "false" From 7608a825fa23a3922232aaefd68fedf748b5a030 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:05:35 +0200 Subject: [PATCH 30/35] Update flipflop.js --- mods/flipflop.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 216ee166..af4225f6 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -16,16 +16,16 @@ elements.flipflop = { if (typeof Output !== "undefined" && typeof Input !== "undefined") { if (Input.charge > 0.7) { if (pixel.powerstate == "true") { - Input.charge = 0 pixel.powerstate = "false" pixel.color = "#CF300D" Output.charge = 0 - } else { - Input.charge = 0 + } else if (pixel.powerstate == "true") { pixel.powerstate = "true" pixel.color = "#94CF0D" - Output.charge = 5 + Output.charge = 1 } + } else { + Output.charge = 0 } } } From bc7b828c7353fb8a5cb666c384e7317e9ff7b700 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:10:23 +0200 Subject: [PATCH 31/35] Update flipflop.js --- mods/flipflop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index af4225f6..37c4b14b 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -14,7 +14,7 @@ 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 (Input.charge > 0.7) { + if (Input.charge > 0.45) { if (pixel.powerstate == "true") { pixel.powerstate = "false" pixel.color = "#CF300D" From 94814ba92c83835a9a04efa86177c7a78098c3a8 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:27:39 +0200 Subject: [PATCH 32/35] Update flipflop.js --- mods/flipflop.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 37c4b14b..a3c8de52 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -10,19 +10,20 @@ elements.flipflop = { doHeat(pixel) doBurning(pixel) doElectricity(pixel) - + console.log(pixel.powerstate) let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] if (typeof Output !== "undefined" && typeof Input !== "undefined") { - if (Input.charge > 0.45) { + if (Inpput.charge == 0.75) { + conso le.log(Input.charge) if (pixel.powerstate == "true") { pixel.powerstate = "false" - pixel.color = "#CF300D" - Output.charge = 0 - } else if (pixel.powerstate == "true") { - pixel.powerstate = "true" - pixel.color = "#94CF0D" - Output.charge = 1 + pixel.color = "#CF300D" + Output.charge = 0 + } else if (pixel.powerstate == "false") { + pixel.powerstate = "true" + pixel.color = "#94CF0D" + Output.charge = 1 } } else { Output.charge = 0 From 8eb6cc7c30f64d52bb3461c05c6bc858c9a5d26e Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:40:09 +0200 Subject: [PATCH 33/35] Update flipflop.js --- mods/flipflop.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index a3c8de52..025d727a 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -1,29 +1,33 @@ elements.flipflop = { properties: { powerstate: "false", + cooldown: 0, }, name: "Flip Flop", color: "#CF300D", state: "solid", category: "machines", tick: function(pixel) { - doHeat(pixel) - doBurning(pixel) - doElectricity(pixel) - console.log(pixel.powerstate) + doHeat(pixel) + doBurning(pixel) + doElectricity(pixel) + let Output = pixelMap[pixel.x+1][pixel.y] let Input = pixelMap[pixel.x-1][pixel.y] if (typeof Output !== "undefined" && typeof Input !== "undefined") { - if (Inpput.charge == 0.75) { - conso le.log(Input.charge) + console.log(pixel.cooldown) + if (Input.charge == 0 && pixel.cooldown == 1) { + pixel.cooldown = 0 + } + if (Input.charge > 0.5 && pixel.cooldown == 0) { + pixel.cooldown = 1 if (pixel.powerstate == "true") { pixel.powerstate = "false" - pixel.color = "#CF300D" - Output.charge = 0 + pixel.color = "#CF300D" } else if (pixel.powerstate == "false") { - pixel.powerstate = "true" - pixel.color = "#94CF0D" - Output.charge = 1 + pixel.powerstate = "true" + pixel.color = "#94CF0D" + Output.charge = 1 } } else { Output.charge = 0 From f720f4eaa692d35ffa7b2cb85171bf823a01b49f Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:52:10 +0200 Subject: [PATCH 34/35] Update flipflop.js --- mods/flipflop.js | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 025d727a..8fd63d85 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -15,11 +15,10 @@ 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") { - console.log(pixel.cooldown) - if (Input.charge == 0 && pixel.cooldown == 1) { + if (Input.charge == undefined && pixel.cooldown == 1) { pixel.cooldown = 0 } - if (Input.charge > 0.5 && pixel.cooldown == 0) { + if (Input.charge > 0 && pixel.cooldown == 0) { pixel.cooldown = 1 if (pixel.powerstate == "true") { pixel.powerstate = "false" @@ -29,8 +28,44 @@ elements.flipflop = { pixel.color = "#94CF0D" Output.charge = 1 } - } else { - Output.charge = 0 + } else if (cooldown == 0) { + Output.charge = undefined + } + } + } +}; +elements.flipflop = { + properties: { + powerstate: "false", + cooldown: 0, + }, + name: "Flip Flop", + color: "#CF300D", + state: "solid", + category: "machines", + tick: function(pixel) { + doHeat(pixel) + doBurning(pixel) + doElectricity(pixel) + + let Output = pixelMap[pixel.x+1][pixel.y] + let Input = pixelMap[pixel.x-1][pixel.y] + if (typeof Output !== "undefined" && typeof Input !== "undefined") { + if (Input.charge == undefined && pixel.cooldown == 1) { + pixel.cooldown = 0 + } + if (Input.charge > 0 && pixel.cooldown == 0) { + pixel.cooldown = 1 + if (pixel.powerstate == "true") { + pixel.powerstate = "false" + pixel.color = "#CF300D" + } else if (pixel.powerstate == "false") { + pixel.powerstate = "true" + pixel.color = "#94CF0D" + Output.charge = 1 + } + } else if (cooldown == 0) { + Output.charge = undefined } } } From 06bbf6d400efb3af3ac75aae0aa4bf7732498da8 Mon Sep 17 00:00:00 2001 From: felixs-alt <114471609+felixs-alt@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:53:14 +0200 Subject: [PATCH 35/35] Update flipflop.js --- mods/flipflop.js | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/mods/flipflop.js b/mods/flipflop.js index 8fd63d85..352ea4d6 100644 --- a/mods/flipflop.js +++ b/mods/flipflop.js @@ -28,43 +28,7 @@ elements.flipflop = { pixel.color = "#94CF0D" Output.charge = 1 } - } else if (cooldown == 0) { - Output.charge = undefined - } - } - } -}; -elements.flipflop = { - properties: { - powerstate: "false", - cooldown: 0, - }, - name: "Flip Flop", - color: "#CF300D", - state: "solid", - category: "machines", - tick: function(pixel) { - doHeat(pixel) - doBurning(pixel) - doElectricity(pixel) - - let Output = pixelMap[pixel.x+1][pixel.y] - let Input = pixelMap[pixel.x-1][pixel.y] - if (typeof Output !== "undefined" && typeof Input !== "undefined") { - if (Input.charge == undefined && pixel.cooldown == 1) { - pixel.cooldown = 0 - } - if (Input.charge > 0 && pixel.cooldown == 0) { - pixel.cooldown = 1 - if (pixel.powerstate == "true") { - pixel.powerstate = "false" - pixel.color = "#CF300D" - } else if (pixel.powerstate == "false") { - pixel.powerstate = "true" - pixel.color = "#94CF0D" - Output.charge = 1 - } - } else if (cooldown == 0) { + } else if (pixel.cooldown == 0) { Output.charge = undefined } }