Skip to content

Commit

Permalink
[commands] Trigger: pass m_loop to new Trigger in composition functio…
Browse files Browse the repository at this point in the history
  • Loading branch information
person4268 authored and DeltaDizzy committed Mar 26, 2024
1 parent 2723b99 commit e2e247e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public boolean getAsBoolean() {
* @return A trigger which is active when both component triggers are active.
*/
public Trigger and(BooleanSupplier trigger) {
return new Trigger(() -> m_condition.getAsBoolean() && trigger.getAsBoolean());
return new Trigger(m_loop, () -> m_condition.getAsBoolean() && trigger.getAsBoolean());
}

/**
Expand All @@ -247,7 +247,7 @@ public Trigger and(BooleanSupplier trigger) {
* @return A trigger which is active when either component trigger is active.
*/
public Trigger or(BooleanSupplier trigger) {
return new Trigger(() -> m_condition.getAsBoolean() || trigger.getAsBoolean());
return new Trigger(m_loop, () -> m_condition.getAsBoolean() || trigger.getAsBoolean());
}

/**
Expand All @@ -257,7 +257,7 @@ public Trigger or(BooleanSupplier trigger) {
* @return the negated trigger
*/
public Trigger negate() {
return new Trigger(() -> !m_condition.getAsBoolean());
return new Trigger(m_loop, () -> !m_condition.getAsBoolean());
}

/**
Expand All @@ -281,6 +281,7 @@ public Trigger debounce(double seconds) {
*/
public Trigger debounce(double seconds, Debouncer.DebounceType type) {
return new Trigger(
m_loop,
new BooleanSupplier() {
final Debouncer m_debouncer = new Debouncer(seconds, type);

Expand Down

0 comments on commit e2e247e

Please sign in to comment.