From 49491b18eba32c6e32cc43cc567568d260dd95d9 Mon Sep 17 00:00:00 2001 From: Michael Delva Date: Thu, 19 Jun 2025 16:34:16 +0200 Subject: [PATCH] Added gameplay tag container to the interaction option --- .../Private/Interaction/GBFInteractableComponent.cpp | 7 +++++++ .../Public/Interaction/GBFInteractableComponent.h | 3 +++ .../Public/Interaction/GBFInteractionOption.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Source/GameBaseFramework/Private/Interaction/GBFInteractableComponent.cpp b/Source/GameBaseFramework/Private/Interaction/GBFInteractableComponent.cpp index 75dfb128..d8570021 100644 --- a/Source/GameBaseFramework/Private/Interaction/GBFInteractableComponent.cpp +++ b/Source/GameBaseFramework/Private/Interaction/GBFInteractableComponent.cpp @@ -61,6 +61,13 @@ void UGBFInteractableComponent::OnInteractableActorLeftRadius( AActor * actor ) K2_OnInteractableActorLeftRadius( actor ); } +bool UGBFInteractableComponent::HasInteractionOptionWithTag( FGameplayTag gameplay_tag ) const +{ + return InteractionOptionContainer.GetOptions().FindByPredicate( [ & ]( const auto & option ) { + return option.Tags.HasTagExact( gameplay_tag ); + } ) != nullptr; +} + void UGBFInteractableComponent::K2_OnInteractableActorEnteredRadius_Implementation( AActor * actor ) { } diff --git a/Source/GameBaseFramework/Public/Interaction/GBFInteractableComponent.h b/Source/GameBaseFramework/Public/Interaction/GBFInteractableComponent.h index 92e1e6b3..60a70925 100644 --- a/Source/GameBaseFramework/Public/Interaction/GBFInteractableComponent.h +++ b/Source/GameBaseFramework/Public/Interaction/GBFInteractableComponent.h @@ -52,6 +52,9 @@ class GAMEBASEFRAMEWORK_API UGBFInteractableComponent : public UActorComponent UFUNCTION( BlueprintPure ) bool HasInteractableActorsInRadius() const; + UFUNCTION( BlueprintPure ) + bool HasInteractionOptionWithTag( FGameplayTag gameplay_tag ) const; + protected: UFUNCTION( BlueprintNativeEvent, DisplayName = "OnInteractableActorEnteredRadius", meta = ( ForceAsFunction ) ) void K2_OnInteractableActorEnteredRadius( AActor * actor ); diff --git a/Source/GameBaseFramework/Public/Interaction/GBFInteractionOption.h b/Source/GameBaseFramework/Public/Interaction/GBFInteractionOption.h index 0419935e..0b30a40b 100644 --- a/Source/GameBaseFramework/Public/Interaction/GBFInteractionOption.h +++ b/Source/GameBaseFramework/Public/Interaction/GBFInteractionOption.h @@ -121,6 +121,9 @@ struct FGBFInteractionOption UPROPERTY( EditAnywhere, BlueprintReadOnly ) FGameplayTagRequirements InstigatorTagRequirements; + UPROPERTY( EditAnywhere, BlueprintReadOnly ) + FGameplayTagContainer Tags; + UPROPERTY( EditAnywhere, BlueprintReadOnly ) TObjectPtr< const UInputAction > InputAction = nullptr;