RuneI
Class BabyCrab

source: c:\runehov\RuneI\Classes\BabyCrab.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--RuneI.ScriptPawn
            |
            +--RuneI.GiantCrab
               |
               +--RuneI.BabyCrab
Direct Known Subclasses:None

class BabyCrab
extends RuneI.GiantCrab

//============================================================================= // BabyCrab. //=============================================================================
Variables
 bool bLowDamageCrab


Function Summary
 void AfterSpawningInventory()
     
//================================================
//
// AfterSpawningInventory
//
// Sets the babycrab to low damage if necessary
// This is only used on the first level so that players aren't
// immediately destroyed by the crabs while they are getting their
// bearing and getting used to the game.
//================================================
 bool BodyPartSeverable(int BodyPart)
     
//============================================================
//
// BodyPartSeverable
//
//============================================================
 void CrabAttack()
 void CrabWalking(vector src, vector dst, rotator rot)
 bool DamageBodyPart(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType, int bodypart)
     
//============================================================
//
// DamageBodyPart
//
//============================================================
 int LimbPassThrough(int BodyPart, int Blunt, int Sever)
     
//============================================================
//
// LimbPassThrough
//
// Determines what damage is passed through to body
//============================================================
 EMatterType MatterForJoint(int joint)
     
//============================================================
//
// MatterForJoint
//
// Returns what kind of material joint is associated with
//============================================================
 void PlayMoving(optional float)



Source Code


00001	//=============================================================================
00002	// BabyCrab.
00003	//=============================================================================
00004	class BabyCrab expands GiantCrab;
00005	
00006	var() bool bLowDamageCrab;
00007	
00008	//================================================
00009	//
00010	// AfterSpawningInventory
00011	//
00012	// Sets the babycrab to low damage if necessary
00013	// This is only used on the first level so that players aren't
00014	// immediately destroyed by the crabs while they are getting their
00015	// bearing and getting used to the game.
00016	//================================================
00017	
00018	function AfterSpawningInventory()
00019	{
00020		local Inventory inv;
00021	
00022		Super.AfterSpawningInventory();
00023	
00024		if(bLowDamageCrab)
00025		{
00026			for(inv = Inventory; inv != None; inv = inv.Inventory)
00027			{
00028				if(inv.IsA('Weapon'))
00029					Weapon(inv).Damage /= 3;
00030			}
00031		}
00032	}
00033	
00034	//============================================================
00035	//
00036	// MatterForJoint
00037	//
00038	// Returns what kind of material joint is associated with
00039	//============================================================
00040	function EMatterType MatterForJoint(int joint)
00041	{
00042		return MATTER_FLESH;
00043	}
00044	
00045	
00046	//============================================================
00047	//
00048	// BodyPartSeverable
00049	//
00050	//============================================================
00051	function bool BodyPartSeverable(int BodyPart)
00052	{
00053		return false;
00054	}
00055	
00056	
00057	//============================================================
00058	//
00059	// LimbPassThrough
00060	//
00061	// Determines what damage is passed through to body
00062	//============================================================
00063	function int LimbPassThrough(int BodyPart, int Blunt, int Sever)
00064	{
00065		return Blunt+Sever;
00066	}
00067	
00068	
00069	//================================================
00070	//
00071	// SeveredLimbClass
00072	//
00073	//================================================
00074	function class<Actor> SeveredLimbClass(int BodyPart)
00075	{	// Just gibs
00076		return None;
00077	}
00078	
00079	//============================================================
00080	//
00081	// DamageBodyPart
00082	//
00083	//============================================================
00084	function bool DamageBodyPart(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType, int bodypart)
00085	{
00086		return Super.DamageBodyPart(Damage, EventInstigator, HitLocation, Momentum, DamageType, BodyPart);
00087	}
00088	
00089	
00090	function PlayMoving(optional float tween)
00091	{
00092		LoopAnim('moveforward', 4.0, 0.1);
00093	}
00094	
00095	function CrabAttack()
00096	{
00097		local float choice;
00098	
00099		choice = FRand();
00100		if (choice < 0.3 && !BodyPartMissing(BODYPART_LARM1))
00101			PlayAnim('attackl', 1.5, 0.1);
00102		else if (choice < 0.6 && !BodyPartMissing(BODYPART_RARM1))
00103			PlayAnim('attackr', 1.5, 0.1);
00104		else
00105			PlayAnim('attackb', 1.5, 0.1);
00106	}
00107	
00108	function CrabWalking(vector src, vector dst, rotator rot)
00109	{
00110		local vector X,Y,Z;
00111		local vector dir;
00112		local float XdotDir;
00113	
00114		dir = Normal(dst - src);
00115		GetAxes(Rotation, X,Y,Z);
00116		XdotDir = X dot dir;
00117	
00118		if (XdotDir < -0.8)
00119		{
00120			LoopAnim('movebackward', 4.0, 0.1);
00121		}
00122		else if (XdotDir > 0.8)
00123		{
00124			LoopAnim('moveforward', 4.0, 0.1);
00125		}
00126		else if ((X cross dir).Z < 0)
00127		{	// Moving left
00128			LoopAnim('moveleft', 4.0, 0.1);
00129		}
00130		else
00131		{	// Moving right
00132			LoopAnim('moveright', 4.0, 0.1);
00133		}
00134	}
00135	
00136	defaultproperties
00137	{
00138	     bFightHigh=False
00139	     ThrowZ=300.000000
00140	     AcquireSound=Sound'CreaturesSnd.Crab.crabamb03b'
00141	     AmbientWaitSounds(0)=Sound'CreaturesSnd.Crab.crabamb01'
00142	     AmbientWaitSounds(1)=Sound'CreaturesSnd.Crab.crabdeath03b'
00143	     AmbientFightSounds(0)=Sound'CreaturesSnd.Crab.crabattack01b'
00144	     AmbientFightSounds(1)=Sound'CreaturesSnd.Crab.crabamb02b'
00145	     AmbientFightSounds(2)=Sound'CreaturesSnd.Crab.crabattack04b'
00146	     AmbientWaitSoundDelay=18.000000
00147	     AmbientFightSoundDelay=14.000000
00148	     MeleeRange=40.000000
00149	     GroundSpeed=300.000000
00150	     MaxStepHeight=5.000000
00151	     WalkingSpeed=300.000000
00152	     Health=20
00153	     HitSound1=Sound'CreaturesSnd.Crab.crabdeath02'
00154	     HitSound2=Sound'CreaturesSnd.Crab.crabdeath01'
00155	     HitSound3=Sound'CreaturesSnd.Crab.crabdeath04'
00156	     DrawScale=0.500000
00157	     TransientSoundVolume=0.500000
00158	     TransientSoundRadius=600.000000
00159	     CollisionRadius=22.500000
00160	     CollisionHeight=16.000000
00161	     Mass=150.000000
00162	}

End Source Code