This commit is contained in:
Gray
2024-03-20 19:11:16 -04:00
committed by GitHub
parent 138d3cc668
commit a69d1bda6e

View File

@@ -107,23 +107,34 @@ static bool SetNavigationSystem(AAthenaNavSystemConfigOverride* NavSystemOverrid
static inline AFortAthenaMutator_Bots* SpawnBotMutator() //sets up all the classes for phoebe static inline AFortAthenaMutator_Bots* SpawnBotMutator() //sets up all the classes for phoebe
{ {
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass"); static auto BGAClass = FindObject<UClass>(L"/Script/Engine.BlueprintGeneratedClass");
static auto PhoebeMutatorClass = LoadObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass); static auto PhoebeMutatorClass = LoadObject<UClass>(L"/Game/Athena/AI/Phoebe/BP_Phoebe_Mutator.BP_Phoebe_Mutator_C", BGAClass);
auto BotMutator = GetWorld()->SpawnActor<AFortAthenaMutator_Bots>(PhoebeMutatorClass); if (!PhoebeMutatorClass)
{
return nullptr;
}
static auto CachedGameModeOffset = BotMutator->GetOffset("CachedGameMode"); auto BotMutator = GetWorld()->SpawnActor<AFortAthenaMutator_Bots>(PhoebeMutatorClass);
BotMutator->Get(CachedGameModeOffset) = GameMode;
static auto CachedGameStateOffset = BotMutator->GetOffset("CachedGameState", false); if (!BotMutator)
{
LOG_WARN(LogAI, "Failed to spawn Bot Mutator!");
return nullptr;
}
if (CachedGameStateOffset != -1) static auto CachedGameModeOffset = BotMutator->GetOffset("CachedGameMode");
BotMutator->Get(CachedGameStateOffset) = GameState; BotMutator->Get(CachedGameModeOffset) = GameMode;
return BotMutator; static auto CachedGameStateOffset = BotMutator->GetOffset("CachedGameState", false);
if (CachedGameStateOffset != -1)
BotMutator->Get(CachedGameStateOffset) = GameState;
return BotMutator;
} }
static void SetupServerBotManager() static void SetupServerBotManager()
@@ -435,4 +446,4 @@ static AFortPlayerPawn* SpawnAIFromCustomizationData(const FVector& Location, UF
} }
return Pawn; return Pawn;
} }