Botpack
Class Kicker

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

class Kicker
extends Engine.Triggers

//============================================================================= // Jumper. // Creatures will jump on hitting this trigger in direction specified //=============================================================================
Variables
 vector KickVelocity
 name KickedClasses
 bool bKillVelocity
 bool bRandomize


Function Summary
 
simulated
PostTouch(Actor Other)
 
simulated
Touch(Actor Other)



Source Code


00001	//=============================================================================
00002	// Jumper.
00003	// Creatures will jump on hitting this trigger in direction specified
00004	//=============================================================================
00005	class Kicker extends Triggers;
00006	
00007	var() vector KickVelocity;
00008	var() name KickedClasses;
00009	var() bool bKillVelocity;
00010	var() bool bRandomize;
00011	
00012	simulated function Touch( actor Other )
00013	{
00014		local Actor A;
00015	
00016		if ( !Other.IsA(KickedClasses) )
00017			return;
00018		PendingTouch = Other.PendingTouch;
00019		Other.PendingTouch = self;
00020		if( Event != '' )
00021			foreach AllActors( class 'Actor', A, Event )
00022				A.Trigger( Other, Other.Instigator );
00023	}
00024	
00025	simulated function PostTouch( actor Other )
00026	{
00027		local bool bWasFalling;
00028		local vector Push;
00029		local float PMag;
00030	
00031		bWasFalling = ( Other.Physics == PHYS_Falling );
00032		if ( bKillVelocity )
00033			Push = -1 * Other.Velocity;
00034		else
00035			Push.Z = -1 * Other.Velocity.Z;
00036		if ( bRandomize )
00037		{
00038			PMag = VSize(KickVelocity);
00039			Push += PMag * Normal(KickVelocity + 0.5 * PMag * VRand());
00040		}
00041		else
00042			Push += KickVelocity;
00043		if ( Other.IsA('Bot') )
00044		{
00045			if ( bWasFalling )
00046				Bot(Other).bJumpOffPawn = true;
00047			Bot(Other).SetFall();
00048		}
00049		Other.SetPhysics(PHYS_Falling);
00050		Other.Velocity += Push;
00051	}
00052	
00053	defaultproperties
00054	{
00055	     KickedClasses=Pawn
00056	     RemoteRole=ROLE_SimulatedProxy
00057	     bDirectional=True
00058	}

End Source Code