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

Expansion Technical Reference Library

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Upgrade to Scanner Targetting Enhancement to show targeted ship's specs. Upgrade to Scanner Targetting Enhancement to show targeted ship's specs.
Identifier oolite.oxp.spara.TechnicalReferenceLibrary oolite.oxp.spara.TechnicalReferenceLibrary
Title Technical Reference Library Technical Reference Library
Category Equipments Equipments
Author Spara Spara
Version 1.0.1 1.0.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Technical_Reference_Library n/a
Download URL https://wiki.alioth.net/img_auth.php/8/82/TechnicalReferenceLibrary-1.0.1.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1610873349

Documentation

Also read http://wiki.alioth.net/index.php/Technical%20Reference%20Library

technical_reference_library_readme_&_license.txt

Technical Reference Library OXP ver 1.0.1 (23.3.2013)

Author: spara (Mika Spåra)

_The_Story_

Mrs Ming (Head of our marketing and fundraising department) from Spara, PrOog & Ming Agency had to pull lots of strings to get all the biggest ship manufacturers to give out technical specifications of their ships commonly seen in the space lines. Funnily, when the ball got rolling, manufacturers started to call us. We did not anticipate such a high level of interest. Suddenly every single company that had something to do with ships wanted to sponsor us. The deal we did with them was that Technical Reference Library will be a free bundle to every STE upgrade sold anywhere. The catch is, that every sponsor wants their name to be seen. That's the price for it to be free. We don't complain, as this liberated resources for Mr PrOog (Head of our R&D department) to develop an equipment that links Technical Reference Library to the hud. That piece how ever is not free as we were not ready to show sponsor messages in the hud. The price is set to a reasonable 1250 credits and the equipment is available from any TL12 system.

Mr Spara (CEO) is quite happy with the results of his team.

_Features_

* Free STE upgrade that will show information of spacecrafts via a primable equioment "Ship Identifier". (lock ident to a spacecraft, select the correct equipment with shift-n, activate with n or b)
* Boughtable equipment that will show the same information in the hud when activated. (lock ident to a spacecraft, select the correct equipment with shift-n, activate with n)

_Which_spacefraft_are_identified_

* Entities with scan classes "CLASS_NEUTRAL", "CLASS_MILITARY", "CLASS_POLICE" and "CLASS_THARGOID" are identified as spacecrafts.
* Entities with scan classes "CLASS_MILITARY", "CLASS_POLICE" and "CLASS_THARGOID" are not included in the Reference Library. Military and Police are thought to be classified information and Thargoid ships are not made by known shipmakers.
* In addition, Constrictor, ships from Aliens oxp, Black Monk Gunships, ships with the role bigTrader, Green Gecko and ships from Capisastra oxp are not included in the library.

_Information_for_oxp_makers_

* Ships with script info "classifiedShip = true" are not included in the library
* A ship can be declared classified from a script by calling worldScripts.tech_ref_lib.$addClassifiedRole("foo"), where "foo" is the special role of the ship.
* A ship can be declassified from a script by calling worldScripts.tech_ref_lib.$removeClassifiedRole("foo"), where "foo" is the special role of the ship.

_Requirements_

Oolite version 1.77.

_Credits_

* Technical drawings from Mandoman are used in the background graphics

_Installing_

Install the OXP by copying technical_reference_library.oxp to your AddOns-folder.

------

This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

Equipment

Name Visible Cost [deci-credits] Tech-Level
HUD Integration of Ship Identifier yes 12500 12+
Ship Identifier no 0 100+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/tech_ref_lib.js
"use strict";
this.name               = "tech_ref_lib";
this.author               = "spara";
this.copyright            = "2013 Mika Spåra";
this.description         = "Reveal technical information of a target";
this.version            = "1.0.1";
this.licence     = "CC BY-NC-SA 3.0";

//1.0.1 different method for naming unnamed ships. No more warnings in test build.

