RuneI
Class DestroyRock

source: c:\runehov\RuneI\Classes\DestroyRock.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--RuneI.DecorationRune
            |
            +--RuneI.DestroyRock
Direct Known Subclasses:None

class DestroyRock
extends RuneI.DecorationRune

//============================================================================= // DestroyRock. //=============================================================================
Variables
 int Health


Function Summary
 bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
     
//================================================
//
// JointDamaged
//
// He is stunned by thrown objects
//================================================
 void ThrowDebris(int number)



Source Code


00001	//=============================================================================
00002	// DestroyRock.
00003	//=============================================================================
00004	class DestroyRock expands DecorationRune;
00005	
00006	var int Health;
00007	
00008	
00009	
00010	function ThrowDebris(int number)
00011	{
00012		local int i;
00013		local Rocks rock;
00014	
00015		for (i=0; i<number; i++)
00016		{
00017			switch(Rand(2))
00018			{
00019			case 0:
00020				rock = spawn(class'rocksmall',,,,);
00021				break;
00022			case 1:
00023				rock = spawn(class'rockmedium',,,,);
00024				break;
00025			}
00026			rock.SetPhysics(PHYS_Falling);
00027			rock.Velocity = (VRand()+vect(0,0,2)) * RandRange(100,1000);
00028			rock.LifeSpan = 5.0;
00029		}
00030	}
00031	
00032	//================================================
00033	//
00034	// JointDamaged
00035	//
00036	// He is stunned by thrown objects
00037	//================================================
00038	function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
00039	{
00040		if (DamageType == 'blunt')
00041		{
00042			Health -= Damage;
00043			if (Health <= 0)
00044			{
00045				ThrowDebris(7);
00046				Destroy();
00047			}
00048		}
00049		return false;
00050	}
00051	
00052	defaultproperties
00053	{
00054	     Health=50
00055	     bStatic=False
00056	     DrawType=DT_SkeletalMesh
00057	     DrawScale=2.000000
00058	     AmbientGlow=15
00059	     CollisionRadius=42.000000
00060	     CollisionHeight=45.000000
00061	     bCollideActors=True
00062	     bCollideWorld=True
00063	     bBlockActors=True
00064	     bBlockPlayers=True
00065	     Mass=400.000000
00066	     SkelMesh=2
00067	     Skeletal=SkelModel'objects.Rocks'
00068	}

End Source Code