diff --git a/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp b/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp index 81d0d00..ee47ed9 100644 --- a/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp +++ b/Source/ComboInput/Private/InputBufferLocalPlayerSubsystem.cpp @@ -84,19 +84,12 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset { // Set the combo input as active. this->InputBufferActive = ComboInput; + this->InputBufferHold = nullptr; - // If we have inputs to lock, prepare the buffer. - if (!ComboInput->LockedComboInputs.IsEmpty()) + const UInputBufferSubsystemGlobalSettings *Settings = GetDefault(); + for (const TSoftObjectPtr &LockedAsset : Settings->ComboActions) { - this->LockedComboInputs = ComboInput->LockedComboInputs; - - this->InputBufferHold = nullptr; - - UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active."), *ComboInput->ComboInputName.ToString()); - } - else - { - UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active and won't lock inputs."), *ComboInput->ComboInputName.ToString()); + this->LockComboInput(LockedAsset.Get()); } this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Activated); @@ -107,6 +100,8 @@ void UInputBufferLocalPlayerSubsystem::ActivateComboInput(const UComboInputAsset { this->OnNewComboInput.Execute(ComboInput, EComboActionTriggerEvent::Released); } + + UE_LOG(LogInputBufferLocalPlayerSubsystem, Verbose, TEXT("%s is active."), *ComboInput->ComboInputName.ToString()); } else { @@ -131,6 +126,11 @@ void UInputBufferLocalPlayerSubsystem::HoldComboInput(const UComboInputAsset *Co ); } +void UInputBufferLocalPlayerSubsystem::LockComboInput(const UComboInputAsset *Input) +{ + this->LockedComboInputs.Emplace(Input); +} + void UInputBufferLocalPlayerSubsystem::UnlockComboInput(const UComboInputAsset *Unlocked) { // Remove the newly-unlocked asset from the locked combo inputs. diff --git a/Source/ComboInput/Public/ComboInputAssets.h b/Source/ComboInput/Public/ComboInputAssets.h index beff805..8dbe19f 100644 --- a/Source/ComboInput/Public/ComboInputAssets.h +++ b/Source/ComboInput/Public/ComboInputAssets.h @@ -120,11 +120,4 @@ public: // this combo input asset will simply represent that action. UPROPERTY(BlueprintReadWrite, EditAnywhere) TSet ActionGroup; - - // Combo inputs that should be prevented from occurring during this - // action. These will be locked when the action is broadcast, and - // should be unlocked by the receiving actor by sending an unlock - // event. - UPROPERTY(BlueprintReadWrite, EditAnywhere) - TSet> LockedComboInputs; }; diff --git a/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h b/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h index 2b214ed..8380991 100644 --- a/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h +++ b/Source/ComboInput/Public/InputBufferLocalPlayerSubsystem.h @@ -25,6 +25,8 @@ public: void AttachComboManager(class UComboManagerComponent *ComboManager, class UEnhancedInputComponent *InputComponent); + UFUNCTION(BlueprintCallable) + void LockComboInput(const class UComboInputAsset *Input); UFUNCTION(BlueprintCallable) void UnlockComboInput(const class UComboInputAsset *Unlocked);