Skip to content

hotfix ability input buffer #277

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

Merged
merged 5 commits into from
Jul 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Characters/Components/GBFHeroComponent.h"
#include "Characters/Components/GBFPawnExtensionComponent.h"
#include "Characters/GBFPawnData.h"
#include "GAS/Components/GBFAbilitySystemComponent.h"
#include "Input/GBFInputComponent.h"

Expand Down Expand Up @@ -32,6 +33,11 @@ void UGBFAbilityInputBufferComponent::StartMonitoring( FGameplayTagContainer inp
return;
}

if ( GetPawn< APawn >() == nullptr || GetPawn< APawn >()->IsBotControlled() )
{
return;
}

Reset();
TriggerPriority = trigger_priority;
InputTagsToCheck = input_tags_to_check;
Expand All @@ -44,6 +50,11 @@ void UGBFAbilityInputBufferComponent::StartMonitoring( FGameplayTagContainer inp

void UGBFAbilityInputBufferComponent::StopMonitoring()
{
if ( GetPawn< APawn >() == nullptr || GetPawn< APawn >()->IsBotControlled() )
{
return;
}

RemoveBinds();
TryToTriggerAbility();
Reset();
Expand Down Expand Up @@ -86,18 +97,19 @@ void UGBFAbilityInputBufferComponent::BindActions()
return;
}

auto & actions_per_input_config = hero_component->GetBoundActionsByInputconfig();
// :FIXME: mg Ability input config is null, comment for hotfix

for ( auto & [ input_config, actions ] : actions_per_input_config )
{
for ( auto & tag : InputTagsToCheck )
{
if ( const auto * input_action = input_config->FindAbilityInputActionForTag( tag ) )
{
BindHandles.Add( input_component->BindAction( input_action, ETriggerEvent::Triggered, this, &ThisClass::AbilityInputTagPressed, tag ).GetHandle() );
}
}
}
// for ( auto & input_config : hero_component->GetBoundActionsByInputconfig() )
// {
// for ( auto & tag : InputTagsToCheck )
// {
// if ( const auto * input_action = input_config.Key->FindAbilityInputActionForTag( tag ) )
// {
// // Need to investigate why input is bind but not triggered
// BindHandles.Add( input_component->BindAction( input_action, ETriggerEvent::Triggered, this, &ThisClass::AbilityInputTagPressed, tag ).GetHandle() );
// }
// }
// }
}

void UGBFAbilityInputBufferComponent::RemoveBinds()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ UCommonSession_HostSessionRequest * UGBFUserFacingExperienceDefinition::CreateHo
}
}
}

if ( result == nullptr )
{
result = NewObject< UCommonSession_HostSessionRequest >();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GAMEBASEFRAMEWORK_API UGBFAbilityInputBufferComponent final : public UPawn
public:
UGBFAbilityInputBufferComponent( const FObjectInitializer & object_initializer );

UFUNCTION( BlueprintCallable )
UFUNCTION( BlueprintCallable, Meta = ( GameplayTagFilter = "Input" ) )
void StartMonitoring( FGameplayTagContainer input_tags_to_check, ETriggerPriority trigger_priority );

UFUNCTION( BlueprintCallable )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GAMEBASEFRAMEWORK_API AGBFSimpleCharacterWithAbilities : public ACharacter
GENERATED_BODY()

public:
explicit AGBFSimpleCharacterWithAbilities( const FObjectInitializer & object_initializer );
explicit AGBFSimpleCharacterWithAbilities( const FObjectInitializer & object_initializer = FObjectInitializer::Get() );

UAbilitySystemComponent * GetAbilitySystemComponent() const override;
void PostInitializeComponents() override;
Expand Down
Loading