//=============================================================================
// Lift center type
// Does automatic pathing at short distance for points near the mover's base
// position, requires special pathing for the other positions
//
// For testing purposes, do not modify or redistribute
// Have suggestions? Contact me.
// caco_fff@hotmail.com - Higor at UT99.org
//=============================================================================
class Botz_LiftCenter expands Botz_NavigBase;

#exec TEXTURE IMPORT NAME=BWP_Junction FILE=..\CompileData\BWP_Junction.bmp FLAGS=2

var vector PosOffset;
var rotator RotBase;
var Mover MyMover;

event PostBeginPlay()
{
	local vector HitLocation, HitNormal;
	local Actor A;

	ForEach TraceActors (class'Actor', A, HitLocation, HitNormal, Location - vect(0,0,100) )
	{
		if ( A.IsA('Mover') )
		{
			MyMover = Mover(A);
			break;
		}
	}

	if ( MyMover  != none )
	{
		PosOffset = Location - MyMover.Location;
		RotBase = MyMover.Rotation;
		SetBase( MyMover);
	}
	
}


//Called after botZ decides this is the path to take
//Do some lift handling here?
function bool PostPathEvaluate( botz other)
{
	SetLocation( MyMover.Location + PosOffset);
	if ( (Location.Z < other.Location.Z + 60) || other.PointReachable(Location) ) 
		return false;

	if ( !MyMover.bOpening && !MyMover.bDelaying && (MyMover.SavedTrigger == none) && (MyMover.Instigator == none) )
//		other.SpecialGoal = FindTrigger
		MyMover.Trigger( other, other);
	other.SpecialPause = 0.5;
	other.GotoState( other.GetStateName(), 'SpecialWait');
	return true;
}


defaultproperties
{
	FriendlyName="Lift Center"
	MaxDistance=350
	Texture=Texture'BWP_Junction'
	ReservePaths=1
	ReserveUpstreamPaths=1
}