this.startUp = function() {
	//these are recognised as spacecraft
	this.$spaceCraftScanClasses = ["CLASS_NEUTRAL", "CLASS_MILITARY", "CLASS_POLICE", "CLASS_THARGOID"];
	//these are treated as classified spacecraft, only type (name property) will be shown
	this.$classifiedScanClasses = ["CLASS_MILITARY", "CLASS_POLICE", "CLASS_THARGOID"];
	this.$classifiedRoles = ["constrictor", "kephalan", "odonatean", "scorpax", "bigTrader", "monkpatrol", "griff_blackmonk_defenceship", "monkhit1", "monkhit2", "monkhold1", "monkhold2", "ev_green_gecko", "sin-pirate"];//classify constrictor, aliens oxp, bigTrader ships, black monks, green gecko oxp and capisastra oxp.
	if (player.ship.equipmentStatus("EQ_SCANNER_SHOW_MISSILE_TARGET") === "EQUIPMENT_OK")
		player.ship.awardEquipment("EQ_TECH_REF_LIB_BASE");
}

//interface for other scripts to add classified roles
this.$addClassifiedRole = function(role) {
	if (this.$classifiedRoles.indexOf(role) === -1)
		this.$classifiedRoles.push(role);
}

//interface for other scripts to remove classified roles
this.$removeClassifiedRole = function(role) {
	var index = this.$classifiedRoles.indexOf(role);
	if (index !== -1)
		this.$classifiedRoles.splice(index, 1);
}


//equipment activation n
this.activated = function() {
	//hud integration
	if (player.ship.equipmentStatus("EQ_TECH_REF_LIB") === "EQUIPMENT_OK")
		worldScripts.tech_ref_lib.$activated();
	//freebie version
	else worldScripts.tech_ref_lib.$showFreebie();
}

//equipment activation b
this.mode = function() {
	//freebie version
	worldScripts.tech_ref_lib.$showFreebie();
}

this.playerBoughtEquipment = this.equipmentRepaired = function(equipment) {
	if (equipment === "EQ_SCANNER_SHOW_MISSILE_TARGET")
		player.ship.awardEquipment("EQ_TECH_REF_LIB_BASE");
}

this.equipmentDestroyed = this.equipmentDamaged = function(equipment) {
	if (equipment === "EQ_SCANNER_SHOW_MISSILE_TARGET")
		player.ship.removeEquipment("EQ_TECH_REF_LIB_BASE");
}

//which crafts are included in the library
this.$validateTarget = function(target) {
	//check scanclasses
	if (this.$classifiedScanClasses.indexOf(target.scanClass) !== -1) return false;
	//check roles
	var targetRoles = target.roles;
	var i;
	for (i = 0; i < targetRoles.length; i++) {
		if (this.$classifiedRoles.indexOf(targetRoles[i]) !== -1) {
			return false;
		}
	}
	//check for script_info key
	if (target.scriptInfo.classifiedShip) return false;
	return true;
}

//check for ship image
this.$bgImage = function(name) {
	var names = ["Adder", "Anaconda", "Asp Mark II", "Boa", "Boa Class Cruiser", "Cobra Mark III", "Cobra Mark I", "Fer-de-Lance", "Gecko", "Krait", "Mamba", "Moray Star Boat", "Moray Medical Boat", "Python", "Orbital Shuttle", "Sidewinder Scout Ship", "Transporter", "Mining Transporter", "Worm"];
	var append = ["adder", "anaconda", "asp", "boa", "boacc", "cobramk3", "cobramk1", "ferdelance", "gecko", "krait", "mamba", "moray", "moray", "python", "shuttle", "sidewinder", "transporter", "transporter", "worm"];
	var index = names.indexOf(name);
	if (index !== -1) {
		return "ref_background_"+append[index]+".png";
	}
	else return "ref_background.png";
}

