Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Ring Racer

Content

Warnings

  1. Found XML equipment list

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Corporate Systems Ring Racer league in Galaxy 1. Corporate Systems Ring Racer league in Galaxy 1.
Identifier oolite.oxp.Thargoid.RingRacer oolite.oxp.Thargoid.RingRacer
Title Ring Racer Ring Racer
Category Activities Activities
Author Thargoid Thargoid
Version 1.21 1.21
Tags activities, system activities, system
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Ring_Racer_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/c/ce/Ring_Racer_1.21.oxz n/a
License Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file
File Size n/a
Upload date 1610873475

Documentation

Also read http://wiki.alioth.net/index.php/Ring%20Racer

RingRacer v1.21 ReadMe & License.txt

Ring Racer OXP by Thargoid.

Welcome one and all to the Corporate States Ring Racer League!

This OXP adds a new sub-game to Oolite v1.74 or later, that of ring racing. Entry is available at any Corporate State system in Galaxy 1 for commanders with a suitably sporty ship equipped with an Advanced Space Compass and Fuel Injectors. 

Once the entrance fee is paid and a license obtained, the Ring Racer courses become available. The first race is in the Zaonce system, and there are 9 other courses spread around the galaxy. The location of the next one is updated on the ships manifest screen (F5-F5) once a course is completed, and is also marked on the ships long range chart. The racers fastest course time is also noted on the manifest screen, so Commanders can have best bragging rights at their favourite space bar.

To attempt a course, once the license is bought and you have flown to the correct system, you must fly to the course. This is marked by a buoy with a beacon "Q" on the ASC, and is normally found out beyond the witchpoint in the opposite direction to the main planet of the system. 
For variation there are two types of race. The first is a standard linear race, with the rings in a rough line leading on from the course buoy. The second is a sphere race, where all 10 rings can be found within a 20km radius sphere of the buoy. In both cases the course consists of 10 rings, which can be flown through in any order. The timer begins when you fly through the first ring, and ends once all 10 rings have been successfully navigated. Each race can last up to a maximum of 15 minutes.

Active rings are marked by green flashing lights and show with a green and yellow marker on the ships scanner. Once the ring has been successfully traversed the flashers turn red, and the scanner marker goes yellow.

Happy racing Commander!

--------------------------------------------------------------

License:

This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with the following clauses:

* Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP, the usage must be distinct from that within this OXP. Unique identifiers such as (but not limited to) unique shipdata.plist entity keys, mission variables, script names (this.name), equipment identity strings (EQ_), description list arrays and entity roles must not be re-used without prior agreement. Basically if it's unique or would identify or overwrite anything in the original OXP, then you may not re-use it (for obvious compatibility reasons).
* rebundling of this OXP within another distribution is permitted as long as it is unchanged. The following derivates however are permitted and except from the above:
	* the conversion of files between XML and openStep.
	* the merging of files with other files of the same type from other OXPs.
* The license information (either as this file or merged into a larger one) must be included in the OXP.
* Even though it is not compulsory, if you are re-using any sizable or recognisable piece of this OXP, please let me know :)

--------------------------------------------------------------
Instructions:

Unzip the file, and then move the folder "RingRacer v1.21.oxp" to the AddOns directory of your Oolite installation. 
Then start the game up and the racing league should be added. 

--------------------------------------------------------------

Version history:

08/02/2009 - Version 1.00, Initial release.
08/02/2009 - Version 1.01, moved first race from Leesti to Zaonce to prevent clashes with Asteroid Storm OXP.
01/09/2009 - Version 1.10, update for Oolite 1.73. Also due to the credit crunch and team budget limits, the entry fee is now only 2000 cr.
14/04/2010 - Version 1.20, update for v1.74. Now no longer compatible with lower versions.
13/02/2011 - Version 1.21, removal of upper limit, to allow running with 1.75

--------------------------------------------------------------

Acknowledgements:

This OXP is an update of the original RingPods OXP by Aegidian.

Equipment

Name Visible Cost [deci-credits] Tech-Level
Ring Racer League Entry yes 20000 1+

Ships

Name
Ring Racer Course Buoy
Racing Course Ring
ringRacer_greenRing
ringRacer_redRing

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/ringRacer_greenRingScript.js
this.name					= "ringRacer_ringScript";
this.author					= "Thargoid";
this.copyright				= "Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme.txt.";
this.description			= "Script for racing ring";
this.version				= "1.20";

this.shipSpawned = function()
	{ // lets randomise the ring's orientation
	this.newW = (Math.random()*2)-1; // a value between -1 and 1 for each component
	this.newX = (Math.random()*2)-1;
	this.newY = (Math.random()*2)-1;
	this.newZ = (Math.random()*2)-1;
	this.newOrientation = new Quaternion(this.newW, this.newX, this.newY, this.newZ);
	this.ship.orientation = this.newOrientation; 
	}

