XIII
Class M16GrenadFlying

source: C:\XIII\XIII\Classes\M16GrenadFlying.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--XIII.XIIIProjectile
            |
            +--XIII.M16GrenadFlying
Direct Known Subclasses:None

class M16GrenadFlying
extends XIII.XIIIProjectile

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 bCanHitOwner, bHitWater
 rotator rHit


Function Summary
 
simulated
Explode(vector HitLocation, vector HitNormal)
     
//_____________________________________________________________________________
 
simulated
Explosion(vector HitLocation)
     
//_____________________________________________________________________________
 
simulated
HitWall(vector HitNormal, Actor Wall)
     
//_____________________________________________________________________________
 
simulated
Landed(vector HitNormal)
     
//_____________________________________________________________________________
 
simulated
PostBeginPlay()
     
//_____________________________________________________________________________
// Set up speed
 
simulated
PostBeginPlay()
     
//_____________________________________________________________________________
// Set up speed
 
simulated
ProcessTouch(Actor Other, vector HitLocation)
     
//_____________________________________________________________________________
 
simulated
Timer()
     
//_____________________________________________________________________________
 
simulated
Timer()
     
//_____________________________________________________________________________



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class M16GrenadFlying extends XIIIProjectile;
00005	
00006	var rotator rHit;
00007	
00008	//_____________________________________________________________________________
00009	// Set up speed
00010	simulated function PostBeginPlay()
00011	{
00012	//    Log("--> Spawn projectile"@self); // ::DBUG::
00013	    Super.PostBeginPlay();
00014	    Velocity = Vector(Rotation) * Speed;
00015	    Velocity.z += 210;
00016	
00017	    MyTrail = Spawn(MyTrailClass,self,,Location);
00018	    MyTrail.Init();
00019	}
00020	
00021	//_____________________________________________________________________________
00022	simulated function Timer()
00023	{
00024	    if ( bSpawnDecal && (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
00025	      Spawn(ExplosionDecal,self,,Location, rHit);
00026	    destroy();
00027	}
00028	
00029	//_____________________________________________________________________________
00030	simulated function Explode(vector HitLocation, vector HitNormal)
00031	{
00032	    Local FragmentExplo Frag;
00033	    Local int i, FragLoop;
00034	
00035	    BlowUp(HitLocation + 50*HitNormal);
00036	    if ( Level.NetMode != NM_DedicatedServer )
00037	    {
00038	      Spawn(ExplosionEmitterClass,,,HitLocation + HitNormal*50 - vector(rotation)*150,rotator(HitNormal));
00039	/*
00040	      if ( (Level.Game != none) && (Level.Game.DetailLevel > 1) )
00041	        FragLoop = 6;
00042	      else
00043	        FragLoop = 3;
00044	      for(i = 0; i < FragLoop ; i++)
00045	      {
00046	        Frag = Spawn(class'FragmentExplo',self,, HitLocation + HitNormal*50 - vector(rotation)*150,rotator(HitNormal));
00047	        Frag.Velocity = (vRand())*(400+fRand()*200);
00048	      }
00049	*/
00050	      if ( PhysicsVolume.bWaterVolume )
00051	      {
00052	        SpawnWaterExplo(HitLocation);
00053	      }
00054	    }
00055	    rHit = rotator(-HitNormal);
00056	    SetPhysics(PHYS_None);
00057	    Velocity = vect(0,0,0);
00058	    bHidden = true;
00059	    RefreshDisplaying();
00060	    SetTimer(0.05, false);
00061	}
00062	
00063	/*
00064	var bool bCanHitOwner, bHitWater;
00065	//var bool bArmed;
00066	//var float Count, SmokeRate;
00067	//var int NumExtraGrenades;
00068	//var int NombreRebonds;
00069	//var float fLifeTime;                // duration before explosion
00070	
00071	//_____________________________________________________________________________
00072	// Set up speed
00073	simulated function PostBeginPlay()
00074	{
00075	    local vector X,Y,Z;
00076	    local rotator RandRot;
00077	
00078	    Super.PostBeginPlay();
00079	//    bArmed = false;
00080	    SetTimer(10.0,false);   // to make it blow after 10 seconds
00081	
00082	    if ( Role == ROLE_Authority )
00083	    {
00084	      GetAxes(Instigator.GetViewRotation(),X,Y,Z);
00085	      Velocity = X * (Instigator.Velocity Dot X)*0.4 + Vector(Rotation) * (Speed + FRand() * 100);
00086	      Velocity.z += 210;
00087	      MaxSpeed = 1000;
00088	      RandSpin(80000);
00089	      bCanHitOwner = False;
00090	      if (Instigator.HeadVolume.bWaterVolume)
00091	      {
00092	        bHitWater = True;
00093	        Disable('Tick');
00094	        Velocity=0.6*Velocity;
00095	      }
00096	    }
00097	    MyTrail = Spawn(MyTrailClass,self,,Location);
00098	    MyTrail.CurRotation = fRand()*80.0;
00099	    MyTrail.Init();
00100	}
00101	
00102	
00103	//_____________________________________________________________________________
00104	simulated function Timer()
00105	{
00106	    if ( bSpawnDecal )
00107	    {
00108	      if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
00109	        Spawn(ExplosionDecal,self,,Location, rotator(vect(0,0,-1)));
00110	      Destroy();
00111	    }
00112	    else
00113	    {
00114	      Explosion(Location+Vect(0,0,1)*16);
00115	      bSpawnDecal = true;
00116	      SetTimer(0.2, false);
00117	    }
00118	}
00119	
00120	//_____________________________________________________________________________
00121	simulated function Landed( vector HitNormal )
00122	{
00123	    HitWall( HitNormal, None );
00124	}
00125	
00126	//_____________________________________________________________________________
00127	simulated function ProcessTouch( actor Other, vector HitLocation )
00128	{
00129	    Local vector vt;
00130	
00131	    if ( (Other!=instigator) || bCanHitOwner )
00132	    {
00133	      Velocity = 0.2*Velocity;
00134	      vt = HitLocation - Other.Location;
00135	      HitWall( normal(vt), None );
00136	    }
00137	}
00138	
00139	//_____________________________________________________________________________
00140	simulated function HitWall( vector HitNormal, actor Wall )
00141	{
00142	//    bArmed = true;
00143	    // Special for RocketArena mod
00144	    if ( XIIIGameInfo(level.game).bRocketArena )
00145	    {
00146	      Damage=200.0;
00147	      DamageRadius=200.0;
00148	      Velocity = vect(0,0,0);
00149	      SetPhysics(PHYS_None);
00150	      Timer();
00151	      Return;
00152	    }
00153	
00154	    // Explosion on contact for Player's grenades
00155	    if ( Instigator.IsPlayerPawn() )
00156	    {
00157	      Velocity = vect(0,0,0);
00158	      SetPhysics(PHYS_None);
00159	      Timer();
00160	      Return;
00161	    }
00162	}
00163	
00164	//_____________________________________________________________________________
00165	simulated function Explosion(vector HitLocation)
00166	{
00167	    BlowUp(HitLocation);
00168	    if ( Level.NetMode != NM_DedicatedServer )
00169	    {
00170	      spawn(ExplosionEmitterClass,,,Location + vect(0,0,1)*50,rotator(vect(0,0,1)));
00171	      if ( PhysicsVolume.bWaterVolume )
00172	      {
00173	        SpawnWaterExplo(HitLocation);
00174	      }
00175	    }
00176	    bHidden = true;
00177	    RefreshDisplaying();
00178	}
00179	*/
00180	
00181	
00182	
00183	defaultproperties
00184	{
00185	     HitSoundType=4
00186	     MyTrailClass=Class'XIII.M16GrenadTrail'
00187	     StaticMeshName="MeshArmesPickup.M16Grenade"
00188	     ShakeMag=900.000000
00189	     shaketime=7.000000
00190	     ShakeVert=(X=5.000000,Y=10.000000,Z=-25.000000)
00191	     ShakeSpeed=(X=300.000000,Y=300.000000,Z=300.000000)
00192	     ShakeCycles=2.000000
00193	     ExplosionEmitterClass=Class'XIII.GrenadExplosionEmitter'
00194	     Speed=1200.000000
00195	     MaxSpeed=1000.000000
00196	     Damage=300.000000
00197	     DamageRadius=1200.000000
00198	     MomentumTransfer=80000.000000
00199	     MyDamageType=Class'XIII.DTGrenaded'
00200	     ExplosionDecal=Class'XIII.GrenadBlast'
00201	     bBounce=True
00202	     bFixedRotationDir=True
00203	     Physics=PHYS_Falling
00204	     DrawType=DT_StaticMesh
00205	     LifeSpan=12.000000
00206	     SaturationDistance=600.000000
00207	     StabilisationDistance=3500.000000
00208	     StabilisationVolume=-10.000000
00209	}

End Source Code