XIII
Class XIIICorpse

source: C:\XIII\XIII\Classes\XIIICorpse.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--XIII.XIIIPawn
            |
            +--XIII.XIIICorpse
Direct Known Subclasses:None

class XIIICorpse
extends XIII.XIIIPawn

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 CorpseBlood CB
           Inventory to give the corpse
 > InitialInv
           Inventory to give the corpse
 int iPreDefinedDeath
           Inventory to give the corpse

States
Dead

Function Summary
 void PostBeginPlay()
     
//_____________________________________________________________________________
 void SetUpInitialInventory(XIIIPawn P)
     
//_____________________________________________________________________________


State Dead Function Summary
 bool IsDead()
 void BeginState()
 void ReduceCylinder()
     
// prone body should have low height, wider radius



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIICorpse extends XIIIPawn;
00005	
00006	var() array< class<Inventory> > InitialInv;   // Inventory to give the corpse
00007	var() int iPreDefinedDeath;
00008	var CorpseBlood CB;
00009	
00010	//_____________________________________________________________________________
00011	event ParseDynamicLoading(LevelInfo MyLI)
00012	{
00013	    local int i;
00014	
00015	    Log("ParseDynamicLoading Actor="$self);
00016	    for (i=0; i<InitialInv.Length; i++)
00017	    {
00018	      MyLI.ForcedClasses[MyLI.ForcedClasses.Length] = InitialInv[i];
00019	      (InitialInv[i]).Static.StaticParseDynamicLoading(MyLI);
00020	    }
00021	}
00022	
00023	//_____________________________________________________________________________
00024	function PostBeginPlay()
00025	{
00026	//  Super.PostBeginPlay();
00027	  SetupInitialInventory(self);
00028	}
00029	
00030	//_____________________________________________________________________________
00031	function GiveSomething(class<Inventory> ItemClass, XIIIPawn P)
00032	{
00033	  local Inventory NewItem;
00034	
00035	  if( P.FindInventoryType(ItemClass)==None )
00036	  {
00037	    NewItem = Spawn(ItemClass,,,P.Location);
00038	    if( NewItem != None )
00039	      NewItem.GiveTo(P);
00040	  }
00041	  else if ( Class<Ammunition>(ItemClass) != none )
00042	  {
00043	    NewItem = P.FindInventoryType(ItemClass);
00044	    if (NewItem != None)
00045	      Ammunition(NewItem).AmmoAmount += Class<Ammunition>(ItemClass).default.AmmoAmount;
00046	  }
00047	}
00048	
00049	//_____________________________________________________________________________
00050	function SetUpInitialInventory(XIIIPawn P)
00051	{
00052	    local int i;
00053	
00054	    for (i=0; i<InitialInv.Length; i++)
00055	    {
00056	      GiveSomething(InitialInv[i], P);
00057	    }
00058	
00059	}
00060	
00061	//_____________________________________________________________________________
00062	auto state Dead
00063	{
00064	    ignores Trigger, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange,
00065	        Falling, BreathTimer, Tick, AnimEnd, TakeDamage;
00066	
00067	    // prone body should have low height, wider radius
00068	    function ReduceCylinder()
00069	    {
00070	      local float OldHeight, OldRadius;
00071	      local vector OldLocation;
00072	
00073	      SetCollision(True,False,False);
00074	      OldHeight = CollisionHeight;
00075	      OldRadius = CollisionRadius;
00076	      SetCollisionSize(1.7 * Default.CollisionRadius, CarcassCollisionHeight);
00077	      PrePivot = vect(0,0,1) * (OldHeight - CollisionHeight); // FIXME - changing prepivot isn't safe w/ static meshes
00078	      OldLocation = Location;
00079	      if ( !SetLocation(OldLocation - PrePivot) )
00080	      {
00081	        SetCollisionSize(OldRadius, CollisionHeight);
00082	        if ( !SetLocation(OldLocation - PrePivot) )
00083	        {
00084	          SetCollisionSize(CollisionRadius, OldHeight);
00085	          SetCollision(false, false, false);
00086	          PrePivot = vect(0,0,0);
00087	          if ( !SetLocation(OldLocation) )
00088	               ChunkUp(200);
00089	        }
00090	      }
00091	      PrePivot = PrePivot + vect(0,0,3);
00092	    }
00093	    function BeginState()
00094	    {
00095	      PlayDyingAnim(class'DTSuicided', vect(5,0,0));
00096	      ReduceCylinder(); // Kept this to avoid visual pbs
00097	      if ( CB == none )
00098	      {
00099	        if ( (Level.Game != none) && (Level.Game.GoreLevel == 0) )
00100	          CB = spawn(class'CorpseBlood', self,, Location - (CollisionHeight-8) * vect(0,0,1), rotator(vect(0,0,-1)));
00101	//        CB.DetachProjector(true);
00102	//        CB.SetDrawScale(fRand()*0.35 + 0.1);
00103	//        CB.AttachProjector();
00104	      }
00105	
00106	    }
00107	    function bool IsDead()
00108	    {
00109	      return true;
00110	    }
00111	}
00112	
00113	//_____________________________________________________________________________
00114	simulated function PlayDyingAnim(class<DamageType> DamageType, vector HitLoc)
00115	{
00116	    local int i;
00117	
00118	    if ( (iPreDefinedDeath >= 0) && (iPreDefinedDeath <= 7) )
00119	      I = iPreDefinedDeath;
00120	    else
00121	      I = rand(10);
00122	    switch(I)
00123	    {
00124	      case 0: PlayAnim('DeathEpauleGauche',120.0); break;
00125	      case 1: PlayAnim('DeathChevilleGauche',120.0); break;
00126	      case 2: PlayAnim('DeathChevilleDroite',120.0); break;
00127	      case 3: PlayAnim('DeathBuste3',120.0); break;
00128	      case 4: PlayAnim('DeathDos',120.0); break;
00129	      case 5: PlayAnim('DeathVentre',120.0); break;
00130	      case 6: PlayAnim('DeathBuste0',120.0); break;
00131	      case 7: PlayAnim('DeathBuste2',120.0); break;
00132	      case 8: PlayAnim('DeathTete2',120.0); break;
00133	      case 9: PlayAnim('DeathTete',120.0); break;
00134	      case 10: PlayAnim('DeathEpauleGauche',120.0); break;
00135	    }
00136	}
00137	
00138	//    ControllerClass=class'XIII.Cadavre'
00139	
00140	
00141	defaultproperties
00142	{
00143	     iPreDefinedDeath=-1
00144	     bSearchable=True
00145	     bIsDead=True
00146	     Health=0
00147	     ControllerClass=None
00148	     CarcassCollisionHeight=23.000000
00149	     bPhysicsAnimUpdate=False
00150	     bStasis=True
00151	     bBlockActors=False
00152	     bBlockPlayers=False
00153	     bProjTarget=False
00154	     Mesh=SkeletalMesh'XIIIPersos.XIIIM'
00155	     CollisionHeight=78.000000
00156	}

End Source Code