Botpack
Class TMaleBody

source: e:\games\UnrealTournament\Botpack\Classes\TMaleBody.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--Engine.Carcass
            |
            +--Botpack.UTHumanCarcass
               |
               +--Botpack.TMaleBody
Direct Known Subclasses:TBossCarcass, TMale1Carcass, TMale2Carcass

class TMaleBody
extends Botpack.UTHumanCarcass

//============================================================================= // TMaleBody. //=============================================================================
Variables
 name Jerks[4]
 float LastHit
 bool bJerking


Function Summary
 void AnimEnd()
 void SpawnHead()
 void TakeDamage(int Damage, Pawn InstigatedBy, Vector Hitlocation, Vector Momentum, name DamageType)



Source Code


00001	//=============================================================================
00002	// TMaleBody.
00003	//=============================================================================
00004	class TMaleBody extends UTHumanCarcass
00005		abstract;
00006	
00007	var float LastHit;
00008	var bool bJerking;
00009	var name Jerks[4];
00010	
00011	replication
00012	{
00013		// Things the server should send to the client.
00014		unreliable if( Role==ROLE_Authority )
00015			LastHit, bJerking;
00016	}
00017	
00018	function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation, 
00019							Vector Momentum, name DamageType)
00020	{	
00021		local bool bRiddled;
00022		
00023		if ( bJerking || (AnimSequence == 'Dead9') )
00024		{
00025			bJerking = true;
00026			if ( Damage < 23 )
00027				LastHit = Level.TimeSeconds;
00028			else 
00029				bJerking = false;
00030		}
00031		Super.TakeDamage(Damage, InstigatedBy, HitLocation, Momentum, DamageType);
00032	
00033		if ( bJerking )
00034		{
00035			CumulativeDamage = 50;
00036			Velocity.Z = FMax(Velocity.Z, 40);
00037			if ( InstigatedBy == None )
00038			{
00039				bJerking = false;
00040				PlayAnim('Dead9B', 1.1, 0.1);
00041			}
00042		}
00043		if ( bJerking && (VSize(InstigatedBy.Location - Location) < 150)
00044			&& (InstigatedBy.Acceleration != vect(0,0,0))
00045			&& ((Normal(InstigatedBy.Velocity) Dot Normal(Location - InstigatedBy.Location)) > 0.7) )
00046		{
00047			bJerking = false;
00048			PlayAnim('Dead9B', 1.1, 0.1);
00049		}
00050	}
00051	
00052	function AnimEnd()
00053	{
00054		local name NewAnim;
00055	
00056		if ( AnimSequence == 'Dead9' )
00057			bJerking = true;
00058	
00059		if ( !bJerking )
00060			Super.AnimEnd();
00061		else if ( (Level.TimeSeconds - LastHit < 0.2) && (FRand() > 0.02) )
00062		{
00063			NewAnim = Jerks[Rand(4)];
00064			if ( NewAnim == AnimSequence )
00065			{
00066				if ( NewAnim == Jerks[0] )
00067					NewAnim = Jerks[1];
00068				else
00069					NewAnim = Jerks[0];
00070			}
00071			TweenAnim(NewAnim, 0.15);
00072		}
00073		else
00074		{
00075			bJerking = false;
00076			PlayAnim('Dead9B', 1.1, 0.1);
00077		}
00078	}
00079	
00080	function SpawnHead()
00081	{
00082		local carcass carc;
00083	
00084		carc = Spawn(class'UT_HeadMale');
00085		if ( carc != None )
00086		{
00087			carc.RemoteRole = ROLE_SimulatedProxy;
00088			carc.Initfor(self);
00089		}
00090	}
00091	
00092	defaultproperties
00093	{
00094	     Jerks(0)=GutHit
00095	     Jerks(1)=HeadHit
00096	     Jerks(2)=LeftHit
00097	     Jerks(3)=RightHit
00098	     MasterReplacement=Class'Botpack.TMaleMasterChunk'
00099	     AnimSequence=Dead1
00100	     bBlockActors=True
00101	     bBlockPlayers=True
00102	     Mass=100.000000
00103	}

End Source Code