Update flipflop.js
This commit is contained in:
parent
f42131ad3f
commit
c21cf97a42
|
|
@ -1,7 +1,6 @@
|
||||||
elements.flipflop = {
|
elements.flipflop = {
|
||||||
properties: {
|
properties: {
|
||||||
powerstate: "false",
|
powerstate: "false",
|
||||||
cooldown: "0",
|
|
||||||
},
|
},
|
||||||
name: "Flip Flop",
|
name: "Flip Flop",
|
||||||
color: "#CF300D",
|
color: "#CF300D",
|
||||||
|
|
@ -14,18 +13,14 @@ elements.flipflop = {
|
||||||
|
|
||||||
let Output = pixelMap[pixel.x+1][pixel.y]
|
let Output = pixelMap[pixel.x+1][pixel.y]
|
||||||
let Input = pixelMap[pixel.x-1][pixel.y]
|
let Input = pixelMap[pixel.x-1][pixel.y]
|
||||||
if (typeof Output !== "undefined" && typeof Input !== "undefined"){
|
if (typeof Output !== "undefined" && typeof Input !== "undefined")
|
||||||
if (pixel.cooldown > 0){
|
if (pixel.powerstate == "true" && Input.charge > 0.2) {
|
||||||
pixel.cooldown--
|
|
||||||
if (pixel.powerstate == "true" && Input.charge > 0.2 && pixel.cooldown < 1) {
|
|
||||||
Input.charge = 0
|
Input.charge = 0
|
||||||
pixel.cooldown = 5
|
|
||||||
pixel.powerstate = "false"
|
pixel.powerstate = "false"
|
||||||
pixel.color = "#CF300D"
|
pixel.color = "#CF300D"
|
||||||
Output.charge = 0
|
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
|
Input.charge = 0
|
||||||
pixel.cooldown = 5
|
|
||||||
pixel.powerstate = "true"
|
pixel.powerstate = "true"
|
||||||
pixel.color = "#94CF0D"
|
pixel.color = "#94CF0D"
|
||||||
Output.charge = 5
|
Output.charge = 5
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue