Sixze / ALS-Refactored

Completely reworked and improved C++ version of Advanced Locomotion System V4.
MIT License
978 stars 273 forks source link

Small change to character example to allow rebinding actions #382

Closed xkamronx closed 1 year ago

xkamronx commented 1 year ago

Big shout out to Hayato for finding and fixing this one.

You can't rebind keys correctly without changing the character example cpp as follows:

Index: Plugins/AdvancedLocomotion/Source/ALSExtras/Private/AlsCharacterExample.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8

diff --git a/Plugins/AdvancedLocomotion/Source/ALSExtras/Private/AlsCharacterExample.cpp b/Plugins/AdvancedLocomotion/Source/ALSExtras/Private/AlsCharacterExample.cpp --- a/Plugins/AdvancedLocomotion/Source/ALSExtras/Private/AlsCharacterExample.cpp
+++ b/Plugins/AdvancedLocomotion/Source/ALSExtras/Private/AlsCharacterExample.cpp (date 1697693657013) @@ -37,7 +37,9 @@ auto* InputSubsystem{ULocalPlayer::GetSubsystem(NewPlayer->GetLocalPlayer())}; if (IsValid(InputSubsystem)) { remove > InputSubsystem->AddMappingContext(InputMappingContext, 0); FModifyContextOptions Options; Options.bNotifyUserSettings = true; InputSubsystem->AddMappingContext(InputMappingContext, 0, Options); } }

Sixze commented 1 year ago

Please provide a properly formatted code sample.

xkamronx commented 1 year ago

Please provide a properly formatted code sample.

Sorry, I'm no programmer by any stretch.

In the AlsCharacterExample.cpp, you just need to pass the Notify User Settings flag as true when adding the mapping context in order to be able to rebind the keys.

The follow line was removed: InputSubsystem->AddMappingContext(InputMappingContext, 0);

This was added in it's place: FModifyContextOptions Options; Options.bNotifyUserSettings = true; InputSubsystem->AddMappingContext(InputMappingContext, 0, Options);

Sixze commented 1 year ago

Fixed in b397900fcb59412d63e316bfd7b94963b6135595.

xkamronx commented 1 year ago

Thank you for the quick fixes!