Skip to content

Commit

Permalink
Updated ModLoaderActor Spawning
Browse files Browse the repository at this point in the history
*Changed the ModLoaderActor to only spawn on once rather then every time the game state is initialized
  • Loading branch information
RussellJerome committed Feb 13, 2021
1 parent 29a493d commit 589fd71
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Headers/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ namespace Hooks
{
SDK::InitSDK();
Log::Info("Engine Classes Loaded");

SDK::FTransform transform;
transform.Translation = Functions::makeVector(0, 0, 0);
transform.Rotation = Functions::makeQuat(0, 0, 0, 0);
transform.Scale3D = Functions::makeVector(1, 1, 1);
FActorSpawnParameters* spawnParams = &FActorSpawnParameters::FActorSpawnParameters();
SDK::UClass* ModActorObject = Functions::LoadClassFromString(L"/Game/ModLoaderContent/ModLoaderActor.ModLoaderActor_C", false);
if (ModActorObject)
{
Log::Info("Sucessfully Loaded ModLoader Pak");
}
Global::ModLoaderActor = Functions::SpawnActor(SDK::UWorld::GetWorld(), ModActorObject, &transform, spawnParams);

FirstLoad = false;
}
for (int i = 0; i < Global::ModActors.size(); i++)
Expand All @@ -38,20 +51,13 @@ namespace Hooks
Global::ModActors.clear();
Functions::FOutputDevice ar;
Functions::CallFunctionByNameWithArguments(Global::ModLoaderActor, L"CleanLoader", &ar, NULL, true);
Global::ModLoaderActor = nullptr;
if (Functions::addr_StaticLoadObject)
{
SDK::FTransform transform;
transform.Translation = Functions::makeVector(0, 0, 0);
transform.Rotation = Functions::makeQuat(0, 0, 0, 0);
transform.Scale3D = Functions::makeVector(1, 1, 1);
FActorSpawnParameters* spawnParams = &FActorSpawnParameters::FActorSpawnParameters();
SDK::UClass* ModActorObject = Functions::LoadClassFromString(L"/Game/ModLoaderContent/ModLoaderActor.ModLoaderActor_C", false);
if (ModActorObject)
{
Log::Info("Sucessfully Loaded ModLoader Pak");
}
Global::ModLoaderActor = Functions::SpawnActor(SDK::UWorld::GetWorld(), ModActorObject, &transform, spawnParams);
for (int i = 0; i < Global::modnames.size(); i++)
{
std::wstring CurrentMod;
Expand Down

0 comments on commit 589fd71

Please sign in to comment.