Update flipflop.js

This commit is contained in:
felixs-alt 2023-09-27 09:00:30 +02:00 committed by GitHub
parent e168be81c8
commit c8ea492073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

@ -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
}
}
}
}
};