[commands] Add ConditionalCommand getInterruptionBehavior (#5161)

This commit is contained in:
Starlight220
2023-06-23 18:21:05 +03:00
committed by GitHub
parent 89fc51f0d4
commit c4fc21838f
5 changed files with 205 additions and 0 deletions

View File

@@ -73,6 +73,16 @@ public class ConditionalCommand extends CommandBase {
return m_onTrue.runsWhenDisabled() && m_onFalse.runsWhenDisabled();
}
@Override
public InterruptionBehavior getInterruptionBehavior() {
if (m_onTrue.getInterruptionBehavior() == InterruptionBehavior.kCancelSelf
|| m_onFalse.getInterruptionBehavior() == InterruptionBehavior.kCancelSelf) {
return InterruptionBehavior.kCancelSelf;
} else {
return InterruptionBehavior.kCancelIncoming;
}
}
@Override
public void initSendable(SendableBuilder builder) {
super.initSendable(builder);