Botpack
Class RocketMk2

source: e:\games\UnrealTournament\Botpack\Classes\RocketMk2.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--Botpack.RocketMk2
Direct Known Subclasses:UT_SeekingRocket

class RocketMk2
extends Engine.Projectile

//============================================================================= // rocketmk2. //=============================================================================
Variables
 int NumExtraRockets
 float SmokeRate
 bool bRing,bHitWater,bWaterStart

States
Flying

Function Summary
 
simulated
Destroyed()
 
simulated
PostBeginPlay()
 
simulated
Timer()


State Flying Function Summary
 void BeginState()
 void BlowUp(vector HitLocation)



Source Code


00001	//=============================================================================
00002	// rocketmk2.
00003	//=============================================================================
00004	class RocketMk2 extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=UTRocket ANIVFILE=MODELS\eightballrocket_a.3D DATAFILE=MODELS\eightballrocket_d.3D X=0 Y=0 Z=0
00007	#exec MESH ORIGIN MESH=UTRocket X=0 Y=-250 Z=-30 YAW=-64
00008	
00009	#exec MESH SEQUENCE MESH=UTRocket SEQ=All       STARTFRAME=0   NUMFRAMES=2
00010	#exec MESH SEQUENCE MESH=UTRocket SEQ=Still     STARTFRAME=0   NUMFRAMES=1
00011	#exec MESH SEQUENCE MESH=UTRocket SEQ=Wing     STARTFRAME=1   NUMFRAMES=1
00012	
00013	#exec TEXTURE IMPORT NAME=JuRocket1 FILE=MODELS\eightballrocket.PCX LODSET=2
00014	#exec MESHMAP SCALE MESHMAP=UTRocket X=2.2 Y=2.2 Z=4.5 YAW=128
00015	#exec MESHMAP SETTEXTURE MESHMAP=UTRocket NUM=1 TEXTURE=Jurocket1
00016	
00017	#exec AUDIO IMPORT FILE="Sounds\RocketLauncher\brufly1c.Wav" NAME=RocketFly1 GROUP="RocketLauncher"
00018	
00019	var float SmokeRate;
00020	var bool bRing,bHitWater,bWaterStart;
00021	var int NumExtraRockets;
00022	var	rockettrail trail;
00023	
00024	simulated function Destroyed()
00025	{
00026		if ( Trail != None )
00027			Trail.Destroy();
00028		Super.Destroyed();
00029	}
00030	
00031	simulated function PostBeginPlay()
00032	{
00033		Trail = Spawn(class'RocketTrail',self);
00034		if ( Level.bHighDetailMode )
00035		{
00036			SmokeRate = (200 + (0.5 + 2 * FRand()) * NumExtraRockets * 24)/Speed; 
00037			if ( Level.bDropDetail )
00038			{
00039				SoundRadius = 6;
00040				LightRadius = 3;
00041			}
00042		}
00043		else 
00044		{
00045			SmokeRate = 0.15 + FRand()*(0.02+NumExtraRockets);
00046			LightRadius = 3;
00047		}
00048		SetTimer(SmokeRate, true);
00049	}
00050	
00051	simulated function Timer()
00052	{
00053		local ut_SpriteSmokePuff b;
00054	
00055		if ( Region.Zone.bWaterZone || (Level.NetMode == NM_DedicatedServer) )
00056			Return;
00057	
00058		if ( Level.bHighDetailMode )
00059		{
00060			if ( Level.bDropDetail || ((NumExtraRockets > 0) && (FRand() < 0.5)) )
00061				Spawn(class'LightSmokeTrail');
00062			else
00063				Spawn(class'UTSmokeTrail');
00064			SmokeRate = 152/Speed; 
00065		}
00066		else 
00067		{
00068			SmokeRate = 0.15 + FRand()*(0.01+NumExtraRockets);
00069			b = Spawn(class'ut_SpriteSmokePuff');
00070			b.RemoteRole = ROLE_None;
00071		}
00072		SetTimer(SmokeRate, false);
00073	}
00074	
00075	auto state Flying
00076	{
00077	
00078		simulated function ZoneChange( Zoneinfo NewZone )
00079		{
00080			local waterring w;
00081			
00082			if (!NewZone.bWaterZone || bHitWater) Return;
00083	
00084			bHitWater = True;
00085			if ( Level.NetMode != NM_DedicatedServer )
00086			{
00087				w = Spawn(class'WaterRing',,,,rot(16384,0,0));
00088				w.DrawScale = 0.2;
00089				w.RemoteRole = ROLE_None;
00090				PlayAnim( 'Still', 3.0 );
00091			}		
00092			Velocity=0.6*Velocity;
00093		}
00094	
00095		simulated function ProcessTouch (Actor Other, Vector HitLocation)
00096		{
00097			if ( (Other != instigator) && !Other.IsA('Projectile') ) 
00098				Explode(HitLocation,Normal(HitLocation-Other.Location));
00099		}
00100	
00101		function BlowUp(vector HitLocation)
00102		{
00103			HurtRadius(Damage,220.0, MyDamageType, MomentumTransfer, HitLocation );
00104			MakeNoise(1.0);
00105		}
00106	
00107		simulated function Explode(vector HitLocation, vector HitNormal)
00108		{
00109			local UT_SpriteBallExplosion s;
00110	
00111			s = spawn(class'UT_SpriteBallExplosion',,,HitLocation + HitNormal*16);	
00112	 		s.RemoteRole = ROLE_None;
00113	
00114			BlowUp(HitLocation);
00115	
00116	 		Destroy();
00117		}
00118	
00119		function BeginState()
00120		{
00121			local vector Dir;
00122	
00123			Dir = vector(Rotation);
00124			Velocity = speed * Dir;
00125			Acceleration = Dir * 50;
00126			PlayAnim( 'Wing', 0.2 );
00127			if (Region.Zone.bWaterZone)
00128			{
00129				bHitWater = True;
00130				Velocity=0.6*Velocity;
00131			}
00132		}
00133	}
00134	
00135	defaultproperties
00136	{
00137	     speed=900.000000
00138	     MaxSpeed=1600.000000
00139	     Damage=75.000000
00140	     MomentumTransfer=80000
00141	     MyDamageType=RocketDeath
00142	     SpawnSound=Sound'UnrealShare.Eightball.Ignite'
00143	     ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor'
00144	     ExplosionDecal=Class'Botpack.BlastMark'
00145	     RemoteRole=ROLE_SimulatedProxy
00146	     LifeSpan=6.000000
00147	     AnimSequence=Wing
00148	     AmbientSound=Sound'Botpack.RocketLauncher.RocketFly1'
00149	     Mesh=LodMesh'Botpack.UTRocket'
00150	     DrawScale=0.020000
00151	     AmbientGlow=96
00152	     bUnlit=True
00153	     SoundRadius=14
00154	     SoundVolume=255
00155	     SoundPitch=100
00156	     LightType=LT_Steady
00157	     LightEffect=LE_NonIncidence
00158	     LightBrightness=255
00159	     LightHue=28
00160	     LightRadius=6
00161	     bBounce=True
00162	     bFixedRotationDir=True
00163	     RotationRate=(Roll=50000)
00164	     DesiredRotation=(Roll=30000)
00165	}

End Source Code