Skip to content

Commit 0db0b28

Browse files
authored
Api mod fix (#29)
* Fix for getting the singleton actor * Bump version to 1.11
1 parent 35bda28 commit 0db0b28

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

AsaApi/Core/Private/Ark/ArkBaseApi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace API
1515
{
16-
constexpr float api_version = 1.1;
16+
constexpr float api_version = 1.11f;
1717

1818
ArkBaseApi::ArkBaseApi()
1919
: commands_(std::make_unique<AsaApi::Commands>()),

AsaApi/Core/Public/AsaApiModUtils.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,19 @@ namespace AsaApiModUtils
1616
if (!Singleton)
1717
{
1818
ACustomActorList* actorList = UVictoryCore::GetCustomActorList(AsaApi::GetApiUtils().GetWorld(), "ApiUtilsCCA");
19-
2019
if (actorList != nullptr)
2120
Singleton = GetWeakReference(actorList->ActorListField()[0]);
21+
22+
if (!Singleton)
23+
{
24+
TArray<AActor*> actors;
25+
UClass* SingletonClass = UVictoryCore::BPLoadClass("Blueprint'/AsaApiUtils/ApiUtilsSingleton.ApiUtilsSingleton'");
26+
if (SingletonClass != nullptr)
27+
{
28+
UGameplayStatics::GetAllActorsOfClass(AsaApi::GetApiUtils().GetWorld(), SingletonClass, &actors);
29+
Singleton = GetWeakReference(actors[0]);
30+
}
31+
}
2232
}
2333

2434
return Singleton;

0 commit comments

Comments
 (0)