Botpack
Class WarShell

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

class WarShell
extends Engine.Projectile

//============================================================================= // WarShell. //=============================================================================
Variables
 CannonTimer, SmokeRate

States
Flying

Function Summary
 
simulated
Destroyed()
 
simulated
PostBeginPlay()
 void TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, vector momentum, name damageType)
 
simulated
Timer()
 void WarnCannons()


State Flying Function Summary
 void BeginState()
 void Explode(vector HitLocation, vector HitNormal)
 void ProcessTouch(Actor Other, Vector HitLocation)



Source Code


00001	//=============================================================================
00002	// WarShell.
00003	//=============================================================================
00004	class WarShell extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=missile ANIVFILE=MODELS\missile_a.3d DATAFILE=MODELS\missile_d.3d LODSTYLE=2
00007	#exec MESH ORIGIN MESH=missile X=0 Y=0 Z=100 PITCH=192
00008	#exec MESH SEQUENCE MESH=missile SEQ=All                      STARTFRAME=0 NUMFRAMES=100
00009	#exec MESH SEQUENCE MESH=missile SEQ=missile                  STARTFRAME=0 NUMFRAMES=100
00010	#exec MESHMAP NEW   MESHMAP=missile MESH=missile
00011	#exec MESHMAP SCALE MESHMAP=missile X=0.1 Y=0.1 Z=0.2
00012	#exec TEXTURE IMPORT NAME=Jmissile_01 FILE=Models\missile.PCX GROUP=Skins
00013	#exec MESHMAP SETTEXTURE MESHMAP=missile NUM=1 TEXTURE=Jmissile_01 TLOD=30
00014	#exec AUDIO IMPORT FILE="Sounds\Warhead\redeemerrocketfly.wav" NAME="WarFly" GROUP=Redeemer
00015	
00016	var float CannonTimer, SmokeRate;
00017	var	redeemertrail trail;
00018	
00019	simulated function Timer()
00020	{
00021		local ut_SpriteSmokePuff b;
00022	
00023		if ( Trail == None )
00024			Trail = Spawn(class'RedeemerTrail',self);
00025	
00026		CannonTimer += SmokeRate;
00027		if ( CannonTimer > 0.6 )
00028		{
00029			WarnCannons();
00030			CannonTimer -= 0.6;
00031		}
00032	
00033		if ( Region.Zone.bWaterZone || (Level.NetMode == NM_DedicatedServer) )
00034		{
00035			SetTimer(SmokeRate, false);
00036			Return;
00037		}
00038	
00039		if ( Level.bHighDetailMode )
00040		{
00041			if ( Level.bDropDetail )
00042				Spawn(class'LightSmokeTrail');
00043			else
00044				Spawn(class'UTSmokeTrail');
00045			SmokeRate = 152/Speed; 
00046		}
00047		else 
00048		{
00049			SmokeRate = 0.15;
00050			b = Spawn(class'ut_SpriteSmokePuff');
00051			b.RemoteRole = ROLE_None;
00052		}
00053		SetTimer(SmokeRate, false);
00054	}
00055	
00056	simulated function Destroyed()
00057	{
00058		if ( Trail != None )
00059			Trail.Destroy();
00060		Super.Destroyed();
00061	}
00062	
00063	simulated function PostBeginPlay()
00064	{
00065		SmokeRate = 0.3;
00066		SetTimer(0.3,false); 
00067	}
00068	
00069	function WarnCannons()
00070	{
00071		local Pawn P;
00072	
00073		for ( P=Level.Pawnlist; P!=None; P=P.NextPawn )
00074			if ( P.IsA('TeamCannon') && !P.IsInState('TrackWarhead') && P.LineOfSightTo(self) )
00075			{
00076				P.target = self;
00077				P.GotoState('TrackWarhead');
00078			}
00079	}
00080	
00081	singular function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
00082							vector momentum, name damageType )
00083	{
00084		if ( NDamage > 5 )
00085		{
00086			PlaySound(Sound'Expl03',,6.0);
00087			spawn(class'WarExplosion',,,Location);
00088			HurtRadius(Damage,350.0, MyDamageType, MomentumTransfer, HitLocation );
00089			RemoteRole = ROLE_SimulatedProxy;	 		 		
00090	 		Destroy();
00091		}
00092	}
00093	
00094	auto state Flying
00095	{
00096	
00097		simulated function ZoneChange( Zoneinfo NewZone )
00098		{
00099			local waterring w;
00100			
00101			if ( NewZone.bWaterZone != Region.Zone.bWaterZone )
00102			{
00103				w = Spawn(class'WaterRing',,,,rot(16384,0,0));
00104				w.DrawScale = 0.2;
00105				w.RemoteRole = ROLE_None; 
00106			}	
00107		}
00108	
00109		function ProcessTouch (Actor Other, Vector HitLocation)
00110		{
00111			if ( Other != instigator ) 
00112				Explode(HitLocation,Normal(HitLocation-Other.Location));
00113		}
00114	
00115		function Explode(vector HitLocation, vector HitNormal)
00116		{
00117			if ( Role < ROLE_Authority )
00118				return;
00119	
00120			HurtRadius(Damage,300.0, MyDamageType, MomentumTransfer, HitLocation );	 		 		
00121	 		spawn(class'ShockWave',,,HitLocation+ HitNormal*16);	
00122			RemoteRole = ROLE_SimulatedProxy;	 		 		
00123	 		Destroy();
00124		}
00125	
00126		function BeginState()
00127		{
00128			local vector InitialDir;
00129	
00130			initialDir = vector(Rotation);
00131			if ( Role == ROLE_Authority )	
00132				Velocity = speed*initialDir;
00133			Acceleration = initialDir*50;
00134		}
00135	}
00136	
00137	defaultproperties
00138	{
00139	     speed=600.000000
00140	     Damage=1000.000000
00141	     MomentumTransfer=100000
00142	     MyDamageType=RedeemerDeath
00143	     ExplosionDecal=Class'Botpack.NuclearMark'
00144	     bNetTemporary=False
00145	     RemoteRole=ROLE_SimulatedProxy
00146	     AmbientSound=Sound'Botpack.Redeemer.WarFly'
00147	     Mesh=LodMesh'Botpack.missile'
00148	     AmbientGlow=78
00149	     bUnlit=True
00150	     SoundRadius=100
00151	     SoundVolume=255
00152	     CollisionRadius=15.000000
00153	     CollisionHeight=8.000000
00154	     bProjTarget=True
00155	}

End Source Code