Update flipflop.js
This commit is contained in:
parent
826395a5ac
commit
7c55edc462
|
|
@ -1,26 +1,27 @@
|
||||||
elements.flipflop = {
|
elements.flipflop = {
|
||||||
|
powerstate: "false",
|
||||||
name: "Flip Flop",
|
name: "Flip Flop",
|
||||||
color: "#CF300D",
|
color: "#CF300D",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
category: "machines",
|
category: "machines",
|
||||||
conduct: 1,
|
conduct: 1,
|
||||||
tick: function(pixel) {
|
tick: function(pixel) {
|
||||||
doHeat(pixel)
|
doHeat(pixel)
|
||||||
doBurning(pixel)
|
doBurning(pixel)
|
||||||
doElectricity(pixel)
|
doElectricity(pixel)
|
||||||
|
|
||||||
let Powerstate
|
let Powerstate = pixel.powerst
|
||||||
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]
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
if (Powerstate == true && Input.charge > 0.9) {
|
if (Powerstate == "true" && Input.charge > 0.9) {
|
||||||
Powerstate == false
|
Powerstate == "false"
|
||||||
pixel.color = "#CF300D"
|
pixel.color = "#CF300D"
|
||||||
Output.charge = 0
|
Output.charge = 0
|
||||||
} else if (Powerstate == false && Input.charge < 0.9) {
|
} else if (Powerstate == false && Input.charge < 0.9) {
|
||||||
Powerstate == true
|
Powerstate == true
|
||||||
pixel.color = "#94CF0D"
|
pixel.color = "#94CF0D"
|
||||||
Output.charge = 5
|
Output.charge = 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue