XIIIMP
Class MPBombFlying

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

class MPBombFlying
extends XIII.XIIIProjectile

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 int NumExtraGrenades
 Count, SmokeRate
 bool bArmed
 bCanHitOwner, bHitWater
 float fLifeTime
           duration before explosion


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



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class MPBombFlying extends XIIIProjectile;
00005	
00006	var bool bCanHitOwner, bHitWater;
00007	var bool bArmed;
00008	var float Count, SmokeRate;
00009	var int NumExtraGrenades;
00010	var float fLifeTime;                // duration before explosion
00011	
00012	replication
00013	{
00014	    Reliable if ( Role == ROLE_Authority )
00015	      fLifeTime;
00016	}
00017	
00018	//_____________________________________________________________________________
00019	// Set up speed
00020	simulated function PostBeginPlay()
00021	{
00022	    local vector X,Y,Z;
00023	    local rotator RandRot;
00024	
00025	    Super.PostBeginPlay();
00026	    bArmed=false;
00027	    fLifeTime = 5.0;        // Set this just in case it will be thrown by no player thus intialized after postbeginplay
00028	    SetTimer(0.1,false);    // Call it again later with the right intialized lifetime
00029	
00030	    if ( Role == ROLE_Authority )
00031	    {
00032	      GetAxes(Instigator.GetViewRotation(),X,Y,Z);
00033	      Velocity = X * (Instigator.Velocity Dot X)*0.4 + Vector(Rotation) * (Speed + FRand() * 100);
00034	      Velocity.z += 20;
00035	      MaxSpeed = 100;
00036	//      RandSpin(50000);
00037	      bCanHitOwner = False;
00038	      if (Instigator.HeadVolume.bWaterVolume)
00039	      {
00040	        bHitWater = True;
00041	        Disable('Tick');
00042	        Velocity=0.6*Velocity;
00043	      }
00044	    }
00045	    MyTrail = Spawn(MyTrailClass,self,,Location);
00046	    MyTrail.Init();
00047	}
00048	
00049	//_____________________________________________________________________________
00050	simulated function BeginPlay()
00051	{
00052	    SmokeRate = 0.15;
00053	}
00054	
00055	//_____________________________________________________________________________
00056	simulated function Timer()
00057	{
00058	    if ( !bArmed )
00059	    { // set the timer back one the fLifeTime has been initialized by the weapon
00060	      bArmed=true;
00061	      fLifeTime = fMax(0.05, fLifeTime);
00062	      SetTimer(fLifeTime, false);
00063	      return;
00064	    }
00065	
00066	    if ( bSpawnDecal )
00067	    {
00068	      if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
00069	        Spawn(ExplosionDecal,self,,Location, rotator(vect(0,0,-1)));
00070	      Destroy();
00071	    }
00072	    else
00073	    {
00074	      Explosion(Location+Vect(0,0,1)*16);
00075	      bSpawnDecal = true;
00076	      SetTimer(0.2, false);
00077	    }
00078	}
00079	
00080	//_____________________________________________________________________________
00081	simulated function Landed( vector HitNormal )
00082	{
00083	    HitWall( HitNormal, None );
00084	}
00085	
00086	//_____________________________________________________________________________
00087	simulated function ProcessTouch( actor Other, vector HitLocation )
00088	{
00089	    Local vector vt;
00090	
00091	    if ( (Other!=instigator) || bCanHitOwner )
00092	    {
00093	      Velocity = 0.2*Velocity;
00094	      vt = HitLocation - Other.Location;
00095	      HitWall( normal(vt), None );
00096	    }
00097	}
00098	
00099	//_____________________________________________________________________________
00100	simulated function HitWall( vector HitNormal, actor Wall )
00101	{
00102	    MyTrail.RotationSpeed *= 2.0;
00103	
00104	    if (Wall != none)
00105	      PlayImpactSound(-normal(velocity), Wall);
00106	    bCanHitOwner = True;
00107	//    Velocity = 0.25*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);   // Reflect off Wall w/damping
00108	    speed = VSize(Velocity);
00109	    if ( Velocity.Z > 400 )
00110	      Velocity.Z = 0.5 * (400 + Velocity.Z);
00111	    else if ( (speed < 10) && (Wall != none) ) // don't stop of touching and not hitting real wall.
00112	    {
00113	      bBounce = False;
00114	      SetPhysics(PHYS_None);
00115	    }
00116	}
00117	
00118	//_____________________________________________________________________________
00119	simulated function Explosion(vector HitLocation)
00120	{
00121	    //FRD   appel GenAlerte pour gestion grenade
00122	    if (level.bLonePlayer) XIIIGameInfo(level.game).genalerte.untrigger(self,instigator);
00123	
00124	    BlowUp(HitLocation);
00125	    TriggerEvent('MPBombingBase', self, Instigator); // trigger all the bombing bases to activate goal if necessary
00126	    if ( Level.NetMode != NM_DedicatedServer )
00127	    {
00128	      spawn(class'XIII.GrenadExplosionEmitter',,,Location + vect(0,0,1)*50,rotator(vect(0,0,1)));
00129	    }
00130	}
00131	
00132	
00133	
00134	defaultproperties
00135	{
00136	     fLifeTime=-5.000000
00137	     bSpawnDecal=False
00138	     HitSoundType=4
00139	     MyTrailClass=Class'XIII.GrenadTrail'
00140	     StaticMeshName="MeshArmesPickup.BombeMagnet"
00141	     ShakeMag=900.000000
00142	     shaketime=7.000000
00143	     ShakeVert=(X=5.000000,Y=10.000000,Z=-25.000000)
00144	     ShakeSpeed=(X=300.000000,Y=300.000000,Z=300.000000)
00145	     ShakeCycles=2.000000
00146	     Speed=80.000000
00147	     MaxSpeed=100.000000
00148	     Damage=1000.000000
00149	     DamageRadius=1200.000000
00150	     MomentumTransfer=80000.000000
00151	     MyDamageType=Class'XIII.DTGrenaded'
00152	     ExplosionDecal=Class'XIII.GrenadBlast'
00153	     bBlockActors=True
00154	     bFixedRotationDir=True
00155	     Physics=PHYS_Falling
00156	     DrawType=DT_StaticMesh
00157	     LifeSpan=7.000000
00158	     SaturationDistance=600.000000
00159	     StabilisationDistance=3500.000000
00160	     StabilisationVolume=-10.000000
00161	}

End Source Code