diff --git a/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp b/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp index c38147b..712696c 100644 --- a/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp +++ b/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp @@ -75,12 +75,12 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset { checkf(ComboInput, TEXT("Invalid %s."), *UComboInputAsset::StaticClass()->GetName()); + const bool bNewInputLocked = this->LockedComboInputs.Contains(ComboInput); + const bool bNewSupercedesActive = (this->InputBufferActive && this->InputBufferActive->ContainsOneOf(ComboInput->ActionGroup) && !bNewInputLocked); + // Make this combo input active if it isn't being locked, or if we are // overwriting a previous combo input with a multi-press combo input. - const bool bMultiPressTimerActive = this->GetWorld()->GetTimerManager().IsTimerActive(this->MultiPressTimerHandle); - const bool bActiveInputLocked = this->LockedComboInputs.Contains(this->InputBufferActive); - const bool bNewInputLocked = this->LockedComboInputs.Contains(ComboInput); - if ((bMultiPressTimerActive && !bActiveInputLocked) || !bNewInputLocked) + if (bNewSupercedesActive || !bNewInputLocked) { if (!ComboInput->LockedComboInputs.IsEmpty()) { @@ -88,11 +88,7 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset this->InputBufferActive = ComboInput; this->LockedComboInputs = ComboInput->LockedComboInputs; - // Make sure the hold is clear if we're coming off of a multi-press action. - if (bMultiPressTimerActive) - { - this->InputBufferHold = nullptr; - } + this->InputBufferHold = nullptr; UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active."), *ComboInput->ComboInputName.ToString()); } @@ -105,16 +101,16 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset } else { - this->HoldComboInput(ComboInput, bNewInputLocked); + this->HoldComboInput(ComboInput); } } -void UInputBufferLocalPlayerSubsystem::HoldComboInput(const UComboInputAsset *ComboInput, const bool &bLocked) +void UInputBufferLocalPlayerSubsystem::HoldComboInput(const UComboInputAsset *ComboInput) { this->InputBufferHold = ComboInput; UE_SUPPRESS(LogInputBufferLocalPlayerSubsystem, Verbose, { - if (bLocked) + if (this->LockedComboInputs.Contains(ComboInput)) { UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is locked and won't be activated yet."), *ComboInput->ComboInputName.ToString()); } diff --git a/Source/ComboInput/Public/ComboInputAssets.h b/Source/ComboInput/Public/ComboInputAssets.h index 43be266..beff805 100644 --- a/Source/ComboInput/Public/ComboInputAssets.h +++ b/Source/ComboInput/Public/ComboInputAssets.h @@ -119,7 +119,7 @@ public: // within a short time of one another. If only one is present, then // this combo input asset will simply represent that action. UPROPERTY(BlueprintReadWrite, EditAnywhere) - TSet> ActionGroup; + TSet ActionGroup; // Combo inputs that should be prevented from occurring during this // action. These will be locked when the action is broadcast, and diff --git a/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h b/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h index 01d34c1..584eb2f 100644 --- a/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h +++ b/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h @@ -33,7 +33,7 @@ private: void ExpireAction(const FInputActionValue &Value, const class UInputAction *Action); void ActivateComboInput(const class UComboInputAsset *ComboInput); - void HoldComboInput(const class UComboInputAsset *ComboInput, const bool &bLocked); + void HoldComboInput(const class UComboInputAsset *ComboInput); void ClearMultiPresses(); void ExpireBufferedActions();