reboot living up to its name

This commit is contained in:
Milxnor
2023-06-19 10:11:30 -04:00
parent 5f51e034b0
commit 444af18b39
15 changed files with 115 additions and 50 deletions

View File

@@ -27,7 +27,10 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
LOG_INFO(LogDev, "RebootingDelegateHook!");
if (!SpawnMachine->GetResurrectLocation())
{
LOG_WARN(LogRebooting, "Reboot van did not have a resurrection location!");
return;
}
LOG_INFO(LogDev, "PlayerIdsForResurrection.Num(): {}", SpawnMachine->GetPlayerIdsForResurrection().Num());
@@ -61,8 +64,6 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
}
}
LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController));
if (!PlayerController)
return;
@@ -91,27 +92,24 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
if (!StrongResurrectionLocation)
return;
// GameMode->RestartPlayerAtPlayerStart(PlayerController, StrongResurrectionLocation);
PlayerState->GetRespawnData()->IsRespawnDataAvailable() = false;
PlayerController->SetPlayerIsWaiting(true);
PlayerController->ServerRestartPlayer();
// PlayerController->ServerRestartPlayer();
/* static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
auto NewPawn = GetWorld()->SpawnActor<AFortPlayerPawnAthena>(PawnClass, StrongResurrectionLocation->GetTransform());
PlayerController->Possess(NewPawn); */
bool bEnterSkydiving = false; // TODO get from like curve table iirc idk or the variable
PlayerController->RespawnPlayerAfterDeath(bEnterSkydiving);
AFortPlayerPawn* NewPawn = Cast<AFortPlayerPawn>(PlayerController->GetMyFortPawn());
LOG_INFO(LogDev, "NewPawn: {}", __int64(NewPawn));
if (!NewPawn) // Failed to restart player
{
LOG_INFO(LogRebooting, "Failed to restart the player!");
return;
bool bEnterSkydiving = false; // TODO get from like curve table iirc idk or the variable
}
PlayerController->ClientClearDeathNotification();
// PlayerController->RespawnPlayerAfterDeath(bEnterSkydiving);
NewPawn->SetHealth(100);
NewPawn->SetMaxHealth(100);
@@ -122,6 +120,9 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
static auto OnRep_RebootCounterFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.OnRep_RebootCounter");
PlayerState->ProcessEvent(OnRep_RebootCounterFn);
auto OnPlayerPawnResurrectedFn = SpawnMachine->FindFunction("OnPlayerPawnResurrected");
SpawnMachine->ProcessEvent(OnPlayerPawnResurrectedFn, &NewPawn);
static void (*AddToAlivePlayersOriginal)(AFortGameModeAthena* GameMode, AFortPlayerControllerAthena* Player) = decltype(AddToAlivePlayersOriginal)(Addresses::AddToAlivePlayers);
if (AddToAlivePlayersOriginal)
@@ -129,9 +130,6 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
AddToAlivePlayersOriginal(GameMode, PlayerController);
}
auto OnPlayerPawnResurrectedFn = SpawnMachine->FindFunction("OnPlayerPawnResurrected");
SpawnMachine->ProcessEvent(OnPlayerPawnResurrectedFn, &NewPawn);
bool IsFinalPlayerToBeRebooted = true;
if (IsFinalPlayerToBeRebooted)