UnrealShare
Class rocket

source: e:\games\UnrealTournament\UnrealShare\Classes\Rocket.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--UnrealShare.rocket
Direct Known Subclasses:SeekingRocket

class rocket
extends Engine.Projectile

//============================================================================= // rocket. //=============================================================================
Variables
 vector InitialDir
 float MagnitudeVel,Count,SmokeRate
 int NumExtraRockets
 Actor Seeking
 bool bRing,bHitWater,bWaterStart

States
Flying

Function Summary
 
simulated
PostBeginPlay()
 
simulated
Tick(float DeltaTime)


State Flying Function Summary
 void BeginState()
 void BlowUp(vector HitLocation, RingExplosion r)



Source Code


00001	//=============================================================================
00002	// rocket.
00003	//=============================================================================
00004	class rocket extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=RocketM ANIVFILE=MODELS\rocket_a.3D DATAFILE=MODELS\rocket_d.3D LODSTYLE=2 LODFRAME=3
00007	#exec MESH LODPARAMS MESH=RocketM STRENGTH=0.2
00008	
00009	#exec MESH ORIGIN MESH=RocketM X=0 Y=-240 Z=0 YAW=-64
00010	
00011	#exec MESH SEQUENCE MESH=RocketM SEQ=All       STARTFRAME=0   NUMFRAMES=6
00012	#exec MESH SEQUENCE MESH=RocketM SEQ=Still     STARTFRAME=0   NUMFRAMES=1
00013	#exec MESH SEQUENCE MESH=RocketM SEQ=WingIn    STARTFRAME=1   NUMFRAMES=1
00014	#exec MESH SEQUENCE MESH=RocketM SEQ=Armed     STARTFRAME=1   NUMFRAMES=3
00015	#exec MESH SEQUENCE MESH=RocketM SEQ=SpinCCW   STARTFRAME=4   NUMFRAMES=1
00016	#exec MESH SEQUENCE MESH=RocketM SEQ=SpinCW    STARTFRAME=5   NUMFRAMES=1
00017	
00018	#exec TEXTURE IMPORT NAME=JRocket1 FILE=MODELS\rocket.PCX
00019	#exec OBJ LOAD FILE=Textures\fireeffect16.utx PACKAGE=UnrealShare.Effect16
00020	#exec MESHMAP SCALE MESHMAP=rocketM X=0.5 Y=0.5 Z=1.0 YAW=128
00021	#exec MESHMAP SETTEXTURE MESHMAP=rocketM NUM=1 TEXTURE=Jrocket1 TLOD=50
00022	
00023	#exec AUDIO IMPORT FILE="Sounds\EightBal\Ignite.WAV" NAME="Ignite" GROUP="Eightball"
00024	#exec AUDIO IMPORT FILE="Sounds\EightBal\grenflor.wav" NAME="GrenadeFloor" GROUP="Eightball"
00025	#exec AUDIO IMPORT FILE="Sounds\General\brufly1.WAV" NAME="Brufly1" GROUP="General"
00026	
00027	var Actor Seeking;
00028	var float MagnitudeVel,Count,SmokeRate;
00029	var vector InitialDir;
00030	var bool bRing,bHitWater,bWaterStart;
00031	var int NumExtraRockets;
00032	
00033	simulated function PostBeginPlay()
00034	{
00035		Count = -0.1;
00036		if (Level.bHighDetailMode) SmokeRate = 0.035;
00037		else SmokeRate = 0.15;
00038	}
00039	
00040	simulated function Tick(float DeltaTime)
00041	{
00042		local SpriteSmokePuff b;
00043	
00044		if (bHitWater)
00045		{
00046			Disable('Tick');
00047			Return;
00048		}
00049		Count += DeltaTime;
00050		if ( (Count>(SmokeRate+FRand()*(SmokeRate+NumExtraRockets*0.035))) && (Level.NetMode!=NM_DedicatedServer) ) 
00051		{
00052			b = Spawn(class'SpriteSmokePuff');
00053			b.RemoteRole = ROLE_None;		
00054			Count=0.0;
00055		}
00056	}
00057	
00058	auto state Flying
00059	{
00060	
00061		simulated function ZoneChange( Zoneinfo NewZone )
00062		{
00063			local waterring w;
00064			
00065			if (!NewZone.bWaterZone || bHitWater) Return;
00066	
00067			bHitWater = True;
00068			Disable('Tick');
00069			if ( Level.NetMode != NM_DedicatedServer )
00070			{
00071				w = Spawn(class'WaterRing',,,,rot(16384,0,0));
00072				w.DrawScale = 0.2;
00073				w.RemoteRole = ROLE_None;
00074				PlayAnim( 'Still', 3.0 );
00075			}		
00076			Velocity=0.6*Velocity;
00077		}
00078	
00079		simulated function ProcessTouch (Actor Other, Vector HitLocation)
00080		{
00081			if ((Other != instigator) && (Rocket(Other) == none)) 
00082				Explode(HitLocation,Normal(HitLocation-Other.Location));
00083		}
00084	
00085		function BlowUp(vector HitLocation, RingExplosion r)
00086		{
00087			if ( Level.Game.IsA('DeathMatchGame') ) //bigger damage radius
00088				HurtRadius(0.9 * Damage,240.0, 'exploded', MomentumTransfer, HitLocation );
00089			else
00090				HurtRadius(Damage,200.0, 'exploded', MomentumTransfer, HitLocation );
00091			MakeNoise(1.0);
00092	
00093			if ( r != None )
00094				r.PlaySound(r.ExploSound,,6);
00095		}
00096	
00097		simulated function Explode(vector HitLocation, vector HitNormal)
00098		{
00099			local SpriteBallExplosion s;
00100			local RingExplosion3 r;
00101	
00102			s = spawn(class'SpriteBallExplosion',,,HitLocation + HitNormal*16);	
00103	 		s.RemoteRole = ROLE_None;
00104	
00105			if (bRing) 
00106			{
00107				r = Spawn(class'RingExplosion3',,,HitLocation + HitNormal*16,rotator(HitNormal));
00108				r.RemoteRole = ROLE_None;
00109			}
00110			BlowUp(HitLocation, r);
00111	
00112	 		Destroy();
00113		}
00114	
00115		function BeginState()
00116		{
00117			initialDir = vector(Rotation);
00118			if ( Role == ROLE_Authority )	
00119				Velocity = speed*initialDir;
00120			Acceleration = initialDir*50;
00121			PlaySound(SpawnSound, SLOT_None, 2.3);	
00122			PlayAnim( 'Armed', 0.2 );
00123			if (Region.Zone.bWaterZone)
00124			{
00125				bHitWater = True;
00126				Velocity=0.6*Velocity;
00127			}
00128		}
00129	}
00130	
00131	defaultproperties
00132	{
00133	     speed=900.000000
00134	     MaxSpeed=1600.000000
00135	     Damage=85.000000
00136	     MomentumTransfer=80000
00137	     SpawnSound=Sound'UnrealShare.Eightball.Ignite'
00138	     ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor'
00139	     RemoteRole=ROLE_SimulatedProxy
00140	     LifeSpan=6.000000
00141	     AnimSequence=Armed
00142	     AmbientSound=Sound'UnrealShare.General.Brufly1'
00143	     Skin=FireTexture'UnrealShare.Effect16.fireeffect16'
00144	     Mesh=LodMesh'UnrealShare.RocketM'
00145	     DrawScale=0.050000
00146	     AmbientGlow=96
00147	     bUnlit=True
00148	     SoundRadius=9
00149	     SoundVolume=255
00150	     LightType=LT_Steady
00151	     LightEffect=LE_NonIncidence
00152	     LightBrightness=126
00153	     LightHue=28
00154	     LightSaturation=64
00155	     LightRadius=6
00156	     bCorona=True
00157	     bBounce=True
00158	}

End Source Code