Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion Neo-Docklights

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds a row of lights to the system main station to aid approach and docking. These change colour depending whether the approach is clear or not. Adds a row of lights to the system main station to aid approach and docking. These change colour depending whether the approach is clear or not.
Identifier oolite.oxp.Thargoid.Neo-Docklights oolite.oxp.Thargoid.Neo-Docklights
Title Neo-Docklights Neo-Docklights
Category Equipment Equipment
Author Thargoid Thargoid
Version 1.00 1.00
Tags station, equipment station, equipment
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Neo-Docklights_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/0/00/Neo-DockLights_1.00.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 1610873209

Documentation

Also read http://wiki.alioth.net/index.php/Neo-Docklights

Neo-DockLights v1.00 Readme & License.txt

Neo-Docklights OXP by Thargoid.

A little OXP, inspired by a suggestion by Disembodied. It adds a trail of docking lights in front of the system main station in systems of tech level 3 and over. These are usually green, but turn red if the ship is about to launch or dock (basically if a ship will launch or is in the launch corridor, they will be red).

Designed as an aid for new players to help with docking - just line up on the lights and follow them in whilst matching the station rotation. You can fly through them without any risk.

It should also be noted that for most ships (trunk and OXP) the players view position is not along the central line of the ship (in the up/down direction). Hence you may need to allow for this when lining up for docking. Try to aim the centre-line of your ship through the trail, rather than the centre of your forward view for best effect.

This OXP is an evolution of the old DockLights OXP, and uses Cim's new visual effects class. Thus it requires Oolite version 1.77 or above to work.

--------------------------------------------------------------
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.
* 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.
* 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 "Neo-Docklights 1.00.oxp" to the AddOns directory of your Oolite installation. 

--------------------------------------------------------------
Version history:

08/01/2013 - First release, version 1.00

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

Acknowledgements:

With thanks to Disembodied for the suggestion, and various forum members for work and ideas on the issues that this OXP seems to be exposing.

And for the revision of to Neo Docklights, to Cim for his work on the visual effects new code in Oolite 1.77, and for being so patient with my suggestions and requests for features etc.

Equipment

This expansion declares no equipment.

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Config/script.js
this.name           = "neoDockLights_worldScript.js";
this.author         = "Thargoid";
this.copyright      = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description    = "World script for the new dock lights OXP";
this.version        = "0.10";
"use strict";

this.shipWillLaunchFromStation = function(station)
	{ if(station.isMainStation) { this.shipEnteredStationAegis(); } }	
	
this.shipWillDockWithStation = function(station)
	{ if(station.isMainStation) { this.shipDied(); } }	

this.shipEnteredStationAegis = function()
	{
	if(system.isInterstellarSpace || !system.mainStation || !system.mainStation.isValid || system.techLevel < 2)
		{ return; }
	
	this.lightsPosition = system.mainStation.position.add(system.mainStation.vectorForward.multiply(10000));
	this.lights = system.addVisualEffect("dockLights_green", this.lightsPosition);
	this.lights.orientation = system.mainStation.orientation;
	this.lightsStatus = "GREEN";
	
	this.lightsTimer = new Timer(this, this.setLights, 0, 0.25);
	}

this.setLights = function()
	{
	if(!system.mainStation) 
		{
		this.shipDied();
		return; 
		}
	
	function dockingShips(entity) {return entity.isShip && !entity.hasRole("buoy") && ((entity.position.distanceTo(system.mainStation.position) + entity.position.distanceTo(this.lights.position)) < 10100)}
	var incomingArray = system.filteredEntities(this, dockingShips, system.mainStation, 10000);

	this.lightsPosition = system.mainStation.position.add(system.mainStation.vectorForward.multiply(10000));
	
	if(incomingArray.length > 0 && this.lightsStatus === "GREEN")
		{ 
		this.removeLights();
		this.lights = system.addVisualEffect("dockLights_red", this.lightsPosition);	
		this.lights.orientation = system.mainStation.orientation;
		this.lightsStatus = "RED";		
		return;
		}
		
	if(incomingArray.length === 0 && this.lightsStatus === "RED")
		{ 
		this.removeLights();
		this.lights = system.addVisualEffect("dockLights_green", this.lightsPosition);
		this.lights.orientation = system.mainStation.orientation;
		this.lightsStatus = "GREEN";
		return;
		}
	}
	
this.shipDied = this.shipWillEnterWitchspace =  this.shipExitedStationAegis = function()
	{
	this.removeLights();
	if(this.lightsTimer) 
		{
		this.lightsTimer.stop();
		delete this.lightsTimer;
		}
	}	
	
this.removeLights = function()
	{
	var count = system.allVisualEffects.length;
	if(count === 0) { return; }
	for (var i=count-1; i>=0; i--)
		{
		if(system.allVisualEffects[i].dataKey === "dockLights_green" || system.allVisualEffects[i].dataKey === "dockLights_red")
			{ system.allVisualEffects[i].remove(); }
		}
	}