Botpack
Class JumpSpot

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

class JumpSpot
extends Engine.LiftCenter

//============================================================================= // JumpSpot. // specifies positions that can be reached in jumpmatch or with jumpboots or translocator //=============================================================================
Variables
 Bot PendingBot
 bImpactJump, bAlwaysAccel

States
PendingImpact, PendingJump

Function Summary
 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
*/


State PendingImpact Function Summary
 void Tick(float DeltaTime)
 Actor SpecialHandling(Pawn Other)


State PendingJump Function Summary
 void Tick(float DeltaTime)
 Actor SpecialHandling(Pawn Other)



Source Code


00001	//=============================================================================
00002	// JumpSpot.
00003	// specifies positions that can be reached in jumpmatch or with jumpboots or translocator
00004	//=============================================================================
00005	class JumpSpot extends LiftCenter;
00006	
00007	var() bool bImpactJump, bAlwaysAccel;
00008	var Bot PendingBot;
00009	
00010	event int SpecialCost(Pawn Seeker)
00011	{
00012		local Bot B;
00013	
00014		B = Bot(Seeker);
00015		if ( B == None )
00016			return 100000000;
00017			
00018		if ( B.bCanTranslocate || (B.JumpZ > 1.5 * B.Default.JumpZ) 
00019			|| (B.Region.Zone.ZoneGravity.Z >= 0.8 * B.Region.Zone.Default.ZoneGravity.Z) )
00020			return 300;
00021	
00022		if ( bImpactJump && B.bHasImpactHammer && (B.Health > 85) && (!B.bNovice || (B.Skill > 2.5)) 
00023			&& (B.DamageScaling < 1.4) )
00024			return 1100;
00025	
00026		return 100000000;
00027	}
00028	
00029	/* SpecialHandling is called by the navigation code when the next path has been found.  
00030	It gives that path an opportunity to modify the result based on any special considerations
00031	*/
00032	function Actor SpecialHandling(Pawn Other)
00033	{
00034		local Bot B;
00035	
00036		if ( !Other.IsA('Bot') )
00037			return None;
00038	
00039		if ( (VSize(Location - Other.Location) < 200) 
00040			 && (Abs(Location.Z - Other.Location.Z) < Other.CollisionHeight) )
00041			return self;
00042	
00043		B = Bot(Other);
00044		if ( (Other.JumpZ <= 1.5 * Other.Default.JumpZ) && (B.Region.Zone.ZoneGravity.Z < 0.8 * B.Region.Zone.Default.ZoneGravity.Z) )
00045		{
00046			if ( (B.MyTranslocator == None) || (B.MyTranslocator.TTarget != None) 
00047				|| (Level.Game.IsA('DeathMatchPlus') && !DeathMatchPlus(Level.Game).CanTranslocate(B)) )
00048			{
00049				if ( bImpactJump && B.CanImpactJump() )
00050				{
00051					PendingBot = B;
00052					GotoState('PendingImpact');
00053					Return self;
00054				}
00055				return None;
00056			}
00057			B.TranslocateToTarget(self);
00058			return self;	
00059		}
00060	
00061		PendingBot = B;
00062		GotoState('PendingJump');
00063	
00064		return self;
00065	}
00066	
00067	
00068	// don't do jumps right away because a state change here could be dangerous during navigation
00069	State PendingJump
00070	{
00071		function Actor SpecialHandling(Pawn Other)
00072		{
00073			if ( PendingBot != None )
00074			{
00075				PendingBot.BigJump(self);
00076				PendingBot = None;
00077			}
00078			return Super.SpecialHandling(Other);
00079		}
00080	
00081		function Tick(float DeltaTime)
00082		{
00083			if ( PendingBot != None )
00084			{
00085				PendingBot.BigJump(self);
00086				PendingBot = None;
00087			}
00088			GotoState('');
00089		}
00090	}
00091	
00092	State PendingImpact
00093	{
00094		function Actor SpecialHandling(Pawn Other)
00095		{
00096			if ( PendingBot != None )
00097			{
00098				PendingBot.ImpactJump(self);
00099				PendingBot = None;
00100			}
00101			return Super.SpecialHandling(Other);
00102		}
00103	
00104		function Tick(float DeltaTime)
00105		{
00106			if ( PendingBot != None )
00107			{
00108				PendingBot.ImpactJump(self);
00109				PendingBot = None;
00110			}
00111			GotoState('');
00112		}
00113	}
00114	
00115	defaultproperties
00116	{
00117	     bSpecialCost=True
00118	}

End Source Code