Scripts/griff_spawn_sparks.js |
"use strict";
this.name = "griff_spawn_sparks";
this.author = "Thargoid";
this.copyright = "� 2008 the Oolite team.";
this.description = "Break-up of griff wreckage into a tiny spark cluster";
this.version = "1.0";
this.shipSpawned = function ()
{
// Put here your code for when a ship is created
this.ship.velocity = new Vector3D.random(50.0 + Math.random( ) * 50.0)
};
this.shipDied = function()
{
if(!this.ship || (player.ship.isValid && this.ship.position.distanceTo(player.ship.position) > 50000)) return; // exit the script if the explosion happens far from the player
this.tinysparkCount = (Math.ceil(Math.random() * 8) + 2); // between 2-10 tiny spark fragments
this.ship.spawn("griffspark", this.tinysparkCount); // spawn the tiny spark fragments
}
|
Scripts/griff_spawn_wreckage.js |
"use strict";
this.name = "griff_spawn_wreckage";
this.author = "Thargoid";
this.copyright = "� 2008 the Oolite team.";
this.description = "Spawn wreckage and sparks from dead ship";
this.version = "1.1";
this.shipDied = function() // event that occurs when the entity (ship) whose script this is dies
{
if(!this.ship || (player.ship.isValid && this.ship.position.distanceTo(player.ship.position) > 50000)) return; // exit the script if the explosion happens far from the player
this.largeCount = (Math.ceil(Math.random() * 4)); // between 0-4 pieces of wreckage
this.tinyCount = (Math.ceil(Math.random() * 10) + 5); // between 5-10 tiny spark fragments
this.sparkCount = (Math.ceil(Math.random() * 20) + 10); // between 10-20 spin spark fragments
this.ship.spawn("griffspark", this.tinyCount); // spawn the tiny spark fragments
if(this.largeCount > 0) // if there is large wreckage
{
this.ship.spawn("griffwreckage", this.largeCount); // spawn the larger wreckage
this.ship.spawn("spinspark", this.sparkCount); // spawn the spin sparks
}
} |