Skip to content

[UHLGAS] AbilityInputCache option to check tags on AbilityInputCache.Check #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Source/UHLGAS/Private/Input/AbilityInputCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ void UAbilityInputCache::CheckCache()
// // bCanceledSuccessfully;
// }
// }

FGameplayAbilitySpec AbilitySpec;
UUHLGASBlueprintLibrary::FindAbilitySpecByTagUsingASC(ASC.Get(), AbilityTagToActivate, AbilitySpec);
if (AbilitySpec.IsActive())
{
const UUHLGameplayAbility* AbilityCDO = Cast<UUHLGameplayAbility>(AbilitySpec.Ability);
if (AbilityCDO->bCheckTagsWhenCheckingCache)
{
// ASC->CancelAbilityHandle(AbilitySpec.Handle);
// bool bCanceledSuccessfully = ASC->TryCancelAbilityWithTag(AbilityTagToActivate);
// bCanceledSuccessfully;
}
}

bool bActivated = ASC->TryActivateAbilityWithTag(AbilityTagToActivate);
UE_LOG(Log_UHL_AbilityInputCache, Log, TEXT("Activation %s - %s!"), bActivated ? TEXT("successful") : TEXT("failed"), *AbilityTagToActivate.ToString());
Expand Down
11 changes: 11 additions & 0 deletions Source/UHLGAS/Public/Abilities/UHLGameplayAbility.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ class UHLGAS_API UUHLGameplayAbility : public UGameplayAbility
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AbilityInputCache", DisplayName="[Add to Cache] BlockedTags")
FGameplayTagContainer AddToCacheBlockedTags;


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AbilityInputCache")
bool bCheckTagsWhenCheckingCache = false;

// tags required on owner ASC to activate ability from cache when we "Check" AbilityInputCache
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AbilityInputCache", DisplayName="[Check Cache] RequiredTags", meta=(EditCondition="bCheckTagsWhenCheckingCache", EditConditionHides))
FGameplayTagContainer CheckCacheRequiredTags;
// tags blocked on owner ASC - if present ability won't be activated from cache when we "Check" AbilityInputCache
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AbilityInputCache", DisplayName="[Check Cache] RequiredTags", meta=(EditCondition="bCheckTagsWhenCheckingCache", EditConditionHides))
FGameplayTagContainer CheckCacheBlockedTags;

/**
* When true, external CancelAbility calls are intercepted and must be completed manually via ReleaseCancellation().
*/
Expand Down