some ai stuff

might have completely broke ai but idk
This commit is contained in:
Milxnor
2023-05-07 23:42:23 -04:00
parent bfe2610a11
commit d5c95ac978
9 changed files with 217 additions and 119 deletions

View File

@@ -9,3 +9,9 @@ AActor* AController::GetViewTarget()
this->ProcessEvent(GetViewTargetFn, &ViewTarget);
return ViewTarget;
}
void AController::Possess(class APawn* Pawn)
{
auto PossessFn = FindFunction("Possess");
this->ProcessEvent(PossessFn, &Pawn);
}

View File

@@ -6,4 +6,17 @@ class AController : public AActor
{
public:
AActor* GetViewTarget();
void Possess(class APawn* Pawn);
class APawn*& GetPawn()
{
static auto PawnOffset = this->GetOffset("Pawn");
return this->Get<class APawn*>(PawnOffset);
}
class APlayerState*& GetPlayerState()
{
static auto PlayerStateOffset = this->GetOffset("PlayerState");
return this->Get<class APlayerState*>(PlayerStateOffset);
}
};

View File

@@ -554,6 +554,9 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
GetWorld()->Listen();
SetupAIDirector();
SetupServerBotManager();
if (AmountOfBotsToSpawn != 0)
{
Bots::SpawnBotsAtPlayerStarts(AmountOfBotsToSpawn);

View File

@@ -23,12 +23,6 @@ FRotator APlayerController::GetControlRotation()
return rot;
}
void APlayerController::Possess(class APawn* Pawn)
{
static auto fn = FindObject<UFunction>(L"/Script/Engine.Controller.Possess");
this->ProcessEvent(fn, &Pawn);
}
void APlayerController::ServerRestartPlayer()
{
static auto fn = FindObject<UFunction>(L"/Script/Engine.PlayerController.ServerRestartPlayer");

View File

@@ -10,30 +10,6 @@
class APlayerController : public AController
{
public:
/* void Possess(APawn* Pawn)
{
static auto Possess = FindObject<UFunction>("/Script/Engine.Controller.Possess");
this->ProcessEvent(Possess, &Pawn);
}
static inline void ServerAcknowledgePossessionHook(APlayerController* PlayerController, APawn* P)
{
static auto AcknowledgedPawnOffset = PlayerController->GetOffset("AcknowledgedPawn");
PlayerController->Get<APawn*>(AcknowledgedPawnOffset) = P;
} */
class APlayerState*& GetPlayerState()
{
static auto PlayerStateOffset = this->GetOffset("PlayerState");
return this->Get<class APlayerState*>(PlayerStateOffset);
}
class APawn*& GetPawn()
{
static auto PawnOffset = this->GetOffset("Pawn");
return this->Get<class APawn*>(PawnOffset);
}
UCheatManager*& GetCheatManager()
{
static auto CheatManagerOffset = this->GetOffset("CheatManager");
@@ -43,7 +19,6 @@ public:
void ServerChangeName(FString& S);
UCheatManager*& SpawnCheatManager(UClass* CheatManagerClass);
FRotator GetControlRotation();
void Possess(class APawn* Pawn);
void ServerRestartPlayer();
static UClass* StaticClass();

View File

@@ -232,15 +232,6 @@
<ClCompile Include="FortSafeZoneIndicator.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Mutators</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_Disco.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Mutators</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_Barrier.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Mutators</Filter>
</ClCompile>
<ClCompile Include="GenericPlatformMath.cpp">
<Filter>Engine\Source\Runtime\Core\Private\GenericPlatform</Filter>
</ClCompile>
@@ -268,6 +259,15 @@
<ClCompile Include="FortWeaponItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_Barrier.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Athena\Modifiers</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Athena\Modifiers</Filter>
</ClCompile>
<ClCompile Include="FortAthenaMutator_Disco.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Athena\Modifiers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="log.h" />
@@ -745,39 +745,12 @@
<ClInclude Include="FortSafeZoneIndicator.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_GG.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride_Bucket.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_ItemDropOnDeath.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Disco.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Heist.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="AthenaBarrierFlag.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors\Barrier</Filter>
</ClInclude>
<ClInclude Include="AthenaBarrierObjective.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors\Barrier</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Barrier.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="AthenaBigBaseWall.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building\GameplayActors\Barrier</Filter>
</ClInclude>
@@ -826,12 +799,6 @@
<ClInclude Include="FortAthenaVehicleSpawner.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Vehicle</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_TDM.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_LoadoutSwap.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Mutators</Filter>
</ClInclude>
<ClInclude Include="discord.h" />
<ClInclude Include="FortAthenaSupplyDrop.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
@@ -854,6 +821,39 @@
<ClInclude Include="gui.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Disco.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Barrier.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_GG.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_GiveItemsAtGamePhaseStep.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_Heist.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_ItemDropOnDeath.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_InventoryOverride_Bucket.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_TDM.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
<ClInclude Include="FortAthenaMutator_LoadoutSwap.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Athena\Modifiers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">
@@ -1066,12 +1066,6 @@
<Filter Include="FortniteGame\Source\FortniteGame\Public\Athena\Vehicle">
<UniqueIdentifier>{b1cc2ad4-6196-455c-bda7-d0a2e7be2e70}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Mutators">
<UniqueIdentifier>{bfeeff9b-a86e-47a9-973c-47f6d0dfe5d5}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Mutators">
<UniqueIdentifier>{6efc7bff-2d7b-4fdb-bae8-3d2e736cc82e}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Building\GameplayActors\Barrier">
<UniqueIdentifier>{a633ca3f-f699-4c92-8522-e49a14157b95}</UniqueIdentifier>
</Filter>
@@ -1090,6 +1084,15 @@
<Filter Include="Reboot\Private\Gameplay">
<UniqueIdentifier>{52d438db-beaf-44be-bddd-9aeb07c2459f}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Athena\Modifiers">
<UniqueIdentifier>{39656a6c-bfe1-4521-8652-aea0146564d6}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Athena">
<UniqueIdentifier>{411d5144-2703-4a96-a7b0-9f2a81abdead}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Athena\Modifiers">
<UniqueIdentifier>{ade44d65-f7a4-4fc9-ac38-637c84493b58}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="UnrealEngine.cpp">

View File

@@ -1,6 +1,7 @@
#pragma once
#include "Object.h"
#include "Package.h"
#define ANY_PACKAGE (UObject*)-1
@@ -12,3 +13,9 @@ static inline T* StaticFindObject(UClass* Class, UObject* InOuter, const TCHAR*
// LOG_INFO(LogDev, "StaticFindObjectOriginal: {}", __int64(StaticFindObjectOriginal));
return (T*)StaticFindObjectOriginal(Class, InOuter, Name, ExactClass);
}
static inline UPackage* GetTransientPackage()
{
static auto TransientPackage = StaticFindObject<UPackage>(nullptr, nullptr, L"/Engine/Transient");
return TransientPackage;
}

View File

@@ -6,7 +6,10 @@
#include "KismetStringLibrary.h"
#include "GameplayStatics.h"
#include "FortPlayerPawn.h"
#include "FortAthenaMutator.h"
#include "FortPlayerController.h"
#include "FortGameModeAthena.h"
#include "FortGameStateAthena.h"
#include "FortPlayerControllerAthena.h"
using UNavigationSystemV1 = UObject;
@@ -68,7 +71,57 @@ static void SetNavigationSystem(AAthenaNavSystemConfigOverride* NavSystemOverrid
AddNavigationSystemToWorldOriginal(*GetWorld(), EFNavigationSystemRunMode::GameMode, NavSystemOverride->Get("NavigationSystemConfig"), true, false);
}
static void SetupNavConfig()
static void SetupServerBotManager()
{
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto FortServerBotManagerClass = FindObject<UClass>("/Script/FortniteGame.FortServerBotManagerAthena"); // Is there a BP for this? // GameMode->ServerBotManagerClass
if (!FortServerBotManagerClass)
return;
static auto ServerBotManagerOffset = GameMode->GetOffset("ServerBotManager");
UObject*& ServerBotManager = GameMode->Get(ServerBotManagerOffset);
if (!ServerBotManager)
ServerBotManager = UGameplayStatics::SpawnObject(FortServerBotManagerClass, GetTransientPackage());
if (ServerBotManager)
{
static auto CachedGameModeOffset = ServerBotManager->GetOffset("CachedGameMode");
ServerBotManager->Get(CachedGameModeOffset) = GameMode;
static auto CachedGameStateOffset = ServerBotManager->GetOffset("CachedGameState");
ServerBotManager->Get(CachedGameStateOffset) = GameState;
static auto CachedBotMutatorOffset = ServerBotManager->GetOffset("CachedBotMutator");
ServerBotManager->Get(CachedBotMutatorOffset) = FindFirstMutator(FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator_Bots"));
}
}
static void SetupAIDirector()
{
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto AIDirectorClass = FindObject<UClass>("/Script/FortniteGame.AthenaAIDirector"); // Probably wrong class
if (!AIDirectorClass)
return;
static auto AIDirectorOffset = GameMode->GetOffset("AIDirector");
if (!GameMode->Get(AIDirectorOffset))
GameMode->Get(AIDirectorOffset) = GetWorld()->SpawnActor<AActor>(AIDirectorClass);
if (GameMode->Get(AIDirectorOffset))
{
}
}
static void SetupNavConfig(const FName& AgentName)
{
static auto AthenaNavSystemConfigOverrideClass = FindObject<UClass>("/Script/FortniteGame.AthenaNavSystemConfigOverride");
auto NavSystemOverride = GetWorld()->SpawnActor<AActor>(AthenaNavSystemConfigOverrideClass);
@@ -85,7 +138,7 @@ static void SetupNavConfig()
AthenaNavConfig->Get<bool>("bAutoSpawnMissingNavData") = true; // BITFIELD
AthenaNavConfig->Get<bool>("bSpawnNavDataInNavBoundsLevel") = true; // BITFIELD
AthenaNavConfig->Get<bool>("bUseNavigationInvokers") = false;
AthenaNavConfig->Get<FName>("DefaultAgentName") = UKismetStringLibrary::Conv_StringToName(L"Galileo");
AthenaNavConfig->Get<FName>("DefaultAgentName") = AgentName;
// NavSystemOverride->Get<ENavSystemOverridePolicy>("OverridePolicy") = ENavSystemOverridePolicy::Append;
NavSystemOverride->Get("NavigationSystemConfig") = AthenaNavConfig;

View File

@@ -7,22 +7,30 @@
class PlayerBot
{
public:
AFortPlayerControllerAthena* PlayerController = nullptr;
AController* Controller = nullptr;
float NextJumpTime = 1.0f;
void Initialize(FTransform SpawnTransform)
void Initialize(const FTransform& SpawnTransform)
{
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
#if 0
static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
static auto ControllerClass = AFortPlayerControllerAthena::StaticClass();
#else
static auto PawnClass = FindObject<UClass>("/Game/Athena/AI/Phoebe/BP_PlayerPawn_Athena_Phoebe.BP_PlayerPawn_Athena_Phoebe_C");
static auto ControllerClass = FindObject<UClass>("/Game/Athena/AI/Phoebe/BP_PhoebePlayerController.BP_PhoebePlayerController_C");
#endif
static auto FortAthenaAIBotControllerClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaAIBotController");
FActorSpawnParameters PawnSpawnParameters{};
PawnSpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
PlayerController = GetWorld()->SpawnActor<AFortPlayerControllerAthena>(AFortPlayerControllerAthena::StaticClass());
Controller = GetWorld()->SpawnActor<AController>(ControllerClass);
AFortPlayerPawnAthena* Pawn = GetWorld()->SpawnActor<AFortPlayerPawnAthena>(PawnClass, SpawnTransform, PawnSpawnParameters);
AFortPlayerStateAthena* PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
AFortPlayerStateAthena* PlayerState = Cast<AFortPlayerStateAthena>(Controller->GetPlayerState());
if (!Pawn || !PlayerState)
return;
@@ -33,10 +41,12 @@ public:
FString NewName = (L"RebootBot" + BotNumWStr).c_str();
if (auto PlayerController = Cast<APlayerController>(Controller))
PlayerController->ServerChangeName(NewName);
PlayerState->OnRep_PlayerName();
PlayerState->GetTeamIndex() = GameMode->Athena_PickTeamHook(GameMode, 0, PlayerController);
PlayerState->GetTeamIndex() = GameMode->Athena_PickTeamHook(GameMode, 0, Controller);
static auto SquadIdOffset = PlayerState->GetOffset("SquadId", false);
@@ -70,51 +80,84 @@ public:
*/
PlayerController->Possess(Pawn);
Controller->Possess(Pawn);
Pawn->SetHealth(100);
Pawn->SetMaxHealth(100);
FActorSpawnParameters WorldInventorySpawnParameters{};
WorldInventorySpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
WorldInventorySpawnParameters.Owner = PlayerController;
AFortInventory** Inventory = nullptr;
FTransform WorldInventorySpawnTransform{};
static auto FortInventoryClass = FindObject<UClass>("/Script/FortniteGame.FortInventory"); // AFortInventory::StaticClass()
PlayerController->GetWorldInventory() = GetWorld()->SpawnActor<AFortInventory>(FortInventoryClass, WorldInventorySpawnTransform, WorldInventorySpawnParameters);
if (!PlayerController->GetWorldInventory())
if (auto FortPlayerController = Cast<AFortPlayerController>(Controller))
{
LOG_ERROR(LogBots, "Failed to spawn WorldInventory!");
Inventory = &FortPlayerController->GetWorldInventory();
}
else
{
if (Controller->IsA(FortAthenaAIBotControllerClass))
{
static auto InventoryOffset = Controller->GetOffset("Inventory");
Inventory = Controller->GetPtr<AFortInventory*>(InventoryOffset);
}
}
if (!Inventory)
{
LOG_ERROR(LogBots, "No inventory pointer!");
Pawn->K2_DestroyActor();
PlayerController->K2_DestroyActor();
Controller->K2_DestroyActor();
return;
}
PlayerController->GetWorldInventory()->GetInventoryType() = EFortInventoryType::World;
FActorSpawnParameters InventorySpawnParameters{};
InventorySpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
InventorySpawnParameters.Owner = Controller;
static auto bHasInitializedWorldInventoryOffset = PlayerController->GetOffset("bHasInitializedWorldInventory");
PlayerController->Get<bool>(bHasInitializedWorldInventoryOffset) = true;
FTransform InventorySpawnTransform{};
static auto FortInventoryClass = FindObject<UClass>("/Script/FortniteGame.FortInventory"); // AFortInventory::StaticClass()
*Inventory = GetWorld()->SpawnActor<AFortInventory>(FortInventoryClass, InventorySpawnTransform, InventorySpawnParameters);
if (!*Inventory)
{
LOG_ERROR(LogBots, "Failed to spawn Inventory!");
Pawn->K2_DestroyActor();
Controller->K2_DestroyActor();
return;
}
(*Inventory)->GetInventoryType() = EFortInventoryType::World;
if (auto FortPlayerController = Cast<AFortPlayerController>(Controller))
{
static auto bHasInitializedWorldInventoryOffset = FortPlayerController->GetOffset("bHasInitializedWorldInventory");
FortPlayerController->Get<bool>(bHasInitializedWorldInventoryOffset) = true;
}
if (false)
{
if (Inventory)
{
auto& StartingItems = GameMode->GetStartingItems();
auto PickaxeInstance = PlayerController->AddPickaxeToInventory();
UFortItem* PickaxeInstance = nullptr; // PlayerController->AddPickaxeToInventory();
for (int i = 0; i < StartingItems.Num(); i++)
{
auto& StartingItem = StartingItems.at(i);
PlayerController->GetWorldInventory()->AddItem(StartingItem.GetItem(), nullptr, StartingItem.GetCount());
(*Inventory)->AddItem(StartingItem.GetItem(), nullptr, StartingItem.GetCount());
}
if (PickaxeInstance)
{
PlayerController->ServerExecuteInventoryItemHook(PlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid());
// PlayerController->ServerExecuteInventoryItemHook(PlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid());
}
PlayerController->GetWorldInventory()->Update();
(*Inventory)->Update();
}
}
/* static auto HeroType = FindObject(L"/Game/Athena/Heroes/HID_115_Athena_Commando_M_CarbideBlue.HID_115_Athena_Commando_M_CarbideBlue");
@@ -131,15 +174,16 @@ public:
PlayerAbilitySet->GiveToAbilitySystem(AbilitySystemComponent);
}
PlayerController->GetCosmeticLoadout()->GetCharacter() = FindObject("/Game/Athena/Items/Cosmetics/Characters/CID_263_Athena_Commando_F_MadCommander.CID_263_Athena_Commando_F_MadCommander");
Pawn->GetCosmeticLoadout()->GetCharacter() = PlayerController->GetCosmeticLoadout()->GetCharacter();
// PlayerController->GetCosmeticLoadout()->GetCharacter() = FindObject("/Game/Athena/Items/Cosmetics/Characters/CID_263_Athena_Commando_F_MadCommander.CID_263_Athena_Commando_F_MadCommander");
// Pawn->GetCosmeticLoadout()->GetCharacter() = PlayerController->GetCosmeticLoadout()->GetCharacter();
PlayerController->ApplyCosmeticLoadout();
// PlayerController->ApplyCosmeticLoadout();
GameState->GetPlayersLeft()++;
GameState->OnRep_PlayersLeft();
GameMode->GetAlivePlayers().Add(PlayerController);
if (auto FortPlayerControllerAthena = Cast<AFortPlayerControllerAthena>(Controller))
GameMode->GetAlivePlayers().Add(FortPlayerControllerAthena);
}
};
@@ -147,12 +191,12 @@ static std::vector<PlayerBot> AllPlayerBotsToTick;
namespace Bots
{
static AFortPlayerControllerAthena* SpawnBot(FTransform SpawnTransform)
static AController* SpawnBot(FTransform SpawnTransform)
{
auto playerBot = PlayerBot();
playerBot.Initialize(SpawnTransform);
AllPlayerBotsToTick.push_back(playerBot);
return playerBot.PlayerController;
return playerBot.Controller;
}
static void SpawnBotsAtPlayerStarts(int AmountOfBots)
@@ -195,12 +239,12 @@ namespace Bots
// for (int i = 0; i < GameMode->GetAlivePlayers().Num(); i++)
for (auto& PlayerBot : AllPlayerBotsToTick)
{
auto CurrentPlayer = PlayerBot.PlayerController;
auto CurrentPlayer = PlayerBot.Controller;
if (CurrentPlayer->IsActorBeingDestroyed())
continue;
auto CurrentPawn = CurrentPlayer->GetMyFortPawn();
auto CurrentPawn = CurrentPlayer->GetPawn();
auto CurrentPlayerState = Cast<AFortPlayerStateAthena>(CurrentPlayer->GetPlayerState());