//=============================================================================
// Lift exit type
// Targeted pathing to the lift center i'm aiming at
//
// For testing purposes, do not modify or redistribute
// Have suggestions? Contact me.
// caco_fff@hotmail.com - Higor at UT99.org
//=============================================================================
class Botz_LiftExit expands Botz_NavigBase;

var Mover MyMover;

//Called after botZ decides this is the path to take
//Do some lift handling here?
function bool PostPathEvaluate( botz other)
{
	if ( MyMover == none )
		return false;
	if ( !other.PointReachable(location) )
	{
		//Temporary solution
		if ( (other.Base == MyMover) && !MyMover.bInterpolating  && !MyMover.bDelaying )
		{
			other.MoveTarget = other;
			other.SpecialPause = 0.5;
			other.bTickedJump = true;
		}
		else if ( other.Base == MyMover )
		{
			other.SpecialPause = 0.2;
			other.GotoState( other.GetStateName(), 'SpecialWait');
		}
		return true;
	}
	return false;
}


event FinishedPathing()
{
	local Botz_LiftCenter LC, best;
	local vector CmpPoint;

	ForEach AllActors (class'Botz_LiftCenter', LC)
	{
		CmpPoint = Location + vector(Rotation) * VSize(LC.Location - Location);
		if ( VSize(LC.Location - CmpPoint) < 180 )
		{
			if ( (best == none) || (VSize(Location - LC.Location) < VSize(Location - best.Location) ) )
				best = LC;
		}
	}

	if ( best != none )
	{
		if ( !bOneWayOut )
			AddPathHere( self, best, true);
		if ( !bOneWayInc )
			AddPathHere( best, self, true);
		MyMover = best.MyMover;
	}

}

defaultproperties
{
	FriendlyName="Lift Exit"
	MaxDistance=550
	Texture=Texture'BWP_Junction'
	bPushSave=True
	ReservePaths=1
	ReserveUpstreamPaths=1
}