UnrealShare
Class Flare

source: e:\games\UnrealTournament\UnrealShare\Classes\Flare.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--UnrealShare.Flare
Direct Known Subclasses:None

class Flare
extends Engine.Pickup

//============================================================================= // Flare. //=============================================================================
Variables
 vector X,Y,Z
 bool bDamaged
 bool bFirstTick
 Flare f

States
Activated
State Activated Function Summary
 void TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
 void Timer()
     
// Delete from inventory and toss in front of player.



Source Code


00001	//=============================================================================
00002	// Flare.
00003	//=============================================================================
00004	class Flare extends Pickup;
00005	
00006	#exec AUDIO IMPORT FILE="Sounds\Pickups\GENPICK3.WAV" NAME="GenPickSnd"    GROUP="Pickups"
00007	#exec AUDIO IMPORT FILE="Sounds\Pickups\flarel1.WAV" NAME="flarel1"    GROUP="Pickups"
00008	#exec AUDIO IMPORT FILE="Sounds\Pickups\flares1.WAV" NAME="flares1"    GROUP="Pickups"
00009	
00010	#exec TEXTURE IMPORT NAME=I_Flare FILE=TEXTURES\HUD\i_flare.PCX GROUP="Icons" MIPS=OFF
00011	
00012	#exec MESH IMPORT MESH=FlareM ANIVFILE=MODELS\Flare_a.3D DATAFILE=MODELS\Flare_d.3D LODSTYLE=2 LODFRAME=1
00013	#exec MESH LODPARAMS MESH=FlareM STRENGTH=0.1
00014	
00015	
00016	#exec MESH ORIGIN MESH=FlareM X=0 Y=0 Z=-150 YAW=-64 PITCH=64
00017	#exec MESH SEQUENCE MESH=FlareM SEQ=All STARTFRAME=0  NUMFRAMES=2
00018	#exec MESH SEQUENCE MESH=FlareM SEQ=In  STARTFRAME=0  NUMFRAMES=1
00019	#exec MESH SEQUENCE MESH=FlareM SEQ=Out STARTFRAME=1  NUMFRAMES=1
00020	#exec TEXTURE IMPORT NAME=JMisc1 FILE=MODELS\misc.PCX GROUP="Skins"
00021	#exec OBJ LOAD FILE=Textures\fireeffect8.utx  PACKAGE=UnrealShare.Effect8
00022	#exec MESHMAP SCALE MESHMAP=FlareM X=0.02 Y=0.02 Z=0.04
00023	#exec MESHMAP SETTEXTURE MESHMAP=FlareM NUM=1 TEXTURE=JMisc1
00024	#exec MESHMAP SETTEXTURE MESHMAP=FlareM NUM=0 TEXTURE=UnrealShare.Effect8.FireEffect8
00025	
00026	var vector X,Y,Z;
00027	var Flare f;
00028	var bool bFirstTick;
00029	var bool bDamaged;
00030	
00031	state Activated  // Delete from inventory and toss in front of player.
00032	{
00033		function Timer()
00034		{
00035			if( bFirstTick )
00036			{
00037				bFirstTick=False;
00038				PlayAnim('out',0.1);
00039				PlaySound(ActivateSound);
00040				LightType = LT_Steady;		
00041				LightBrightness = 250;
00042				LightRadius = 33;
00043				LightSaturation = 89;
00044				AmbientGlow = 200;
00045				SetTimer(1.0,True);
00046				AmbientSound = sound'flarel1';
00047			}
00048			Charge--;
00049			if (Charge<=0) TakeDamage(10,None, Vect(0,0,0), Vect(0,0,0), 'Detonated');
00050		}
00051		function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
00052						Vector momentum, name damageType)
00053		{
00054			if (bDamaged) Return;
00055			bDamaged = True;
00056			Spawn(Class 'SpriteBallExplosion',,,Location+Vect(0,0,9));
00057			HurtRadius(50, 50, 'exploded', 0, Location);
00058			Destroy();
00059		}
00060		simulated function HitWall( vector HitNormal, actor Wall )
00061		{
00062			Velocity = 0.6*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);   // Reflect off Wall w/damping
00063			bRotatetoDesired=True;
00064			bFixedRotationDir=False;
00065			DesiredRotation.Pitch=0;	
00066			DesiredRotation.Yaw=FRand()*65536;
00067			DesiredRotation.Roll=0;		
00068			RotationRate.Yaw = RotationRate.Yaw*0.75;
00069			RotationRate.Roll = RotationRate.Roll*0.75;
00070			RotationRate.Pitch = RotationRate.Pitch*0.75;	
00071			If (VSize(Velocity) < 5)
00072			{
00073				bBounce = False;
00074				SetPhysics(PHYS_None);
00075			}
00076		}
00077	
00078	Begin:
00079		if (NumCopies>0)
00080		{
00081			NumCopies--;
00082			GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
00083			f=Spawn(class, Owner, '', Pawn(Owner).Location +10*Y - 20*Z );
00084			f.NumCopies=-10;
00085			f.GoToState('Activated');
00086			GoToState('');
00087		}
00088		else
00089		{
00090			Disable('Touch');
00091			GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
00092			SetPhysics(PHYS_Falling);
00093			Velocity = Owner.Velocity + Vector(Pawn(Owner).ViewRotation) * 450.0;
00094			Velocity.z += 100;
00095			SetTimer(0.25,True);
00096			DesiredRotation = RotRand();
00097			RotationRate.Yaw = 200000*FRand() - 100000;
00098			RotationRate.Pitch = 200000*FRand() - 100000;
00099			RotationRate.Roll = 200000*FRand() - 100000;
00100			bFixedRotationDir=True;
00101			SetLocation(Owner.Location+Y*10-Z*20);
00102			if (NumCopies>-5) {
00103				Pawn(Owner).NextItem();
00104				if (Pawn(Owner).SelectedItem == Self) Pawn(Owner).SelectedItem=None;	
00105				Pawn(Owner).DeleteInventory(Self);
00106			}
00107			bFirstTick=True;
00108			BecomePickup();		
00109			bStasis = false;
00110			bBounce=True;
00111			bCollideWorld=True;		
00112		}
00113	}
00114	
00115	defaultproperties
00116	{
00117	     bCanHaveMultipleCopies=True
00118	     bActivatable=True
00119	     bDisplayableInv=True
00120	     PickupMessage="You got a flare"
00121	     RespawnTime=30.000000
00122	     PickupViewMesh=LodMesh'UnrealShare.FlareM'
00123	     Charge=10
00124	     PickupSound=Sound'UnrealShare.Pickups.GenPickSnd'
00125	     ActivateSound=Sound'UnrealShare.Pickups.flares1'
00126	     Icon=Texture'UnrealShare.Icons.I_Flare'
00127	     RemoteRole=ROLE_DumbProxy
00128	     Mesh=LodMesh'UnrealShare.FlareM'
00129	     bUnlit=True
00130	     CollisionRadius=13.000000
00131	     CollisionHeight=8.000000
00132	     bCollideWorld=True
00133	     bProjTarget=True
00134	     LightBrightness=199
00135	     LightHue=25
00136	     LightSaturation=89
00137	     LightRadius=33
00138	}

End Source Code