| Config/script.js | this.name			= "Welcome Information Script"; 
this.author			= "Thargoid"; 
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description	= "Expanded information when you witchspace jump into a system."; 
this.version		= "1.13"; 
/* this.logging, this.audio, this.extraA and this.extraB are for compatability with OXPConfig.oxp.
	this.logging - Sends arrival location to stderr.txt and JSConsole (off by default).
	this.audio - Switch between console and comms messaging (on (comms) by default).
	this.extraA - General system information (on by default).
	this.extraB - System safety information (on by default).
	Set the default values up below:
*/
this.logging = false;
this.audio = true;
this.extraA = true;
this.extraB = true;
this.oxpcSettings = {
	Info: {Name:this.name,Display:this.name,InfoB:"1 - If false suppresses the general system information.\n2 - If false suppresses system safety information.\n3 - If true, log arrival locations to the console and latest.log.\n4 - If true send messages to the ships comms system, if false to the console instead."},
	Bool0: {Name:"extraA",Def:true,Desc:"General system information displayed."},
	Bool1: {Name:"extraB",Def:true,Desc:"System safety information displayed."},
	Bool2: {Name:"logging",Def:false,Desc:"Send arrival locations."},
	Bool3: {Name:"audio",Def:true,Desc:"Switch output to comms or console messaging"}
};
this.shipLaunchedFromStation = function() 
	{	
	missionVariables.welcomeLogging = this.logging;
	missionVariables.welcomeAudio = this.audio;
	missionVariables.welcomeExtraA = this.extraA;
	missionVariables.welcomeExtraB = this.extraB;
	if(this.welcomeTimer)
		{ this.welcomeTimer.start(); }
	else
		{ this.welcomeTimer = new Timer(this, this.checkForBuoy, 30, 30); }
	}
this.shipWillDockWithStation = function(station)
	{	
	missionVariables.welcomeLogging = this.logging;
	missionVariables.welcomeAudio = this.audio;
	missionVariables.welcomeExtraA = this.extraA;
	missionVariables.welcomeExtraB = this.extraB;
	this.welcomeTimer.stop();
	}
this.shipExitedWitchspace = function() 
	{
	if(system.isInterstellarSpace) { return; }
	
	if(player.ship.equipmentStatus("EQ_WELCOME_MAT") != "EQUIPMENT_OK")
		{
		player.consoleMessage("Please lock onto the beacon to initiate data connection.", 6);
		if(this.welcomeTimer)
			{ this.welcomeTimer.start(); }
		else
			{ this.welcomeTimer = new Timer(this, this.checkForBuoy, 30, 30); }
		}
	else
		{ this.displayMessage(); }	
	}
this.checkForBuoy = function()
	{
	if(player.ship.target && system.entitiesWithScanClass("CLASS_BUOY", player.ship, 25600).length) // check player has equipment and a buoy is on the scanner
		{
		if(player.ship.target.scanClass == "CLASS_BUOY" && player.ship.target.isBeacon && !player.ship.target.hasRole("welcomeMat_suppress")) 
			{ this.displayMessage(); }
		}
	}
this.displayMessage = function()
	{
	if(!system.isInterstellarSpace)
		{ 
		this.pirateCount = system.shipsWithPrimaryRole("pirate").length; // how many ships in the system which have a role of pirate
		this.policeCount = system.entitiesWithScanClass("CLASS_POLICE").length + system.entitiesWithScanClass("CLASS_MILITARY").length; // how many ships with scanClass police or military
		this.thargoidCount = system.entitiesWithScanClass("CLASS_THARGOID").length; // how many ships in the system with Thargoid scanclass
		this.systemSafety = ((this.pirateCount + this.thargoidCount) - this.policeCount); // the balance between pirate/Thargoid and police/military ships.
		if(this.logging)
			{
			log("Player in galaxy " + (galaxyNumber+1) + " at " + system.name + " (" + system.ID + ").");
			log("Pirate count - " + this.pirateCount); 
			log("Police count - " + this.policeCount); 
			log("Thargoid count - " + this.thargoidCount); 
			log("System safety figure - " + this.systemSafety);
			} 
		if(this.audio) // messages via commsMessage
			{
			if(this.extraA) 
				{ // display the information to the comms system, after the in-built system name message.
				player.commsMessage("Government - " + system.governmentDescription + ".", 6);
				player.commsMessage("Tech level - " + (system.techLevel + 1) + ".", 6); 
				player.commsMessage("Economy - " + system.economyDescription + ".", 6); 
				} 
			if(this.extraB)
				{
				if(this.systemSafety > 5) 
					{ // if there are significantly more pirates/Thargoids than police/military
					player.commsMessage("Beware, significant pirate activity has been reported in this system!", 6); 
					} 
				else
					{
					if(this.systemSafety < -5) 
						{ // if there are significantly less pirates/Thargoids than police/military
						player.commsMessage("This system has a strong police presence.", 6); 
						}
					else
						{ // if system is balanced between police/military and pirates/Thargoids
						player.commsMessage("No reports of major pirate activity.", 6);
						}
					}
				if(this.thargoidCount == 1) {player.commsMessage ("Alien vessel reported in system.", 6); };
				if(this.thargoidCount > 1) {player.commsMessage ("Alien vessels reported in system.", 6); };
				if(system.sun.isGoingNova) {player.commsMessage("The sun is going nova! Get out now!", 6); };
				}
			}
			else // messages via consoleMessage
			{
			if(this.extraA) 
				{ // display the information to the console system, after the in-built system name message.
				player.consoleMessage("Government - " + system.governmentDescription + ".", 6);
				player.consoleMessage("Tech level - " + (system.techLevel + 1) + ".", 6); 
				player.consoleMessage("Economy - " + system.economyDescription + ".", 6); 
				} 
			if(this.extraB)
				{
				if(this.systemSafety > 5) 
					{ // if there are significantly more pirates/Thargoids than police/military
					player.consoleMessage("Beware, significant pirate activity has been reported in this system!", 6); 
					} 
				else
					{
					if(this.systemSafety < -5) 
						{ // if there are significantly less pirates/Thargoids than police/military
						player.consoleMessage("This system has a strong police presence.", 6); 
						}
						else
						{ // if system is balanced between police/military and pirates/Thargoids
						player.consoleMessage("No reports of major pirate activity.", 6);
						}
					}
				if(this.thargoidCount == 1) {player.consoleMessage ("Alien vessel reported in system.", 6); }; 
				if(this.thargoidCount > 1) {player.consoleMessage ("Alien vessels reported in system.", 6); }; 
				if(system.sun.isGoingNova) {player.consoleMessage("The sun is going nova! Get out now!", 6); }; 	
				}
			}
		}
	else
		{ if(this.logging) {log("Player in interstellar space"); }; }
	}  |