Skip to content

fix ability buffer #283

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 1 commit into from
Jul 26, 2024
Merged
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 @@ -79,7 +79,7 @@ void UGBFAbilityInputBufferComponent::BindActions()
return;
}

auto * pawn = GetPawn< APawn >();
const auto * pawn = GetPawn< APawn >();
if ( pawn == nullptr )
{
return;
Expand All @@ -97,32 +97,29 @@ void UGBFAbilityInputBufferComponent::BindActions()
return;
}

// :FIXME: mg Ability input config is null, comment for hotfix

// 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() );
// }
// }
// }
for ( const auto & input_config : hero_component->GetBoundActionsByInputconfig() )
{
for ( const auto & tag : InputTagsToCheck )
{
if ( const auto * input_action = input_config.Key->FindAbilityInputActionForTag( tag ) )
{
BindHandles.Add( input_component->BindAction( input_action, ETriggerEvent::Triggered, this, &ThisClass::AbilityInputTagPressed, tag ).GetHandle() );
}
}
}
}

void UGBFAbilityInputBufferComponent::RemoveBinds()
{
auto * pawn = GetPawn< APawn >();
const auto * pawn = GetPawn< APawn >();
if ( pawn == nullptr )
{
return;
}

if ( auto * input_component = Cast< UEnhancedInputComponent >( pawn->InputComponent ) )
{
for ( auto & handle : BindHandles )
for ( const auto & handle : BindHandles )
{
input_component->RemoveBindingByHandle( handle );
}
Expand All @@ -141,7 +138,7 @@ bool UGBFAbilityInputBufferComponent::TryToTriggerAbility()
return false;
}

auto * pawn = GetPawn< APawn >();
const auto * pawn = GetPawn< APawn >();
if ( pawn == nullptr )
{
return false;
Expand Down Expand Up @@ -213,7 +210,7 @@ FGameplayTag UGBFAbilityInputBufferComponent::GetMostTriggeredInput()
TSortedMap< int, FGameplayTag > triggered_tag_map;

// Remove all to get count easily
for ( auto & tag_to_remove : InputTagsToCheck )
for ( const auto & tag_to_remove : InputTagsToCheck )
{
int count = TriggeredTags.Remove( tag_to_remove );
triggered_tag_map.Add( count, tag_to_remove );
Expand All @@ -227,7 +224,7 @@ FGameplayTag UGBFAbilityInputBufferComponent::GetMostTriggeredInput()
FGameplayTag most_triggered_tag = triggered_tag_map.FindAndRemoveChecked( max );

triggered_tag_map.Remove( 0 );
for ( auto & input : triggered_tag_map )
for ( const auto & input : triggered_tag_map )
{
TriggeredTags.Add( input.Value );
}
Expand Down
Loading