[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

@@ -53,6 +53,18 @@ bool ConditionalCommand::RunsWhenDisabled() const {
return m_runsWhenDisabled;
}
Command::InterruptionBehavior ConditionalCommand::GetInterruptionBehavior()
const {
if (m_onTrue->GetInterruptionBehavior() ==
InterruptionBehavior::kCancelSelf ||
m_onFalse->GetInterruptionBehavior() ==
InterruptionBehavior::kCancelSelf) {
return InterruptionBehavior::kCancelSelf;
} else {
return InterruptionBehavior::kCancelIncoming;
}
}
void ConditionalCommand::InitSendable(wpi::SendableBuilder& builder) {
CommandBase::InitSendable(builder);
builder.AddStringProperty(