datablock ProjectileData(PlaneProjectile : RocketLauncherProjectile)
{
projectileShapeName = "art/shapes/plane/Mooney_flying.dts";
directDamage = 10;
radiusDamage = 10;
damageRadius = 20;
areaImpulse = 2500;
muzzleVelocity = 15; // 5000ms / 250m/s = 2s
velInheritFactor = 0.3;
armingDelay = 0;
lifetime = 9250; //(500m / 100m/s = 5000ms)
fadeDelay = 9000;
bounceElasticity = 0;
bounceFriction = 0;
isBallistic = false;
gravityMod = 0.80;
};
function LaunchPlane()
{
// first lets make sure the crashed plane isnt visible
crashed_plane.isRenderEnabled = false;
// starting location
%start_pos = "-600 502 301"; // xyz
%vec = "6.0044 -4.888 -0.949 0"; // heading
%muzzleVelocity = VectorScale(%vec, 15);
// Create the projectile object
%p = new (Projectile)()
{
dataBlock = "PlaneProjectile"; //%this.projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %start_pos;
};
MissionCleanup.add(%p);
setCameraTrackObject(%p); //GS
}
function PlaneProjectile::onCollision(%this, %obj, %col)
{
// Apply health to colliding object if it needs it.
// Works for all shapebase objects.
echo("plane onCollision detected");
schedule(10, 0, "makePlaneAppear");
serverPlay3D(PlaneProjExplosionSound, crashed_plane.getTransform() );
}
function makePlaneAppear()
{
// Spawn smoke
%smoke = new ParticleEmitterNode()
{
emitter = SmokeEmitter;
velocity = 1;
position = "0.3 15 206";
rotation = "0 0 0";
datablock = SmokeEmitterNode;
sizes[0] = "1.99902";
sizes[1] = "7.99915";
sizes[2] = "3.99805";
times[1] = "0.392157";
times[2] = "1";
times[3] = "1";
};
MissionCleanup.add(%smoke);
crashed_plane.isRenderEnabled = true;
// move player to starting location
if ( isFunction( "movePlayer" ) )
schedule(50, 0, "movePlayer");
// return to FPS camera
setFirstPerson();
}
function movePlayer(%client)
{
%newPos = "-0.93 25.9 203.7";
setPlayerPosition(%newPos); //"1.7949 13.6474 207.419");
// drop player to ground
%obj = LocalClientConnection.player;
if (isObject(%obj))
%obj.setActionThread("death1");
else
echo("player object not found");
// return to FPS camera
setFirstPerson();
// make sure player ends up on the ground
%obj.setActionThread("death1");
// initiate the survival checks
levelTick();
}