//specs to a mission screen
this.$showFreebie = function() {
	var target = player.ship.target;
	//no target
	if (!target) {
		player.consoleMessage("No target.");
		return;
	}
	//target is not a spacecraft
	if (this.$spaceCraftScanClasses.indexOf(target.scanClass) === -1) {
		player.consoleMessage("Target is not a spacecraft.");
		return;
	}
	//check if target is classified
	var targetValidated = this.$validateTarget(target);
	//special type recognition for random hits & anarchies
	var name = expandMissionText("trophy_"+target.dataKey);
	if (!name) name = target.name;
	//build up the message
	var message = "Specifications for '" + target.displayName+"':\n\n";
	if (!targetValidated)
		message += "No match found from the Reference\nLibrary, ship specifications unknown.";
	else {
		message += "* Type: " + name + "\n";
		message += "* Size (W × H × L): " +  Math.floor(target.boundingBox.x) + " m × " +  Math.floor(target.boundingBox.y) + " m × " +  Math.floor(target.boundingBox.z) + " m\n";
		message += "* Speed / Thrust: " + target.maxSpeed/1000 + " / " +target.maxThrust/1000 + " LM\n";
		message += "* Roll / Pitch: " + target.maxRoll.toFixed(1) +" / "+ target.maxPitch.toFixed(1) + "\n";			
		message += "* Cargo Capacity: " + target.cargoSpaceCapacity + " TC\n";
		message += "* Energy Banks: " + Math.floor(target.maxEnergy/64) + "\n";
		if (target.forwardWeapon || target.aftWeapon || target.portWeapon || target.starboardWeapon)
			message += "* Weapon Mounts: yes\n";
		else message += "* Weapon Mounts: no\n";
		message += "* Missile Slots: "+target.missileCapacity+"\n";
		if (target.hasHyperspaceMotor) message += "* Hyperspace Capable: yes";
		else message += "* Hyperspace Capable: no";
	}
	//show the message in a mission screen
	mission.runScreen({
		title: "Technical Reference Library of Common Ships",
		message: message,
		background: this.$bgImage(name),
		allowInterrupt: true
	});
}

//specs to the hud 
this.$activated = function() {	
	var target = player.ship.target;
	//no target
	if (!target) {
		player.consoleMessage("No target.");
		return;
	}
	//target is not a spacecraft
	if (this.$spaceCraftScanClasses.indexOf(target.scanClass) === -1) {
		player.consoleMessage("Target is not a spacecraft.");
		return;
	}
	//check if target is classified
	var targetValidated = this.$validateTarget(target);
	//special type recognition for random hits & anarchies
	var name = expandMissionText("trophy_"+target.dataKey);
	if (!name) name = target.name;
	//build up the message
	
	if (!targetValidated)
		var message = "Target specs unknown.";
	else {
		var message = "Type: " + name + "\n";
		message += "Size (W × H × L): " +  Math.floor(target.boundingBox.x) + " m × " +  Math.floor(target.boundingBox.y) + " m × " +  Math.floor(target.boundingBox.z) + " m\n";
		message += "Speed / Thrust: " + target.maxSpeed/1000 + " / " +target.maxThrust/1000 + " LM\n";
		message += "Roll / Pitch: " + target.maxRoll.toFixed(1) +" / "+ target.maxPitch.toFixed(1) + "\n";			
		message += "Cargo Capacity: " + target.cargoSpaceCapacity + " TC\n";
		message += "Energy Banks: " + Math.floor(target.maxEnergy/64) + "\n";
		if (target.forwardWeapon || target.aftWeapon || target.portWeapon || target.starboardWeapon)
			message += "Weapon Mounts: yes\n";
		else message += "Weapon Mounts: no\n";
		message += "Missile Slots: "+target.missileCapacity+"\n";
		if (target.hasHyperspaceMotor) message += "Hyperspace: yes";
		else message += "Hyperspace: no";
	}
	//show the message in the hud
	player.consoleMessage(message,10);
}