Engine
Class LiftCenter

source: C:\XIII\Engine\Classes\LiftCenter.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.NavigationPoint
         |
         +--Engine.LiftCenter
Direct Known Subclasses:None

class LiftCenter
extends Engine.NavigationPoint

//============================================================================= // LiftCenter. //=============================================================================
Variables
 vector LiftOffset
           starting vector between MyLift location and LiftCenter location
 name LiftTag
 name LiftTrigger
 float MaxDist2D
 Trigger RecommendedTrigger


Function Summary
 void PostBeginPlay()
 bool ProceedWithMove(Pawn Other)
 Actor SpecialHandling(Pawn Other)
     
/* SpecialHandling is called by the navigation code when the next path has been found.  
It gives that path an opportunity to modify the result based on any special considerations

Here, we check if the mover needs to be triggered
*/
 bool SuggestMovePreparation(Pawn Other)
     
/* 
Check if mover is positioned to allow Pawn to get on
*/



Source Code


00001	//=============================================================================
00002	// LiftCenter.
00003	//=============================================================================
00004	class LiftCenter extends NavigationPoint
00005		placeable
00006		native;
00007	
00008	#exec Texture Import File=Textures\Lift_center.pcx Name=S_LiftCenter Mips=Off MASKED=1 COMPRESS=DXT1
00009	
00010	var() name LiftTag;
00011	var	 mover MyLift;
00012	var() name LiftTrigger;
00013	var trigger RecommendedTrigger;
00014	var float MaxDist2D;
00015	var vector LiftOffset;	// starting vector between MyLift location and LiftCenter location
00016	
00017	function PostBeginPlay()
00018	{
00019		// log(self$" attached to "$MyLift);
00020		if ( LiftTrigger != '' )
00021			ForEach DynamicActors(class'Trigger', RecommendedTrigger, LiftTrigger )
00022				break;
00023		Super.PostBeginPlay();
00024	}
00025	
00026	/* SpecialHandling is called by the navigation code when the next path has been found.  
00027	It gives that path an opportunity to modify the result based on any special considerations
00028	
00029	Here, we check if the mover needs to be triggered
00030	*/
00031	
00032	function Actor SpecialHandling(Pawn Other)
00033	{
00034		// if no lift, no special handling
00035		if ( MyLift == None )
00036			return self;
00037	
00038		// check whether or not need to trigger the lift
00039		if ( !MyLift.IsInState('StandOpenTimed') )
00040		{
00041			if ( MyLift.bClosed 
00042				&& (RecommendedTrigger != None) )
00043				return RecommendedTrigger;
00044		}	
00045		else if ( MyLift.BumpType == BT_PlayerBump && !Other.IsPlayerPawn() )
00046			return None;
00047	
00048		return self;
00049	}
00050	
00051	/* 
00052	Check if mover is positioned to allow Pawn to get on
00053	*/
00054	function bool SuggestMovePreparation(Pawn Other)
00055	{
00056		// if already on lift, no problem 
00057		if ( Other.base == MyLift )
00058			return false;
00059	
00060		// make sure LiftCenter is correctly positioned on the lift
00061		SetLocation(MyLift.Location + LiftOffset);
00062		SetBase(MyLift);
00063	
00064		// if mover is moving, wait
00065		if ( MyLift.bInterpolating || !ProceedWithMove(Other) )
00066		{
00067			Other.Controller.WaitForMover(MyLift);
00068			return true;
00069		}
00070	
00071		return false;
00072	}
00073	
00074	function bool ProceedWithMove(Pawn Other)
00075	{
00076		local LiftExit Start;
00077		local float dist2D;
00078		local vector dir;
00079	
00080		// see if mover is at appropriate location/keyframe
00081		Start = LiftExit(Other.Anchor);
00082	
00083		if ( (Start != None) && (Start.KeyFrame != 255) )
00084		{
00085			if ( MyLift.KeyNum == Start.KeyFrame )
00086				return true;
00087		}
00088		else
00089		{
00090			//check distance directly - make sure close
00091			dir = Location - Other.Location;
00092			dir.Z = 0;
00093			dist2d = vsize(dir);
00094			if ( (Location.Z - CollisionHeight < Other.Location.Z - Other.CollisionHeight + MAXSTEPHEIGHT)
00095				&& (Location.Z - CollisionHeight > Other.Location.Z - Other.CollisionHeight - 1200)
00096				&& ( dist2D < MaxDist2D) )
00097			{
00098				return true;
00099			}
00100		}
00101	
00102		// if mover not operating, need to start it
00103		if ( MyLift.bClosed )
00104		{
00105			Other.SetMoveTarget(SpecialHandling(Other));
00106			return true;
00107		}
00108	
00109		return false;
00110	}
00111	
00112	defaultproperties
00113	{
00114	     MaxDist2D=400.000000
00115	     ExtraCost=400
00116	     bSpecialMove=True
00117	     bNoAutoConnect=True
00118	     bStatic=False
00119	     bNoDelete=True
00120	     RemoteRole=ROLE_None
00121	     Texture=Texture'Engine.S_LiftCenter'
00122	}

End Source Code