diff --git a/Config/DefaultModularFeatures_ExtraActions.ini b/Config/DefaultModularFeatures_ExtraActions.ini new file mode 100644 index 0000000..ea696b2 --- /dev/null +++ b/Config/DefaultModularFeatures_ExtraActions.ini @@ -0,0 +1,2 @@ +[CoreRedirects] ++ClassRedirects=(OldName="/Script/ModularFeatures_ExtraActions.AbilityInputBinding", NewName="/Script/ModularFeatures_ExtraActions.MFEA_AbilityInputBinding") \ No newline at end of file diff --git a/ModularFeatures_ExtraActions.uplugin b/ModularFeatures_ExtraActions.uplugin index 02cae36..49b862d 100644 --- a/ModularFeatures_ExtraActions.uplugin +++ b/ModularFeatures_ExtraActions.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 1, - "VersionName": "1.2.0", + "Version": 2, + "VersionName": "1.2.1", "FriendlyName": "Modular Features: Extra Actions", "Description": "Integrates GAS and Enhanced Input to the existing Game Features and Modular plugins.", "Category": "Game Features", diff --git a/Source/Private/GameFeatureAction_AddAbilities.cpp b/Source/Private/Actions/GameFeatureAction_AddAbilities.cpp similarity index 95% rename from Source/Private/GameFeatureAction_AddAbilities.cpp rename to Source/Private/Actions/GameFeatureAction_AddAbilities.cpp index dff4324..a210add 100644 --- a/Source/Private/GameFeatureAction_AddAbilities.cpp +++ b/Source/Private/Actions/GameFeatureAction_AddAbilities.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_AddAbilities.h" +#include "Actions/GameFeatureAction_AddAbilities.h" #include "Components/GameFrameworkComponentManager.h" #include "InputAction.h" #include "ModularFeatures_InternalFuncs.h" @@ -122,7 +122,7 @@ void UGameFeatureAction_AddAbilities::AddActorAbilities(AActor* TargetActor, con if (!Ability.InputAction.IsNull()) { // Get the target Ability Input Binding interface - const IAbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride); + const IMFEA_AbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride); // If we can bind the input to the target interface, we must add the input reference to the ability data if (UInputAction* const AbilityInput = Ability.InputAction.LoadSynchronous(); @@ -181,7 +181,7 @@ void UGameFeatureAction_AddAbilities::RemoveActorAbilities(AActor* TargetActor) } // Get the interface owner and try to remove the input bindings - if (const IAbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride)) + if (const IMFEA_AbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride)) { ModularFeaturesHelper::RemoveAbilityInputInInterfaceOwner(SetupInputInterface->_getUObject(), ActiveAbilities.InputReference); } diff --git a/Source/Private/GameFeatureAction_AddAttribute.cpp b/Source/Private/Actions/GameFeatureAction_AddAttribute.cpp similarity index 99% rename from Source/Private/GameFeatureAction_AddAttribute.cpp rename to Source/Private/Actions/GameFeatureAction_AddAttribute.cpp index b70c096..62d8bec 100644 --- a/Source/Private/GameFeatureAction_AddAttribute.cpp +++ b/Source/Private/Actions/GameFeatureAction_AddAttribute.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_AddAttribute.h" +#include "Actions/GameFeatureAction_AddAttribute.h" #include "Components/GameFrameworkComponentManager.h" #include "ModularFeatures_InternalFuncs.h" #include "Runtime/Launch/Resources/Version.h" diff --git a/Source/Private/GameFeatureAction_AddEffects.cpp b/Source/Private/Actions/GameFeatureAction_AddEffects.cpp similarity index 99% rename from Source/Private/GameFeatureAction_AddEffects.cpp rename to Source/Private/Actions/GameFeatureAction_AddEffects.cpp index 6c4713d..800a445 100644 --- a/Source/Private/GameFeatureAction_AddEffects.cpp +++ b/Source/Private/Actions/GameFeatureAction_AddEffects.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_AddEffects.h" +#include "Actions/GameFeatureAction_AddEffects.h" #include "Components/GameFrameworkComponentManager.h" #include "ModularFeatures_InternalFuncs.h" diff --git a/Source/Private/GameFeatureAction_AddInputs.cpp b/Source/Private/Actions/GameFeatureAction_AddInputs.cpp similarity index 96% rename from Source/Private/GameFeatureAction_AddInputs.cpp rename to Source/Private/Actions/GameFeatureAction_AddInputs.cpp index 0f1b221..a11f491 100644 --- a/Source/Private/GameFeatureAction_AddInputs.cpp +++ b/Source/Private/Actions/GameFeatureAction_AddInputs.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_AddInputs.h" +#include "Actions/GameFeatureAction_AddInputs.h" #include "EnhancedInputSubsystems.h" #include "InputMappingContext.h" #include "Components/GameFrameworkComponentManager.h" @@ -176,8 +176,8 @@ void UGameFeatureAction_AddInputs::RemoveActorInputs(AActor* TargetActor) InputComponent->RemoveBinding(InputActionBinding); } - // Verify and try to remove the ability bindings by calling the RemoveAbilityInputBinding from IAbilityInputBinding interface - if (const IAbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride)) + // Verify and try to remove the ability bindings by calling the RemoveAbilityInputBinding from IMFEA_AbilityInputBinding interface + if (const IMFEA_AbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride)) { ModularFeaturesHelper::RemoveAbilityInputInInterfaceOwner(SetupInputInterface->_getUObject(), AbilityActions); } @@ -197,7 +197,7 @@ void UGameFeatureAction_AddInputs::SetupActionBindings(AActor* TargetActor, UObj FInputBindingData& NewInputData = ActiveExtensions.FindOrAdd(TargetActor); // Get and store the interface owner before the for-loop - const IAbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride); + const IMFEA_AbilityInputBinding* const SetupInputInterface = ModularFeaturesHelper::GetAbilityInputBindingInterface(TargetActor, InputBindingOwnerOverride); // Load the enumeration and save it before the loop to avoid high disk consumption due to loading a soft reference a lot of times since there's only 1 enumeration TWeakObjectPtr InputIDEnumeration_Ptr = ModularFeaturesHelper::LoadInputEnum(); @@ -233,7 +233,7 @@ void UGameFeatureAction_AddInputs::SetupActionBindings(AActor* TargetActor, UObj continue; } - // Try to bind this input by calling the function SetupAbilityInputBinding from IAbilityInputBinding interface + // Try to bind this input by calling the function SetupAbilityInputBinding from IMFEA_AbilityInputBinding interface if (FGameplayAbilitySpec NewAbilitySpec = GetAbilitySpecInformationFromBindingData(TargetActor, AbilityBindingData, InputIDEnumeration_Ptr.Get()); ModularFeaturesHelper::BindAbilityInputToInterfaceOwner(SetupInputInterface, InputAction, NewAbilitySpec)) { diff --git a/Source/Private/GameFeatureAction_SpawnActors.cpp b/Source/Private/Actions/GameFeatureAction_SpawnActors.cpp similarity index 98% rename from Source/Private/GameFeatureAction_SpawnActors.cpp rename to Source/Private/Actions/GameFeatureAction_SpawnActors.cpp index 981010c..9ab2a57 100644 --- a/Source/Private/GameFeatureAction_SpawnActors.cpp +++ b/Source/Private/Actions/GameFeatureAction_SpawnActors.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_SpawnActors.h" +#include "Actions/GameFeatureAction_SpawnActors.h" #include "Components/GameFrameworkComponentManager.h" void UGameFeatureAction_SpawnActors::OnGameFeatureActivating(FGameFeatureActivatingContext& Context) diff --git a/Source/Private/GameFeatureAction_WorldActionBase.cpp b/Source/Private/Actions/GameFeatureAction_WorldActionBase.cpp similarity index 96% rename from Source/Private/GameFeatureAction_WorldActionBase.cpp rename to Source/Private/Actions/GameFeatureAction_WorldActionBase.cpp index e6dd1dd..f932f95 100644 --- a/Source/Private/GameFeatureAction_WorldActionBase.cpp +++ b/Source/Private/Actions/GameFeatureAction_WorldActionBase.cpp @@ -2,7 +2,7 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" void UGameFeatureAction_WorldActionBase::OnGameFeatureActivating(FGameFeatureActivatingContext& Context) { diff --git a/Source/Private/AbilityInputBinding.cpp b/Source/Private/Interfaces/MFEA_AbilityInputBinding.cpp similarity index 70% rename from Source/Private/AbilityInputBinding.cpp rename to Source/Private/Interfaces/MFEA_AbilityInputBinding.cpp index a4b55c7..6a4b5fb 100644 --- a/Source/Private/AbilityInputBinding.cpp +++ b/Source/Private/Interfaces/MFEA_AbilityInputBinding.cpp @@ -2,4 +2,4 @@ // Year: 2022 // Repo: https://github.com/lucoiso/UEModularFeatures_ExtraActions -#include "AbilityInputBinding.h" \ No newline at end of file +#include "Interfaces/MFEA_AbilityInputBinding.h" \ No newline at end of file diff --git a/Source/Private/ModularFeatures_InternalFuncs.h b/Source/Private/ModularFeatures_InternalFuncs.h index 46e47f7..1689a97 100644 --- a/Source/Private/ModularFeatures_InternalFuncs.h +++ b/Source/Private/ModularFeatures_InternalFuncs.h @@ -7,7 +7,7 @@ #include "CoreMinimal.h" #include "AbilitySystemComponent.h" #include "AbilitySystemInterface.h" -#include "AbilityInputBinding.h" +#include "Interfaces/MFEA_AbilityInputBinding.h" #include "EnhancedInputComponent.h" #include "GameFramework/Controller.h" #include "LogModularFeatures_ExtraActions.h" @@ -57,7 +57,7 @@ namespace ModularFeaturesHelper return GetPluginSettings()->InputBindingOwner; } - IAbilityInputBinding* GetAbilityInputBindingInterface(AActor* InActor, const EInputBindingOwnerOverride& InOwner) + IMFEA_AbilityInputBinding* GetAbilityInputBindingInterface(AActor* InActor, const EInputBindingOwnerOverride& InOwner) { if (!IsValid(InActor)) { @@ -68,8 +68,8 @@ namespace ModularFeaturesHelper { switch (GetValidatedInputBindingOwner(InOwner)) { - case EInputBindingOwner::Pawn: return Cast(TargetPawn); - case EInputBindingOwner::Controller: return Cast(TargetPawn->GetController()); + case EInputBindingOwner::Pawn: return Cast(TargetPawn); + case EInputBindingOwner::Controller: return Cast(TargetPawn->GetController()); default: return nullptr; } } @@ -116,7 +116,7 @@ namespace ModularFeaturesHelper } // Will be removed in the future - but i don't want to break existing projects :) - const bool BindAbilityInputToInterfaceOwnerWithID(const IAbilityInputBinding* TargetInterfaceOwner, UInputAction* InputAction, const int32 InputID) + const bool BindAbilityInputToInterfaceOwnerWithID(const IMFEA_AbilityInputBinding* TargetInterfaceOwner, UInputAction* InputAction, const int32 InputID) { if (!TargetInterfaceOwner) { @@ -125,12 +125,10 @@ namespace ModularFeaturesHelper return false; } - IAbilityInputBinding::Execute_SetupAbilityInputBinding(TargetInterfaceOwner->_getUObject(), InputAction, InputID); - return true; } - const bool BindAbilityInputToInterfaceOwner(const IAbilityInputBinding* TargetInterfaceOwner, UInputAction* InputAction, const FGameplayAbilitySpec& AbilitySpec) + const bool BindAbilityInputToInterfaceOwner(const IMFEA_AbilityInputBinding* TargetInterfaceOwner, UInputAction* InputAction, const FGameplayAbilitySpec& AbilitySpec) { if (!BindAbilityInputToInterfaceOwnerWithID(TargetInterfaceOwner, InputAction, AbilitySpec.InputID)) { @@ -140,19 +138,19 @@ namespace ModularFeaturesHelper switch (GetPluginSettings()->AbilityBindingMode) { case (EAbilityBindingMode::InputID): - IAbilityInputBinding::Execute_SetupAbilityBindingByInput(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec.InputID); + IMFEA_AbilityInputBinding::Execute_SetupAbilityBindingByInput(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec.InputID); break; case (EAbilityBindingMode::AbilitySpec): - IAbilityInputBinding::Execute_SetupAbilityBindingBySpec(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec); + IMFEA_AbilityInputBinding::Execute_SetupAbilityBindingBySpec(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec); break; case (EAbilityBindingMode::AbilityTags): - IAbilityInputBinding::Execute_SetupAbilityBindingByTags(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec.Ability->AbilityTags); + IMFEA_AbilityInputBinding::Execute_SetupAbilityBindingByTags(TargetInterfaceOwner->_getUObject(), InputAction, AbilitySpec.Ability->AbilityTags); break; case (EAbilityBindingMode::AbilityClass): - IAbilityInputBinding::Execute_SetupAbilityBindingByClass(TargetInterfaceOwner->_getUObject(), InputAction, TSubclassOf(AbilitySpec.Ability->GetClass())); + IMFEA_AbilityInputBinding::Execute_SetupAbilityBindingByClass(TargetInterfaceOwner->_getUObject(), InputAction, TSubclassOf(AbilitySpec.Ability->GetClass())); break; default: @@ -174,7 +172,7 @@ namespace ModularFeaturesHelper { if (InputRef.IsValid()) { - IAbilityInputBinding::Execute_RemoveAbilityInputBinding(InterfaceOwner, InputRef.Get()); + IMFEA_AbilityInputBinding::Execute_RemoveAbilityInputBinding(InterfaceOwner, InputRef.Get()); } InputRef.Reset(); diff --git a/Source/Public/GameFeatureAction_AddAbilities.h b/Source/Public/Actions/GameFeatureAction_AddAbilities.h similarity index 98% rename from Source/Public/GameFeatureAction_AddAbilities.h rename to Source/Public/Actions/GameFeatureAction_AddAbilities.h index 202393e..0ac3d79 100644 --- a/Source/Public/GameFeatureAction_AddAbilities.h +++ b/Source/Public/Actions/GameFeatureAction_AddAbilities.h @@ -6,7 +6,7 @@ #include "CoreMinimal.h" #include "GameplayAbilitySpec.h" -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" #include "GameFeatureAction_AddAbilities.generated.h" class UGameplayAbility; diff --git a/Source/Public/GameFeatureAction_AddAttribute.h b/Source/Public/Actions/GameFeatureAction_AddAttribute.h similarity index 96% rename from Source/Public/GameFeatureAction_AddAttribute.h rename to Source/Public/Actions/GameFeatureAction_AddAttribute.h index 140a4ad..0955270 100644 --- a/Source/Public/GameFeatureAction_AddAttribute.h +++ b/Source/Public/Actions/GameFeatureAction_AddAttribute.h @@ -5,7 +5,7 @@ #pragma once #include "CoreMinimal.h" -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" #include "GameFeatureAction_AddAttribute.generated.h" class UAttributeSet; diff --git a/Source/Public/GameFeatureAction_AddEffects.h b/Source/Public/Actions/GameFeatureAction_AddEffects.h similarity index 97% rename from Source/Public/GameFeatureAction_AddEffects.h rename to Source/Public/Actions/GameFeatureAction_AddEffects.h index dc48cf2..69e6115 100644 --- a/Source/Public/GameFeatureAction_AddEffects.h +++ b/Source/Public/Actions/GameFeatureAction_AddEffects.h @@ -7,7 +7,7 @@ #include "CoreMinimal.h" #include "GameplayTagContainer.h" #include "GameplayEffectTypes.h" -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" #include "GameFeatureAction_AddEffects.generated.h" class UGameplayEffect; diff --git a/Source/Public/GameFeatureAction_AddInputs.h b/Source/Public/Actions/GameFeatureAction_AddInputs.h similarity index 97% rename from Source/Public/GameFeatureAction_AddInputs.h rename to Source/Public/Actions/GameFeatureAction_AddInputs.h index 5fd2574..78c218b 100644 --- a/Source/Public/GameFeatureAction_AddInputs.h +++ b/Source/Public/Actions/GameFeatureAction_AddInputs.h @@ -8,7 +8,7 @@ #include "InputTriggers.h" #include "EnhancedInputComponent.h" #include "GameplayAbilitySpec.h" -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" #include "GameFeatureAction_AddInputs.generated.h" class UGameplayAbility; @@ -40,7 +40,7 @@ struct FAbilityInputBindingData { GENERATED_BODY() - /* Should this action setup call SetupAbilityInput/RemoveAbilityInputBinding using the IAbilityInputBinding interface? */ + /* Should this action setup call SetupAbilityInput/RemoveAbilityInputBinding using the IMFEA_AbilityInputBinding interface? */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Settings") bool bSetupAbilityInput = false; diff --git a/Source/Public/GameFeatureAction_SpawnActors.h b/Source/Public/Actions/GameFeatureAction_SpawnActors.h similarity index 96% rename from Source/Public/GameFeatureAction_SpawnActors.h rename to Source/Public/Actions/GameFeatureAction_SpawnActors.h index 32c9706..b320953 100644 --- a/Source/Public/GameFeatureAction_SpawnActors.h +++ b/Source/Public/Actions/GameFeatureAction_SpawnActors.h @@ -5,7 +5,7 @@ #pragma once #include "CoreMinimal.h" -#include "GameFeatureAction_WorldActionBase.h" +#include "Actions/GameFeatureAction_WorldActionBase.h" #include "GameFeatureAction_SpawnActors.generated.h" struct FComponentRequestHandle; diff --git a/Source/Public/GameFeatureAction_WorldActionBase.h b/Source/Public/Actions/GameFeatureAction_WorldActionBase.h similarity index 100% rename from Source/Public/GameFeatureAction_WorldActionBase.h rename to Source/Public/Actions/GameFeatureAction_WorldActionBase.h diff --git a/Source/Public/AbilityInputBinding.h b/Source/Public/Interfaces/MFEA_AbilityInputBinding.h similarity index 74% rename from Source/Public/AbilityInputBinding.h rename to Source/Public/Interfaces/MFEA_AbilityInputBinding.h index ab69459..9b2815d 100644 --- a/Source/Public/AbilityInputBinding.h +++ b/Source/Public/Interfaces/MFEA_AbilityInputBinding.h @@ -8,7 +8,7 @@ #include "UObject/Interface.h" #include "GameplayAbilitySpec.h" #include "GameplayTagContainer.h" -#include "AbilityInputBinding.generated.h" +#include "MFEA_AbilityInputBinding.generated.h" /** * @@ -16,21 +16,17 @@ class UInputAction; /* Your pawn or controller need this inferface to accept ability input bindings */ -UINTERFACE(MinimalAPI, Blueprintable, Category = "MF Extra Actions | Modular Interfaces") -class UAbilityInputBinding : public UInterface +UINTERFACE(MinimalAPI, Blueprintable, Category = "MF Extra Actions | Interfaces", Meta = (DisplayName = "MF Extra Actions: Ability Input Binding")) +class UMFEA_AbilityInputBinding : public UInterface { GENERATED_BODY() }; /* Your pawn or controller need this inferface to accept ability input bindings */ -class MODULARFEATURES_EXTRAACTIONS_API IAbilityInputBinding +class MODULARFEATURES_EXTRAACTIONS_API IMFEA_AbilityInputBinding { GENERATED_IINTERFACE_BODY() - /* This function is needed for setup ability input binding inside your controller or pawn */ - UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MF Extra Actions | Modular Interfaces", Meta = (Deprecated = "true", DeprecationMessage = "There are new functions to bind the input. Please check SetupAbilityBindingByInput, SetupAbilityBindingBySpec, SetupAbilityBindingByTags and SetupAbilityBindingByClass")) - void SetupAbilityInputBinding(UInputAction* Action, const int32 InputID); - /* Setup ability bind using input id - AbilityLocalInputPressed(InputID)*/ UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MF Extra Actions | Modular Interfaces") void SetupAbilityBindingByInput(UInputAction* Action, const int32 InputID); diff --git a/Source/Public/MFEA_Settings.h b/Source/Public/MFEA_Settings.h index 5ecb7a4..6c00910 100644 --- a/Source/Public/MFEA_Settings.h +++ b/Source/Public/MFEA_Settings.h @@ -41,7 +41,7 @@ class MODULARFEATURES_EXTRAACTIONS_API UMFEA_Settings : public UDeveloperSetting bool bEnableAbilityAutoBinding; public: - /* Determine the binding mode that will be used by this plugin - This choice affects which function from IAbilityInputBinding interface will be used to bind the abilities */ + /* Determine the binding mode that will be used by this plugin - This choice affects which function from IMFEA_AbilityInputBinding interface will be used to bind the abilities */ UPROPERTY(GlobalConfig, EditAnywhere, Category = "Settings", Meta = (EditCondition = "!bEnableAbilityAutoBinding")) EAbilityBindingMode AbilityBindingMode;