Skip to content
Permalink
Browse files

Fixed DownCounter not resetting when input is high

  • Loading branch information
me4502 committed Mar 15, 2020
1 parent c2d0038 commit 00c83cbe884756116127ae0579dc7714b65f69a8
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/DownCounter.java
@@ -80,7 +80,7 @@ public void trigger(ChipState chip) {
int oldVal = curVal;
try {
// If clock input triggered
if (chip.getInput(0)) {
if (chip.getInput(0) && chip.isTriggered(0)) {
if (curVal == 0) { // If we've gotten to 0, reset if infinite mode
if (inf) {
curVal = resetVal;
@@ -92,7 +92,7 @@ public void trigger(ChipState chip) {
// Set output to high if we're at 0, otherwise low
chip.setOutput(0, curVal == 0);
// If reset input triggered, reset counter value
} else if (chip.getInput(1)) {
} else if (chip.getInput(1) && chip.isTriggered(1)) {
curVal = resetVal;
chip.setOutput(0, false);
}

0 comments on commit 00c83cb

Please sign in to comment.
You can’t perform that action at this time.