Botpack
Class TranslocDest

source: e:\games\UnrealTournament\Botpack\Classes\TranslocDest.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.NavigationPoint
         |
         +--Engine.LiftCenter
            |
            +--Botpack.TranslocDest
Direct Known Subclasses:None

class TranslocDest
extends Engine.LiftCenter

//============================================================================= // TranslocDest. //=============================================================================

Function Summary
 void PostBeginPlay()
 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
*/



Source Code


00001	//=============================================================================
00002	// TranslocDest.
00003	//=============================================================================
00004	class TranslocDest extends LiftCenter;
00005	
00006	function PostBeginPlay()
00007	{
00008		local Actor Start, End;
00009		local NavigationPoint N;
00010		local int distance, reachFlags, i, j;
00011		local bool bFound;
00012	
00013		Super.PostBeginPlay();
00014	
00015		if ( Level.Game.IsA('DeathMatchPlus') && DeathMatchPlus(Level.Game).bUseTranslocator && (Region.Zone.ZoneGravity.Z < 0.9 * Region.Zone.Default.ZoneGravity.Z) )
00016			return;
00017	
00018		// if this game type doesn't include translocator, then get rid of paths through this node
00019		bSpecialCost = false;
00020		for ( i=0; i<16; i++ )
00021		{
00022			Paths[i] = -1;
00023			if ( UpstreamPaths[i] != -1 )
00024			{
00025				DescribeSpec(UpstreamPaths[i], Start, End, reachFlags, distance);
00026				bFound = false;
00027				N = NavigationPoint(Start);
00028				if ( N != None )
00029				{
00030					for ( j=0; j<15; j++ )
00031					{
00032						if ( !bFound )
00033						{
00034							DescribeSpec(N.Paths[j], Start, End, reachFlags, distance);
00035							bFound = ( End == self );
00036						}
00037						if ( bFound )
00038							N.Paths[j] = N.Paths[j+1];
00039					}
00040					N.Paths[15] = -1;
00041				}
00042				UpstreamPaths[i] = -1;
00043			}
00044		}
00045	}
00046	
00047	event int SpecialCost(Pawn Seeker)
00048	{
00049		if ( !Seeker.IsA('Bot') || !Bot(Seeker).bCanTranslocate )
00050			return 10000000;
00051		return 300;
00052	}
00053	
00054	/* SpecialHandling is called by the navigation code when the next path has been found.  
00055	It gives that path an opportunity to modify the result based on any special considerations
00056	*/
00057	function Actor SpecialHandling(Pawn Other)
00058	{
00059		local Bot B;
00060	
00061		if ( !Other.IsA('Bot') )
00062			return None;
00063	
00064		if ( (VSize(Location - Other.Location) < 200) 
00065			 && (Abs(Location.Z - Other.Location.Z) < Other.CollisionHeight) )
00066			return self;
00067		B = Bot(Other);
00068	
00069		if ( (B.MyTranslocator == None) || (B.MyTranslocator.TTarget != None) )
00070			return None;
00071	
00072		B.TranslocateToTarget(self);	
00073		return self;
00074	}
00075	
00076	defaultproperties
00077	{
00078	     bSpecialCost=True
00079	}

End Source Code