this.ringSwap = function()
	{
	this.ringPosition = this.ship.position;
	this.ringOrientation = this.ship.orientation;
	let redRing = this.ship.spawnOne("ringRacer_redRing");
	this.ship.remove();
	redRing.position = this.ringPosition;
	redRing.orientation = this.ringOrientation;
	}
Scripts/ringRacer_systemScript.js
this.name					= "RingRacer";
this.author					= "Thargoid";
this.copyright				= "Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme.txt.";
this.description			= "Script for setting up Ring Racer Courses and running them.";
this.version				= "1.20";

this.startUp = function()
	{
	if(missionVariables.ringRacer == null)
		{ missionVariables.ringRacer = 0; }
	if(missionVariables.ringRacer_location == null)
		{ missionVariables.ringRacer_location = 0; }
	if(missionVariables.ringRacer_raceCounter == null)
		{ missionVariables.ringRacer_raceCounter = 0; }
	if(missionVariables.ringRacer_bestTimeM == null)
		{ missionVariables.ringRacer_bestTimeM = 0; }
	if(missionVariables.ringRacer_bestTimeS == null)
		{ missionVariables.ringRacer_bestTimeS = 0; }
	this.courseLocations = [129, 178, 151, 65, 87, 119, 33, 72, 168, 104];
	this.racing = false;
	}

this.playerBoughtEquipment = function(equipment)
	{
	if(equipment == "EQ_RINGRACER")
		{
		player.ship.removeEquipment("EQ_RINGRACER");
		missionVariables.ringRacer = 1;
		mission.markSystem(this.courseLocations[0]);
		mission.setInstructionsKey("RingRacer_" + this.courseLocations[0]);
		mission.runScreen({title:"Ring Racer League", messageKey:"ringRacer_infoScreen", model:"ringRacer_greenRing"});
		}
	}

