Engine
Class Carcass

source: e:\games\UnrealTournament\Engine\Classes\Carcass.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--Engine.Carcass
Direct Known Subclasses:UTCreatureChunks, UTHumanCarcass, CreatureCarcass, CreatureChunks

class Carcass
extends Engine.Decoration

//============================================================================= // Carcass. //=============================================================================
Variables
 Pawn Bugs
 int CumulativeDamage
 PlayerReplicationInfo PlayerOwner
 bool bDecorative
 bool bPlayerCarcass
 bool bReducedHeight
 bool bSlidingCarcass
 byte flies
 byte rats

States
Dead, Dying

Function Summary
 bool AllowChunk(int N, name A)
 void ChunkUp(int Damage)
 void CreateReplacement()
 void Destroyed()
 void Initfor(Actor Other)
 void TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)


State Dead Function Summary
 void BeginState()
 void CheckZoneCarcasses()
 void AddFliesAndRats()
 void Timer()


State Dying Function Summary



Source Code


00001	//=============================================================================
00002	// Carcass.
00003	//=============================================================================
00004	class Carcass extends Decoration
00005		native;
00006	
00007	// Sprite.
00008	#exec Texture Import File=Textures\Corpse.pcx Name=S_Corpse Mips=Off Flags=2
00009	
00010	// Variables.
00011	var bool bPlayerCarcass;
00012	var() byte flies;
00013	var() byte rats;
00014	var() bool bReducedHeight;
00015	var bool bDecorative;
00016	var bool bSlidingCarcass;
00017	var int CumulativeDamage;
00018	var PlayerReplicationInfo PlayerOwner;
00019	
00020	var Pawn Bugs;
00021	
00022		function CreateReplacement()
00023		{
00024			if (Bugs != None)
00025				Bugs.Destroy();
00026		}
00027	
00028		function Destroyed()
00029		{
00030			local Actor A;
00031	
00032			if (Bugs != None)
00033				Bugs.Destroy();
00034					
00035			Super.Destroyed();
00036		}
00037	
00038		function Initfor(actor Other)
00039		{
00040			//implemented in subclasses
00041		}
00042				
00043		function ChunkUp(int Damage)
00044		{
00045			destroy();
00046		}
00047		
00048		static simulated function bool AllowChunk(int N, name A)
00049		{
00050			return true;
00051		}
00052	
00053		function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
00054								Vector momentum, name damageType)
00055		{
00056			if ( !bDecorative )
00057			{
00058				bBobbing = false;
00059				SetPhysics(PHYS_Falling);
00060			}
00061			if ( (Physics == PHYS_None) && (Momentum.Z < 0) )
00062				Momentum.Z *= -1;
00063			Velocity += 3 * momentum/(Mass + 200);
00064			if ( DamageType == 'shot' )
00065				Damage *= 0.4;
00066			CumulativeDamage += Damage;
00067			if ( (((Damage > 30) || !IsAnimating()) && (CumulativeDamage > 0.8 * Mass)) || (Damage > 0.4 * Mass) 
00068				|| ((Velocity.Z > 150) && !IsAnimating()) )
00069				ChunkUp(Damage);
00070			if ( bDecorative )
00071				Velocity = vect(0,0,0);
00072		}
00073	
00074	auto state Dying
00075	{
00076		ignores TakeDamage;
00077	
00078	Begin:
00079		Sleep(0.2);
00080		GotoState('Dead');
00081	}
00082		
00083	state Dead 
00084	{
00085		function Timer()
00086		{
00087			local bool bSeen;
00088			local Pawn aPawn;
00089			local float dist;
00090	
00091			if ( Region.Zone.NumCarcasses <= Region.Zone.MaxCarcasses )
00092			{
00093				if ( !PlayerCanSeeMe() )
00094					Destroy();
00095				else
00096					SetTimer(2.0, false);	
00097			}
00098			else
00099				Destroy();
00100		}
00101		
00102		function AddFliesAndRats()
00103		{
00104		}
00105	
00106		function CheckZoneCarcasses()
00107		{
00108		}
00109		
00110		function BeginState()
00111		{
00112			if ( bDecorative )
00113				lifespan = 0.0;
00114			else
00115				SetTimer(18.0, false);
00116		}
00117				
00118	Begin:
00119		FinishAnim();
00120		Sleep(5.0);
00121		CheckZoneCarcasses();
00122		Sleep(7.0);
00123		if ( !bDecorative && !bHidden && !Region.Zone.bWaterZone && !Region.Zone.bPainZone )
00124			AddFliesAndRats();	
00125	}
00126	
00127	defaultproperties
00128	{
00129	     bDecorative=True
00130	     bStatic=False
00131	     bStasis=False
00132	     Physics=PHYS_Falling
00133	     LifeSpan=180.000000
00134	     AnimSequence=Dead
00135	     AnimFrame=0.900000
00136	     DrawType=DT_Mesh
00137	     Texture=Texture'Engine.S_Corpse'
00138	     CollisionRadius=18.000000
00139	     CollisionHeight=4.000000
00140	     bCollideActors=True
00141	     bCollideWorld=True
00142	     bProjTarget=True
00143	     Mass=180.000000
00144	     Buoyancy=105.000000
00145	}

End Source Code