From 0fc2849f3bdc334a1e47fd3af632f1727065a58b Mon Sep 17 00:00:00 2001 From: Alvaro Jover-Alvarez Date: Mon, 20 Sep 2021 12:57:55 +0200 Subject: [PATCH 1/2] [UPD] GameplayCueLocal handlers refreshed to use UGameplayCueManager static functions - Now we are using the avatar as the Target for a better consistency. See: InvokeGameplayCueEvent - These static functions also call `Add/RemoveLooseGameplayTag` on the target's ASC, which might be convenient for gameplay --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fb3585ff..6a80fec3 100644 --- a/README.md +++ b/README.md @@ -2310,18 +2310,32 @@ void RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCu ```c++ void UPAAbilitySystemComponent::ExecuteGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) { - UAbilitySystemGlobals::Get().GetGameplayCueManager()->HandleGameplayCue(GetOwner(), GameplayCueTag, EGameplayCueEvent::Type::Executed, GameplayCueParameters); + AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); + + if (ActorAvatar != nullptr && !bSuppressGameplayCues) + { + UGameplayCueManager::ExecuteGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + } } void UPAAbilitySystemComponent::AddGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) { - UAbilitySystemGlobals::Get().GetGameplayCueManager()->HandleGameplayCue(GetOwner(), GameplayCueTag, EGameplayCueEvent::Type::OnActive, GameplayCueParameters); - UAbilitySystemGlobals::Get().GetGameplayCueManager()->HandleGameplayCue(GetOwner(), GameplayCueTag, EGameplayCueEvent::Type::WhileActive, GameplayCueParameters); + AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); + + if (ActorAvatar != nullptr && !bSuppressGameplayCues) + { + UGameplayCueManager::AddGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + } } void UPAAbilitySystemComponent::RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) { - UAbilitySystemGlobals::Get().GetGameplayCueManager()->HandleGameplayCue(GetOwner(), GameplayCueTag, EGameplayCueEvent::Type::Removed, GameplayCueParameters); + AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); + + if (ActorAvatar != nullptr && !bSuppressGameplayCues) + { + UGameplayCueManager::RemoveGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + } } ``` From 8554f72b3c89af2d16f5db42efdd7d901030af7c Mon Sep 17 00:00:00 2001 From: Alvaro Jover-Alvarez Date: Sat, 4 Dec 2021 10:41:54 +0100 Subject: [PATCH 2/2] [UPD] Making target actor generic as a CueLocal parameter --- README.md | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6a80fec3..93780393 100644 --- a/README.md +++ b/README.md @@ -2308,33 +2308,27 @@ void RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCu ``` ```c++ -void UPAAbilitySystemComponent::ExecuteGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) +void UPAAbilitySystemComponent::ExecuteGameplayCueLocal(AActor* TargetActor, const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) { - AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); - - if (ActorAvatar != nullptr && !bSuppressGameplayCues) + if (TargetActor != nullptr && !bSuppressGameplayCues) { - UGameplayCueManager::ExecuteGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + UGameplayCueManager::ExecuteGameplayCue_NonReplicated(TargetActor, GameplayCueTag, GameplayCueParameters); } } -void UPAAbilitySystemComponent::AddGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) +void UPAAbilitySystemComponent::AddGameplayCueLocal(AActor* TargetActor, const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) { - AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); - - if (ActorAvatar != nullptr && !bSuppressGameplayCues) + if (TargetActor != nullptr && !bSuppressGameplayCues) { - UGameplayCueManager::AddGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + UGameplayCueManager::AddGameplayCue_NonReplicated(TargetActor, GameplayCueTag, GameplayCueParameters); } } -void UPAAbilitySystemComponent::RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters & GameplayCueParameters) +void UPAAbilitySystemComponent::RemoveGameplayCueLocal(AActor* TargetActor, const FGameplayCueParameters & GameplayCueParameters) { - AActor* ActorAvatar = AbilityActorInfo->AvatarActor.Get(); - - if (ActorAvatar != nullptr && !bSuppressGameplayCues) + if (TargetActor != nullptr && !bSuppressGameplayCues) { - UGameplayCueManager::RemoveGameplayCue_NonReplicated(ActorAvatar, GameplayCueTag, GameplayCueParameters); + UGameplayCueManager::RemoveGameplayCue_NonReplicated(TargetActor, GameplayCueTag, GameplayCueParameters); } } ```