this.shipWillExitWitchspace = this.shipLaunchedFromStation = function()
	{
	if(!missionVariables.ringRacer == 1) // if the ring racer pass hasn't been purchased
		{return;}

	this.raceLocation = this.courseLocations[missionVariables.ringRacer_raceCounter];
	if(galaxyNumber == 0 && system.ID == this.raceLocation)
		{
		if(system.countShipsWithRole("ringRacer_greenRing") == 0) // if the course isn't there yet
			{
			player.commsMessage("Welcome Ring Racer! Follow Q on your compass to the course.", 6);
			switch(this.raceLocation)
				{
				case 178:
				case 119:
				case 168:
					{	// sphere race
					log("Ring Racer", "Sphere race started near " + system.name);
					system.legacy_addShipsAtPrecisely("ringRacer_courseBuoy", 1, "abs", [0, 0, -50000]);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 10, "abs", [0, 0, -50000], 20000);
					this.startRace();
					break;
					}

				case 129: 
				case 151:
				case 65:
				case 87:
				case 33:
				case 72:
				case 104:
					{	// linear race
					log("Ring Racer", "Linear race started near " + system.name);
					system.legacy_addShipsAtPrecisely("ringRacer_courseBuoy", 1, "abs", [0, 0, -40000]);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [0, 0, -60000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [0, 0, -80000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [0, 20000, -80000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [0, 40000, -80000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [20000, 40000, -80000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [40000, 40000, -80000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [50000, 40000, -90000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [50000, 50000, -100000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [60000, 60000, -100000], 2500);
					system.legacy_addShipsWithinRadius("ringRacer_greenRing", 1, "abs", [60000, 75000, -110000], 2500);
					this.startRace();
					break;
					}
				}
			}
		}
	}

this.startRace = function()
	{
	missionVariables.ringRacer_ringCount = 0; // reset the count for a new race
	this.startTime = 0; // reset the time

	if(worldScripts["Welcome Information Script"]) // if Welcome Mat is loaded & running, disable it to stop data messages with the course buoys
		{
		if(worldScripts["Welcome Information Script"].welcomeTimer.isRunning)
			{
			worldScripts["Welcome Information Script"].welcomeTimer.stop();
			player.consoleMessage("Planetary Information System deactivated.",6);
			}
		}

	if(this.raceTimer)
		{
		this.raceTimer.start();
		}
	else
		{
		this.raceTimer = new Timer(this, this.raceCheck, 0, 1);
		}
	}

this.raceCheck = function()
	{
	if(missionVariables.ringRacer_ringCount == 1 && this.startTime == 0)
		{
		this.startTime = clock.absoluteSeconds;
		player.commsMessage("Ring race clock started.", 6);
		this.racing = true;
		}

	if(missionVariables.ringRacer_ringCount == 10) // if we're at the end of the race, having done all 10 rings
		{
		this.raceTimer.stop();
		this.raceEnd();
		}

	this.raceElapsedTime = Math.floor(clock.absoluteSeconds - this.startTime); // absolute time since the race began
	if(this.racing && this.raceElapsedTime > 900) // if we've been racing for over 15 minutes
		{
		player.commsMessage("Race time limit exceeded, clock stopped.",6);
		this.raceTimer.stop();
		missionVariables.ringRacer_ringCount = 0;
		}

	}

this.raceEnd = function()
	{
	this.racing = false;
	this.endTime = clock.absoluteSeconds;
	player.commsMessage("Ring race clock stopped.", 6);
	missionVariables.ringRacer_ringCount = 0;
	this.raceTime = Math.floor(this.endTime - this.startTime);
	this.raceTimeMinutes = Math.floor(this.raceTime / 60);
	this.raceTimeSeconds = this.raceTime - (60 * this.raceTimeMinutes);
	player.commsMessage("You completed the race in " + this.raceTimeMinutes + "m " + this.raceTimeSeconds + "s.", 6);
	this.bestTime = (missionVariables.ringRacer_bestTimeM * 60) + missionVariables.ringRacer_bestTimeS;

	if(this.bestTime == 0 && this.raceTime > 0)
		{
		player.commsMessage("We have registered your new best time.", 6);
		missionVariables.ringRacer_bestTimeM = this.raceTimeMinutes;
		missionVariables.ringRacer_bestTimeS = this.raceTimeSeconds;
		}

	if(this.bestTime > this.raceTime)
		{
		player.commsMessage("Congratulations, you've improved your best time!", 6);
		missionVariables.ringRacer_bestTimeM = this.raceTimeMinutes;
		missionVariables.ringRacer_bestTimeS = this.raceTimeSeconds;		
		}

	mission.unmarkSystem(this.courseLocations[missionVariables.ringRacer_raceCounter]);
	mission.setInstructionsKey(null);

	if(worldScripts["Welcome Information Script"]) // if Welcome Mat has been disabled earlier, restart it
		{
		if(!worldScripts["Welcome Information Script"].welcomeTimer.isRunning)
			{
			worldScripts["Welcome Information Script"].welcomeTimer.start();
			player.consoleMessage("Planetary Information System restarted.",6);
			}
		}

	if(missionVariables.ringRacer_raceCounter == 9) // if all 10 races have been run
		{
		missionVariables.ringRacer = 0;
		missionVariables.ringRacer_raceCounter = 0;
		player.commsMessage("And that concludes the Ring Racing league for this season.", 10);
		player.commsMessage("Your best time for the season was " + missionVariables.ringRacer_bestTimeM + "m " + missionVariables.ringRacer_bestTimeS + "s.", 10); 
		return;
		}

	missionVariables.ringRacer_raceCounter += 1;
	mission.markSystem(this.courseLocations[missionVariables.ringRacer_raceCounter]);
	mission.setInstructionsKey("RingRacer_" + this.courseLocations[missionVariables.ringRacer_raceCounter]);
	}

this.shipDied = this.shipWillEnterWitchspace = this.shipWillDockWithStation = function()
	{
	if(missionVariables.ringRacer == 1)
		{
		this.racing = false;
		if(this.raceTimer)
			{
			this.raceTimer.stop();
			missionVariables.ringRacer_ringCount = 0;
			}

		this.courseList = system.shipsWithRole("ringRacer_ringCourse"); // find all course entities so we can remove them
		if(this.courseList.length > 0) // if there are parts of the course present, loop through them and remove
			{
			let loopCounter = 0; // reset the counter
			for(loopCounter = 0; loopCounter < this.courseList.length; loopCounter++)
				{
				this.courseList[loopCounter].remove();
				}
			}

			if(worldScripts["Welcome Information Script"]) // if Welcome Mat has been disabled earlier, restart it
				{
				if(!worldScripts["Welcome Information Script"].welcomeTimer.isRunning)
					{
					worldScripts["Welcome Information Script"].welcomeTimer.start();
					}
				}
		}
	}

this.playerEnteredNewGalaxy = function(galaxyNumber)
	{
	if(missionVariables.ringRacer == 1)
		{
		missionVariables.ringRacer = 0;
		missionVariables.ringRacer_raceCounter = 0;
		missionVariables.ringRacer_location = 0;
		missionVariables.ringRacer_bestTimeM = 0;
		missionVariables.ringRacer_bestTimeS = 0;
		this.racing = false;
		}
	}