1
0
KF2-Dev-Scripts/WebAdmin/Classes/PCCleanUp.uc

44 lines
1001 B
Ucode
Raw Normal View History

2020-12-13 15:01:13 +00:00
/**
* Provides a mechanism to clean up the messaging spectators. These are kept
* in memory because they are a PlayerController subclass, and not cleaned up
* because they are not associated with players.
*
* Copyright 2008 Epic Games, Inc. All Rights Reserved
*
* @author Michiel 'elmuerte' Hendriks
*/
class PCCleanUp extends Info;
var array<MessagingSpectator> cleanupControllers;
event PreBeginPlay()
{
local MessagingSpectator specs;
super.PreBeginPlay();
foreach WorldInfo.AllControllers(class'MessagingSpectator', specs)
{
if (specs.isSeamlessDelete())
{
cleanupControllers[cleanupControllers.length] = specs;
}
}
if (cleanupControllers.length > 0)
{
`Log("Cleaning up "$cleanupControllers.length$" MessagingSpectator instances");
SetTimer(1, false, 'cleanup');
}
else {
Destroy();
}
}
function cleanup()
{
local MessagingSpectator specs;
foreach cleanupControllers(specs)
{
specs.Destroy();
}
Destroy();
}