1. datablock ProjectileData(PlaneProjectile : RocketLauncherProjectile)
  2. {
  3.    projectileShapeName = "art/shapes/plane/Mooney_flying.dts";
  4.    directDamage = 10;
  5.    radiusDamage = 10;
  6.    damageRadius = 20;
  7.    areaImpulse = 2500;
  8.  
  9.    muzzleVelocity = 15; // 5000ms / 250m/s = 2s
  10.    velInheritFactor = 0.3;
  11.  
  12.    armingDelay = 0;
  13.    lifetime = 9250; //(500m / 100m/s = 5000ms)
  14.    fadeDelay = 9000;
  15.  
  16.    bounceElasticity = 0;
  17.    bounceFriction = 0;
  18.    isBallistic = false;
  19.    gravityMod = 0.80;
  20. };
  21.  
  22. function LaunchPlane()  
  23. {  
  24.       // first lets make sure the crashed plane isnt visible
  25.       crashed_plane.isRenderEnabled = false;
  26.          
  27.       // starting location
  28.       %start_pos = "-600 502 301"; // xyz
  29.       %vec = "6.0044 -4.888 -0.949 0"; // heading
  30.  
  31.       %muzzleVelocity = VectorScale(%vec, 15);
  32.      
  33.       // Create the projectile object
  34.       %p = new (Projectile)()
  35.       {
  36.          dataBlock = "PlaneProjectile"; //%this.projectile;
  37.          initialVelocity = %muzzleVelocity;
  38.          initialPosition = %start_pos;
  39.       };
  40.  
  41.       MissionCleanup.add(%p);
  42.       setCameraTrackObject(%p); //GS
  43. }
  44.  
  45.  
  46. function PlaneProjectile::onCollision(%this, %obj, %col)
  47. {
  48.    // Apply health to colliding object if it needs it.
  49.    // Works for all shapebase objects.
  50.    echo("plane onCollision detected");
  51.    schedule(10, 0, "makePlaneAppear");
  52.    serverPlay3D(PlaneProjExplosionSound, crashed_plane.getTransform() );  
  53. }
  54.  
  55. function makePlaneAppear()
  56. {
  57.    // Spawn smoke
  58.    %smoke = new ParticleEmitterNode()
  59.    {
  60.       emitter =  SmokeEmitter;
  61.       velocity = 1;
  62.       position = "0.3 15 206";
  63.       rotation = "0 0 0";
  64.       datablock = SmokeEmitterNode;
  65.       sizes[0] = "1.99902";
  66.       sizes[1] = "7.99915";
  67.       sizes[2] = "3.99805";
  68.       times[1] = "0.392157";
  69.       times[2] = "1";
  70.       times[3] = "1";      
  71.    };
  72.  
  73.    MissionCleanup.add(%smoke);    
  74.    
  75.     crashed_plane.isRenderEnabled = true;
  76.    
  77.     // move player to starting location
  78.      if ( isFunction( "movePlayer" ) )
  79.       schedule(50, 0, "movePlayer");
  80.  
  81.     // return to FPS camera
  82.      setFirstPerson();  
  83. }
  84.  
  85. function movePlayer(%client)
  86. {  
  87.    %newPos = "-0.93 25.9 203.7";
  88.    setPlayerPosition(%newPos); //"1.7949 13.6474 207.419");
  89.    
  90.    // drop player to ground
  91.    %obj = LocalClientConnection.player;
  92.    if (isObject(%obj))
  93.       %obj.setActionThread("death1");
  94.    else
  95.       echo("player object not found");
  96.    
  97.    // return to FPS camera
  98.    setFirstPerson();
  99.    
  100.    // make sure player ends up on the ground
  101.    %obj.setActionThread("death1");
  102.    
  103.    // initiate the survival checks
  104.    levelTick();  
  105. }