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

Expansion Tracker Cam

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description A deployable camera which links to your ships external view monitor and trackers the ships movements. A deployable camera which links to your ships external view monitor and trackers the ships movements.
Identifier oolite.oxp.Thargoid.TrackerCam oolite.oxp.Thargoid.TrackerCam
Title Tracker Cam Tracker Cam
Category Equipment Equipment
Author Thargoid Thargoid
Version 1.02 1.02
Tags equipment equipment
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/TrackerCam_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/7/70/TrackerCam_1.02.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 1610873333

Documentation

Also read http://wiki.alioth.net/index.php/Tracker%20Cam

TrackerCam v1.02 ReadMe & License.txt

TrackerCam OXP by Thargoid (with bits from Cim).

A little OXP which provides tracking camera satellites and a ship-to-satellite communications link. Both are available from tech 3+ equipment centres for the princely sum of 50 credits each.

The satellite cameras themselves are pylon mounted and deployed in the usual fashion (like a mine).

To use them, with a satellite within scanner range select the visual link on your primable equipment list ("shift-N" on normal key-configs) and then activate using the activation key (normally "n"). You can then access the camera view using the ships external custom view screen (normally "v").

The satellite will maintain focus on the player ship,and continue to transmit whilst in range. If you go beyond this range then the camera will automatically self-destruct to prevent space-lane pollution. The cameras are designed to be disposable, and cannot be scooped or reused as they are too fragile. If you need to use normal external views whilst one is in range, simply deactivate the link again via "shift-N / n".

Not really designed for a serious in-game usage as general equipment, but more for making nice video clips for ooTube.

With great thanks to Cim for both adding the modifiable external views code to trunk and for writing the missile camera/camera drones OXPs which inspired this one.

This OXP requires a minimum of Oolite v1.77 to run, and will not work with 1.76.1 or lower.

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

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 "TrackerCam 1.02.oxp" to the AddOns directory of your Oolite installation.  

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

Version history:

16/11/2012 - Version 1.00, Initial release.
23/11/2012 - Version 1.01, New positioning/orientation scripting to remove barrel-roll effect
25/11/2012 - Version 1.02, Script optimisation to use Cim's new quaternion conjugate trunk command. Needs trunk 5529 or above.

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

Acknowledgements:

With thanks to Cim for the customisable external views trunk code and for the camera OXPs which inspired this one.

Equipment

Name Visible Cost [deci-credits] Tech-Level
Tracker Camera Link yes 500 3+
Tracker Camera yes 500 3+

Ships

Name
Tracker Camera

Models

This expansion declares no models.

Scripts

Path
Scripts/trackerCam_cameraScript.js
this.name					= "trackerCam_cameraScript";
this.author					= "Thargoid, with inspiration from code by Cim";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Ship script for tracking camera";
this.version				= "1.02";

this.shipSpawned = function()
	{
	if(player.ship && player.ship.isValid)	{ this.ship.orientation = player.ship.orientation; }
	}
	
this.shipDied = function()
	{ 
	if(this.$callback) { removeFrameCallback(this.$callback); }
	}

this.$toggleCamera = function()
	{
	if(this.$camActive === undefined || this.$camActive === "no")
		{ this.$activateCamera(); }
	else
		{ this.$deactivateCamera(); }
	}
	
this.$deactivateCamera = function() 
	{
	this.$camActive = "no";
	this.$resetView();
	removeFrameCallback(this.$callback);
	delete this.$callback;
	player.consoleMessage("Tracking camera link deactivated");
	}

this.$activateCamera = function() 
	{
	this.$callback = addFrameCallback(this.$rotateCamera.bind(this));
	this.$camActive = "yes";
	player.consoleMessage("Tracking camera linked to custom view screen");
	}	
	
this.$resetView = function() 
	{ 
	if(player.ship.viewDirection === "VIEW_CUSTOM")
		{ player.ship.resetCustomView(); }	
	}
	
this.$rotateCamera = function() 
	{
	if(!this.ship || !this.ship.isValid || !player.ship || !player.ship.isValid) 
		{ 
		this.$resetView();
		return; 
		}

	if(this.ship.position.distanceTo(player.ship.position) > 25600)
		{ 
		this.ship.remove();
		this.$resetView();
		return; 
		}
	
	// re-orient the camera entity to always point at the player ship (for visual reasons)
	var targetVector = player.ship.position.subtract(this.ship.position).direction();
	var angle = this.ship.heading.angleTo(targetVector);
	var cross = this.ship.heading.cross(targetVector).direction();
	this.ship.orientation = this.ship.orientation.rotate(cross,-angle);	

	var transpose = player.ship.orientation.conjugate();
	
	var pos = this.ship.position.add(this.ship.vectorForward.multiply(15));
	pos = pos.subtract(player.ship.position); 
	// vector from the player ship to the viewpoint, 15m in front of the camera
	
	var posipcc = pos.rotateBy(transpose);
	var quat = this.ship.orientation.multiply(transpose);
	
	if(player.ship.viewDirection === "VIEW_CUSTOM")
		{ player.ship.setCustomView(posipcc, quat, "FORWARD"); }
	}	
Scripts/trackerCam_trigger.js
this.name					= "trackerCam_trigger";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Equipment script for tracking camera";
this.version				= "1.00";

this.activated = function() 
	{
	function allCameras(entity) {return entity.isShip && entity.hasRole("EQ_TRACKERCAM_MINE")}; 
	var localCameras = system.filteredEntities(this, allCameras, player.ship, 25600);
	
	if(localCameras && localCameras.length > 0)
		{ localCameras[0].script.$toggleCamera(); }
	else
		{ player.consoleMessage("No tracker camera in range"); }
	}

this.equipmentDamaged = function(equip) 
	{
	if (equip == "EQ_TRACKERCAM_LINK") 
		{ player.ship.setEquipmentStatus("EQ_TRACKERCAM_LINK","EQUIPMENT_OK"); }
	}