function mcClear()
{
	if ( $MC::Clearing )
	{
		return;
	}

	if ( !isObject( %bg = BrickGroup_888888 ) )
	{
		return;
	}

	if ( !( %cnt = %bg.getCount() ) )
	{
		return;
	}

	$MC::Clearing = true;
	$MC::ClearTick = schedule( 24, 0, "mcClearTick", %cnt );
}

function mcClearTick( %initial )
{
	cancel( $MC::ClearTick );

	if ( !$MC::Clearing )
	{
		return;
	}

	if ( !isObject( %bg = BrickGroup_888888 ) )
	{
		mcClearDone();
		return;
	}

	if ( !%bg.getCount() )
	{
		mcClearDone();
		return;
	}

	for ( %i = 0 ; %i < 50 && %bg.getCount() ; %i++ )
	{
		%bg.getObject( 0 ).delete();
	}

	%pct = ( 1 - %bg.getCount() / %initial ) * 100;
	%pct = mFloatLength( %pct, 0 );

	%str = "<just:right><font:impact:30>\c3RESETTING MAP \n";
	%str = %str @ "\c6" @ %pct @ "% ";

	centerPrintAll( %str, 0 );
	$MC::ClearTick = schedule( 24, 0, "mcClearTick", %initial );
}

function mcClearDone()
{
	$MC::Clearing = false;
	$MC::CurrWorld = "";
	$MC::CurrSeed = "";

	mobGroup().delete();
	mcTickSO().delete();
	chunkGroup().delete();

	clearCenterPrintAll();
}
