Skip to content

Commit

Permalink
feat: Restart All Computers CMD
Browse files Browse the repository at this point in the history
  • Loading branch information
Panakotta00 committed Nov 29, 2024
1 parent 19201a6 commit dd4fd1f
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "CoreMinimal.h"
#include "AkGameplayStatics.h"
#include "FicsItNetworksComputer.h"
#include "FINComputerCase.h"
#include "Kismet/GameplayStatics.h"

bool ExecCMDRestartAllComputers(UWorld* World, const TCHAR* Command, FOutputDevice& Ar) {
if (FParse::Command(&Command, TEXT("FINRestartAllComputers"))) {
UE_LOG(LogFicsItNetworksComputer, Display, TEXT("Restarting all FicsIt-Networks Computers..."));

TArray<AActor*> actors;
UGameplayStatics::GetAllActorsOfClass(World, AFINComputerCase::StaticClass(), actors);
for (AActor* actor : actors) {
AFINComputerCase* computer = Cast<AFINComputerCase>(actor);
if (!computer || !computer->Kernel) continue;
computer->Kernel->Reset();
}

return true;
}
return false;
}

[[maybe_unused]] static FStaticSelfRegisteringExec SelfRegisterCMDRestartAllComputers(&ExecCMDRestartAllComputers);

0 comments on commit dd4fd1f

Please sign in to comment.