From 73275ef29e85dd1704a5d4d39506807d646b6ad9 Mon Sep 17 00:00:00 2001 From: Jesus Bracho Date: Sun, 12 Jun 2022 13:48:38 -0400 Subject: [PATCH] Game feature (#23) * Convert plugin to a game feature * Add init file * Confirm that the component is registered * Set camera to active on begin play * Get UAT tool building --- Content/AC_RTSCameraFollowMe.uasset | 4 +-- Content/BPFL_OpenRTSCameraSystem.uasset | 3 -- Content/BPFL_RTSCameraSystem.uasset | 3 ++ Content/BP_OpenRTSCamera.uasset | 3 -- Content/BP_OpenRTSGameMode.uasset | 3 -- Content/BP_RTSCamera.uasset | 3 ++ Content/OpenRTSCamera.uasset | 3 ++ OpenRTSCamera.uplugin | 35 ++++++++++++------- .../OpenRTSCameraRuntime.Build.cs} | 6 ++-- .../Private/OpenRTSCameraRuntimeModule.cpp} | 8 ++--- .../Private/RTSCamera.cpp | 6 ++++ .../Private/RTSCameraBoundsVolume.cpp | 5 ++- .../Public/OpenRTSCameraRuntimeModule.h} | 4 +-- .../Public/RTSCamera.h | 7 ++-- .../Public/RTSCameraBoundsVolume.h | 7 ++-- 15 files changed, 55 insertions(+), 45 deletions(-) delete mode 100644 Content/BPFL_OpenRTSCameraSystem.uasset create mode 100644 Content/BPFL_RTSCameraSystem.uasset delete mode 100644 Content/BP_OpenRTSCamera.uasset delete mode 100644 Content/BP_OpenRTSGameMode.uasset create mode 100644 Content/BP_RTSCamera.uasset create mode 100644 Content/OpenRTSCamera.uasset rename Source/{OpenRTSCamera/OpenRTSCamera.Build.cs => OpenRTSCameraRuntime/OpenRTSCameraRuntime.Build.cs} (82%) rename Source/{OpenRTSCamera/Private/OpenRTSCamera.cpp => OpenRTSCameraRuntime/Private/OpenRTSCameraRuntimeModule.cpp} (68%) rename Source/{OpenRTSCamera => OpenRTSCameraRuntime}/Private/RTSCamera.cpp (98%) rename Source/{OpenRTSCamera => OpenRTSCameraRuntime}/Private/RTSCameraBoundsVolume.cpp (90%) rename Source/{OpenRTSCamera/Public/OpenRTSCamera.h => OpenRTSCameraRuntime/Public/OpenRTSCameraRuntimeModule.h} (70%) rename Source/{OpenRTSCamera => OpenRTSCameraRuntime}/Public/RTSCamera.h (96%) rename Source/{OpenRTSCamera => OpenRTSCameraRuntime}/Public/RTSCameraBoundsVolume.h (72%) diff --git a/Content/AC_RTSCameraFollowMe.uasset b/Content/AC_RTSCameraFollowMe.uasset index c658716..2f03cc7 100644 --- a/Content/AC_RTSCameraFollowMe.uasset +++ b/Content/AC_RTSCameraFollowMe.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:adb8e5ed5e639b147489537c2772ad8406398e810c7262c44dc8a86173170ec6 -size 25367 +oid sha256:2570f2899c41badf7b703be775567748eda2c94a6d57e50b09f889995f145bfc +size 25847 diff --git a/Content/BPFL_OpenRTSCameraSystem.uasset b/Content/BPFL_OpenRTSCameraSystem.uasset deleted file mode 100644 index 262dc17..0000000 --- a/Content/BPFL_OpenRTSCameraSystem.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:56d7092f03af493f39708cb14aa6d2855b19b99ed0db400ff2b63c4d4afd2319 -size 20349 diff --git a/Content/BPFL_RTSCameraSystem.uasset b/Content/BPFL_RTSCameraSystem.uasset new file mode 100644 index 0000000..b9521a4 --- /dev/null +++ b/Content/BPFL_RTSCameraSystem.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b42816d6a507678971fce2c1abb5c700bc0841db7e0d388a3ceca5326cedebd3 +size 19929 diff --git a/Content/BP_OpenRTSCamera.uasset b/Content/BP_OpenRTSCamera.uasset deleted file mode 100644 index 86f8090..0000000 --- a/Content/BP_OpenRTSCamera.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:87376a5cce4a716f99b4091795deeec89359d4d2996f9c8d9a3f4899e9218e82 -size 24719 diff --git a/Content/BP_OpenRTSGameMode.uasset b/Content/BP_OpenRTSGameMode.uasset deleted file mode 100644 index 5f1908c..0000000 --- a/Content/BP_OpenRTSGameMode.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:33971696a4da561b25e88d74c92dd4764fe6226267b9cc7f8943242ad7d95295 -size 19428 diff --git a/Content/BP_RTSCamera.uasset b/Content/BP_RTSCamera.uasset new file mode 100644 index 0000000..e7b3c4d --- /dev/null +++ b/Content/BP_RTSCamera.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6976f9f94f454c410f5213baa64f7717edcb0a00e1e2cb83d4bd57fab32b59c +size 24849 diff --git a/Content/OpenRTSCamera.uasset b/Content/OpenRTSCamera.uasset new file mode 100644 index 0000000..c33c116 --- /dev/null +++ b/Content/OpenRTSCamera.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ebe3499555f3167f06fa7a7bc5087eb59f7d06cffc7a003e47db9cb4cbfb0a2 +size 3032 diff --git a/OpenRTSCamera.uplugin b/OpenRTSCamera.uplugin index 8ce6bae..f7b6bc6 100644 --- a/OpenRTSCamera.uplugin +++ b/OpenRTSCamera.uplugin @@ -1,21 +1,23 @@ { - "FileVersion": 3, - "Version": 1, - "VersionName": "0.14.0", - "FriendlyName": "OpenRTSCamera", - "Description": "An Unreal Engine 5 open-source RTS/MOBA camera implementation that aims to be fully featured, customizable and dependable", - "Category": "Gameplay", + "BuiltInInitialFeatureState": "Active", + "CanContainContent": true, + "Category": "Game Features", "CreatedBy": "Jesus Bracho", "CreatedByURL": "https://github.com/HeyZoos", + "Description": "An Unreal Engine 5 open-source RTS/MOBA camera implementation that aims to be fully featured, customizable and dependable", "DocsURL": "https://github.com/HeyZoos/OpenRTSCamera/wiki", - "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/94e9872ad3754e798b6ec53f4494f5de", - "SupportURL": "https://github.com/HeyZoos/OpenRTSCamera/issues", - "CanContainContent": true, + "EnabledByDefault": false, "EngineVersion": "5.0.0", + "ExplicitlyLoaded": true, + "FileVersion": 3, + "FriendlyName": "OpenRTSCamera", "Installed": false, + "IsBetaVersion": false, + "IsExperimentalVersion": false, + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/94e9872ad3754e798b6ec53f4494f5de", "Modules": [ { - "Name": "OpenRTSCamera", + "Name": "OpenRTSCameraRuntime", "Type": "Runtime", "LoadingPhase": "Default", "PlatformAllowList": [ @@ -27,8 +29,17 @@ { "Name": "EnhancedInput", "Enabled": true + }, + { + "Name": "GameFeatures", + "Enabled": true + }, + { + "Name": "ModularGameplay", + "Enabled": true } ], - "IsBetaVersion": false, - "IsExperimentalVersion": false + "SupportURL": "https://github.com/HeyZoos/OpenRTSCamera/issues", + "Version": 1, + "VersionName": "0.15.0" } \ No newline at end of file diff --git a/Source/OpenRTSCamera/OpenRTSCamera.Build.cs b/Source/OpenRTSCameraRuntime/OpenRTSCameraRuntime.Build.cs similarity index 82% rename from Source/OpenRTSCamera/OpenRTSCamera.Build.cs rename to Source/OpenRTSCameraRuntime/OpenRTSCameraRuntime.Build.cs index 4db38ff..8016852 100644 --- a/Source/OpenRTSCamera/OpenRTSCamera.Build.cs +++ b/Source/OpenRTSCameraRuntime/OpenRTSCameraRuntime.Build.cs @@ -2,9 +2,9 @@ using UnrealBuildTool; -public class OpenRTSCamera : ModuleRules +public class OpenRTSCameraRuntime : ModuleRules { - public OpenRTSCamera(ReadOnlyTargetRules Target) : base(Target) + public OpenRTSCameraRuntime(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; @@ -45,4 +45,4 @@ public OpenRTSCamera(ReadOnlyTargetRules Target) : base(Target) } ); } -} \ No newline at end of file +} diff --git a/Source/OpenRTSCamera/Private/OpenRTSCamera.cpp b/Source/OpenRTSCameraRuntime/Private/OpenRTSCameraRuntimeModule.cpp similarity index 68% rename from Source/OpenRTSCamera/Private/OpenRTSCamera.cpp rename to Source/OpenRTSCameraRuntime/Private/OpenRTSCameraRuntimeModule.cpp index 6094e98..60cac43 100644 --- a/Source/OpenRTSCamera/Private/OpenRTSCamera.cpp +++ b/Source/OpenRTSCameraRuntime/Private/OpenRTSCameraRuntimeModule.cpp @@ -1,15 +1,15 @@ // Copyright 2022 Jesus Bracho All Rights Reserved. -#include "OpenRTSCamera.h" +#include "OpenRTSCameraRuntimeModule.h" #define LOCTEXT_NAMESPACE "FOpenRTSCameraModule" -void FOpenRTSCameraModule::StartupModule() +void FOpenRTSCameraRuntimeModule::StartupModule() { // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module } -void FOpenRTSCameraModule::ShutdownModule() +void FOpenRTSCameraRuntimeModule::ShutdownModule() { // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, // we call this function before unloading the module. @@ -17,4 +17,4 @@ void FOpenRTSCameraModule::ShutdownModule() #undef LOCTEXT_NAMESPACE -IMPLEMENT_MODULE(FOpenRTSCameraModule, OpenRTSCamera) \ No newline at end of file +IMPLEMENT_MODULE(FOpenRTSCameraRuntimeModule, OpenRTSCamera) diff --git a/Source/OpenRTSCamera/Private/RTSCamera.cpp b/Source/OpenRTSCameraRuntime/Private/RTSCamera.cpp similarity index 98% rename from Source/OpenRTSCamera/Private/RTSCamera.cpp rename to Source/OpenRTSCameraRuntime/Private/RTSCamera.cpp index cbf25af..e92bfb9 100644 --- a/Source/OpenRTSCamera/Private/RTSCamera.cpp +++ b/Source/OpenRTSCameraRuntime/Private/RTSCamera.cpp @@ -67,6 +67,7 @@ void URTSCamera::BeginPlay() this->CheckForEnhancedInputComponent(); this->BindInputMappingContext(); this->BindInputActions(); + this->SetActiveCamera(); } void URTSCamera::TickComponent( @@ -312,6 +313,11 @@ void URTSCamera::BindInputActions() } } +void URTSCamera::SetActiveCamera() const +{ + UGameplayStatics::GetPlayerController(this->GetWorld(), 0)->SetViewTarget(this->GetOwner()); +} + void URTSCamera::ConditionallyPerformEdgeScrolling() const { if (this->EnableEdgeScrolling) diff --git a/Source/OpenRTSCamera/Private/RTSCameraBoundsVolume.cpp b/Source/OpenRTSCameraRuntime/Private/RTSCameraBoundsVolume.cpp similarity index 90% rename from Source/OpenRTSCamera/Private/RTSCameraBoundsVolume.cpp rename to Source/OpenRTSCameraRuntime/Private/RTSCameraBoundsVolume.cpp index 3307f1d..7d64ae0 100644 --- a/Source/OpenRTSCamera/Private/RTSCameraBoundsVolume.cpp +++ b/Source/OpenRTSCameraRuntime/Private/RTSCameraBoundsVolume.cpp @@ -1,8 +1,7 @@ // Copyright 2022, Jesus Bracho, All Rights Reserved. - #include "RTSCameraBoundsVolume.h" - +#include "Components/PrimitiveComponent.h" ARTSCameraBoundsVolume::ARTSCameraBoundsVolume() { @@ -12,4 +11,4 @@ ARTSCameraBoundsVolume::ARTSCameraBoundsVolume() { PrimitiveComponent->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName, false); } -} \ No newline at end of file +} diff --git a/Source/OpenRTSCamera/Public/OpenRTSCamera.h b/Source/OpenRTSCameraRuntime/Public/OpenRTSCameraRuntimeModule.h similarity index 70% rename from Source/OpenRTSCamera/Public/OpenRTSCamera.h rename to Source/OpenRTSCameraRuntime/Public/OpenRTSCameraRuntimeModule.h index 501ab52..5d165d6 100644 --- a/Source/OpenRTSCamera/Public/OpenRTSCamera.h +++ b/Source/OpenRTSCameraRuntime/Public/OpenRTSCameraRuntimeModule.h @@ -5,11 +5,9 @@ #include "CoreMinimal.h" #include "Modules/ModuleManager.h" -class FOpenRTSCameraModule : public IModuleInterface +class FOpenRTSCameraRuntimeModule : public IModuleInterface { public: - - /** IModuleInterface implementation */ virtual void StartupModule() override; virtual void ShutdownModule() override; }; diff --git a/Source/OpenRTSCamera/Public/RTSCamera.h b/Source/OpenRTSCameraRuntime/Public/RTSCamera.h similarity index 96% rename from Source/OpenRTSCamera/Public/RTSCamera.h rename to Source/OpenRTSCameraRuntime/Public/RTSCamera.h index baac9e0..94f6245 100644 --- a/Source/OpenRTSCamera/Public/RTSCamera.h +++ b/Source/OpenRTSCameraRuntime/Public/RTSCamera.h @@ -9,9 +9,8 @@ #include "GameFramework/SpringArmComponent.h" #include "RTSCamera.generated.h" - -UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) -class OPENRTSCAMERA_API URTSCamera : public UActorComponent +UCLASS(Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) +class OPENRTSCAMERARUNTIME_API URTSCamera : public UActorComponent { GENERATED_BODY() @@ -49,7 +48,6 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera") float RotateSpeed; - UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera") bool EnableCameraLag; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera") @@ -134,6 +132,7 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent void CheckForEnhancedInputComponent() const; void BindInputMappingContext() const; void BindInputActions(); + void SetActiveCamera() const; void ConditionallyPerformEdgeScrolling() const; void EdgeScrollLeft() const; diff --git a/Source/OpenRTSCamera/Public/RTSCameraBoundsVolume.h b/Source/OpenRTSCameraRuntime/Public/RTSCameraBoundsVolume.h similarity index 72% rename from Source/OpenRTSCamera/Public/RTSCameraBoundsVolume.h rename to Source/OpenRTSCameraRuntime/Public/RTSCameraBoundsVolume.h index fa287a9..abab9ef 100644 --- a/Source/OpenRTSCamera/Public/RTSCameraBoundsVolume.h +++ b/Source/OpenRTSCameraRuntime/Public/RTSCameraBoundsVolume.h @@ -6,13 +6,10 @@ #include "GameFramework/CameraBlockingVolume.h" #include "RTSCameraBoundsVolume.generated.h" -/** - * - */ UCLASS() -class OPENRTSCAMERA_API ARTSCameraBoundsVolume : public ACameraBlockingVolume +class OPENRTSCAMERARUNTIME_API ARTSCameraBoundsVolume : public ACameraBlockingVolume { GENERATED_BODY() - + ARTSCameraBoundsVolume(); };