Skip to content

Commit fbc3ae4

Browse files
committed
chore: some stuff
1 parent 4a24fd2 commit fbc3ae4

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

Source/Ecsact/Public/EcsactUnreal/Blueprint/EcsactAsyncConnectBlueprintAction.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ auto UEcsactAsyncConnectBlueprintAction::Activate() -> void {
2323
TEXT("Cannot use Ecsact async blueprint api with runner that does not "
2424
"implement IEcsactAsyncRunnerEvents")
2525
);
26+
OnError.Broadcast(EAsyncConnectError::AsyncRunnerEventsUnavailable);
27+
OnDone.Broadcast({});
2628
return;
2729
}
2830

2931
auto req_id = ecsact_async_connect(Utf8ConnectionString.c_str());
3032

33+
if(req_id == ECSACT_INVALID_ID(async_request)) {
34+
OnError.Broadcast(EAsyncConnectError::InvalidRequestId);
35+
OnDone.Broadcast({});
36+
return;
37+
}
38+
3139
async_events->OnRequestDone(
3240
req_id,
3341
IEcsactAsyncRunnerEvents::FAsyncRequestDoneCallback::CreateUObject(

Source/Ecsact/Public/EcsactUnreal/Blueprint/EcsactAsyncConnectBlueprintAction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
UENUM()
99
enum class EAsyncConnectError : uint8 {
1010
NoError,
11+
AsyncRunnerEventsUnavailable,
12+
InvalidRequestId,
1113
PermissionDenied,
1214
InvalidConnectionString,
1315
};

Source/Ecsact/Public/EcsactUnreal/Ecsact.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ auto FEcsactModule::StartupModule() -> void {
9090
}
9191
#if WITH_EDITOR
9292
FEditorDelegates::PreBeginPIE.AddRaw(this, &FEcsactModule::OnPreBeginPIE);
93-
FEditorDelegates::EndPIE.AddRaw(this, &FEcsactModule::OnEndPIE);
93+
FEditorDelegates::EndPIE.AddRaw(this, &FEcsactModule::OnPrePIEEnded);
9494
#endif
9595
}
9696

@@ -110,7 +110,7 @@ auto FEcsactModule::OnPreBeginPIE(bool _) -> void {
110110
LoadEcsactRuntime();
111111
}
112112

113-
auto FEcsactModule::OnEndPIE(bool _) -> void {
113+
auto FEcsactModule::OnPrePIEEnded(bool _) -> void {
114114
UnloadEcsactRuntime();
115115
}
116116

Source/Ecsact/Public/EcsactUnreal/Ecsact.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FEcsactModule : public IModuleInterface {
1616
auto UnloadEcsactRuntime() -> void;
1717
auto Abort() -> void;
1818
auto OnPreBeginPIE(bool bIsSimulating) -> void;
19-
auto OnEndPIE(const bool bIsSimulating) -> void;
19+
auto OnPrePIEEnded(const bool bIsSimulating) -> void;
2020

2121
auto StartRunner() -> void;
2222
auto StopRunner() -> void;

Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "UObject/UObjectIterator.h"
21
#include "EcsactUnreal/EcsactRunner.h"
2+
#include "UObject/ObjectMacros.h"
3+
#include "UObject/UObjectIterator.h"
34
#include "EcsactUnreal/EcsactRunnerSubsystem.h"
45
#include "EcsactUnreal/Ecsact.h"
56
#include "ecsact/runtime/common.h"
@@ -55,6 +56,10 @@ auto UEcsactRunner::InitRunnerSubsystems() -> void {
5556
continue;
5657
}
5758

59+
if(uclass->HasAnyClassFlags(CLASS_Abstract | CLASS_Deprecated)) {
60+
continue;
61+
}
62+
5863
subsystem_types.Add(uclass);
5964
}
6065

@@ -63,7 +68,9 @@ auto UEcsactRunner::InitRunnerSubsystems() -> void {
6368

6469
for(auto t : subsystem_types) {
6570
UE_LOG(Ecsact, Log, TEXT("Starting ecsact subsystem %s"), *t->GetName());
66-
RunnerSubsystems.Add(NewObject<UEcsactRunnerSubsystem>(this, t));
71+
auto subsystem = NewObject<UEcsactRunnerSubsystem>(this, t);
72+
subsystem->AddToRoot();
73+
RunnerSubsystems.Add(subsystem);
6774
}
6875

6976
for(auto subsystem : RunnerSubsystems) {
@@ -73,6 +80,9 @@ auto UEcsactRunner::InitRunnerSubsystems() -> void {
7380

7481
auto UEcsactRunner::ShutdownRunnerSubsystems() -> void {
7582
for(auto subsystem : RunnerSubsystems) {
83+
if(subsystem == nullptr) {
84+
continue;
85+
}
7686
subsystem->RunnerStop(this);
7787
}
7888

Source/Ecsact/Public/EcsactUnreal/EcsactRunnerSubsystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "ecsact/runtime/common.h"
44
#include "EcsactRunnerSubsystem.generated.h"
55

6-
UCLASS(Blueprintable)
6+
UCLASS(Abstract, Blueprintable)
77

88
class ECSACT_API UEcsactRunnerSubsystem : public UObject {
99
GENERATED_BODY() // NOLINT

Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static auto generate_header(ecsact::codegen_plugin_context ctx) -> void {
259259
}
260260

261261
ctx.write(std::format(
262-
"UCLASS(Blueprintable, meta = "
262+
"UCLASS(Abstract, Blueprintable, meta = "
263263
"(DisplayName = \"Ecsact Runner Package Subsystem ({})\"))\n",
264264
ecsact::meta::package_name(ctx.package_id)
265265
));

0 commit comments

Comments
 (0)