optimize KillZeds

This commit is contained in:
GenZmeY 2023-05-21 01:38:52 +03:00
parent 8e213d4f78
commit 23424ad094
2 changed files with 18 additions and 3 deletions

View File

@ -258,7 +258,7 @@ private function SetWave(int NewWaveNum, PlayerController PC, optional bool bSki
} }
//Kill all zeds currently alive. //Kill all zeds currently alive.
PC.ConsoleCommand("KillZeds"); KillZeds();
//Clear any current objectives. //Clear any current objectives.
KFGRI.DeactivateObjective(); KFGRI.DeactivateObjective();
@ -446,7 +446,7 @@ private function StartWaveTimer()
{ {
if (KFDemoRecSpectator(PC) == none) if (KFDemoRecSpectator(PC) == none)
{ {
PC.ConsoleCommand("KillZeds"); KillZeds();
break; break;
} }
} }
@ -508,6 +508,21 @@ private function UpdateTraderDurationTimer()
} }
} }
private function KillZeds()
{
local KFPawn_Monster KFPM;
foreach WorldInfo.AllPawns(class'KFPawn_Monster', KFPM)
{
if (!KFPM.IsAliveAndWell()) continue;
if (KFPM.Health > 0 && PlayerController(KFPM.Controller) == None)
{
KFPM.Died(None, None, KFPM.Location);
}
}
}
defaultproperties defaultproperties
{ {

View File

@ -32,7 +32,7 @@ public event PreBeginPlay()
public function AddMutator(Mutator Mut) public function AddMutator(Mutator Mut)
{ {
if (Mut == Self || bPendingDelete || bDeleteMe) return; if (Mut == Self) return;
if (Mut.Class == Class) if (Mut.Class == Class)
StartWaveMut(Mut).SafeDestroy(); StartWaveMut(Mut).SafeDestroy();