fixed destroy all player builds

This commit is contained in:
Gray
2024-01-14 14:26:44 -05:00
parent e3a5b6bec0
commit 89231ccf42
2 changed files with 20 additions and 13 deletions

View File

@@ -31,6 +31,24 @@ void UNetDriver::RemoveNetworkActor(AActor* Actor)
void UNetDriver::TickFlushHook(UNetDriver* NetDriver)
{
if (bShouldDestroyAllPlayerBuilds) // i hate this
{
auto AllBuildingSMActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingSMActor::StaticClass());
for (int i = 0; i < AllBuildingSMActors.Num(); i++)
{
auto CurrentBuildingSMActor = (ABuildingSMActor*)AllBuildingSMActors.at(i);
if (CurrentBuildingSMActor->IsDestroyed() || CurrentBuildingSMActor->IsActorBeingDestroyed() || !CurrentBuildingSMActor->IsPlayerPlaced()) continue;
CurrentBuildingSMActor->SilentDie();
// CurrentBuildingSMActor->K2_DestroyActor();
}
AllBuildingSMActors.Free();
bShouldDestroyAllPlayerBuilds = false;
}
/* if (bEnableBotTick)
{
Bots::Tick();

View File

@@ -87,6 +87,7 @@ extern inline int AmountOfBotsToSpawn = 0;
extern inline bool bEnableRebooting = false;
extern inline bool bEngineDebugLogs = false;
extern inline bool bStartedBus = false;
extern inline bool bShouldDestroyAllPlayerBuilds = false;
extern inline int AmountOfHealthSiphon = 0;
// THE BASE CODE IS FROM IMGUI GITHUB
@@ -1080,19 +1081,7 @@ static inline void MainUI()
if (ImGui::Button("Destroy all player builds"))
{
auto AllBuildingSMActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingSMActor::StaticClass());
for (int i = 0; i < AllBuildingSMActors.Num(); i++)
{
auto CurrentBuildingSMActor = (ABuildingSMActor*)AllBuildingSMActors.at(i);
if (CurrentBuildingSMActor->IsDestroyed() || CurrentBuildingSMActor->IsActorBeingDestroyed() || !CurrentBuildingSMActor->IsPlayerPlaced()) continue;
CurrentBuildingSMActor->SilentDie();
// CurrentBuildingSMActor->K2_DestroyActor();
}
AllBuildingSMActors.Free();
bShouldDestroyAllPlayerBuilds = true;
}
if (ImGui::Button("Give Item to Everyone"))