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

Expansion Laser Booster

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description A primeable turbo-charger for your lasers to overcharge them from your energy banks and make them more damaging. But adds a chance of them breaking on use. A primeable turbo-charger for your lasers to overcharge them from your energy banks and make them more damaging. But adds a chance of them breaking on use.
Identifier oolite.oxp.Thargoid.LaserBooster oolite.oxp.Thargoid.LaserBooster
Title Laser Booster Laser Booster
Category Equipment Equipment
Author Thargoid Thargoid
Version 1.02 1.02
Tags equipment, weapons equipment, weapons
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Laser_Booster_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/d/d9/Laser_Booster_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 1610873481

Documentation

Also read http://wiki.alioth.net/index.php/Laser%20Booster

Laser Booster v1.02 Readme.txt

Laser Booster OXP by Thargoid.

This is a small OXP introducing two new dynamics to play. Firstly it offers a switchable laser booster, which doubles the laser damage inflicted when activated (for a small energy drain).

However it also introduces breakable lasers - there is a base 1% chance of a laser breaking on use, with increased chance if the booster is brought into play and the lasers pushed beyond their specified heat tolerances.

If lasers do break they can be repaired either at the station equipment screen or by repair bots/systems.

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

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

08/01/2013 - Version 1.00 - First release
07/02/2013 - Version 1.01 - Added extra damage check to block main station damage to help prevent extra kill awards.
06/01/2014 - Version 1.02 - Fixed station check, so it checked station and not everything but station :) With thanks to xdsldouble for the report.

Equipment

Name Visible Cost [deci-credits] Tech-Level
Laser Booster yes 250000 13+
Aft Beam Laser yes 10000 100+
Forward Beam Laser yes 10000 100+
Port Beam Laser yes 10000 100+
Starboard Beam Laser yes 10000 100+
Aft Military Laser yes 60000 100+
Forward Military Laser yes 60000 100+
Port Military Laser yes 60000 100+
Starboard Military Laser yes 60000 100+
Aft Mining Laser yes 8000 100+
Forward Mining Laser yes 8000 100+
Port Mining Laser yes 8000 100+
Starboard Mining Laser yes 8000 100+
Aft Pulse Laser yes 4000 100+
Forward Pulse Laser yes 4000 100+
Port Pulse Laser yes 4000 100+
Starboard Pulse Laser yes 4000 100+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/laserBooster_activate.js
this.name					= "laserBooster_activate.js";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for manual activation of the laser booster";
this.version				= "1.02";

this.activated = function()
	{
	if(player.ship.equipmentStatus("EQ_LASERBOOSTER") !== "EQUIPMENT_OK")
		{ 
		missionVariables.laserBooster = "INACTIVE"; 
		return;
		}
	
	if(missionVariables.laserBooster && missionVariables.laserBooster === "ACTIVE")
		{ 
		missionVariables.laserBooster = "INACTIVE"; 
		player.consoleMessage("Laser Booster deactivated.");
		}
	else
		{
		if(worldScripts["laserBooster_worldScript.js"])
			{
			missionVariables.laserBooster = "ACTIVE"; 
			player.consoleMessage("Laser Booster activated.");
			} 
		else
			{
			player.consoleMessage("Laser Booster script error.");
			log(this.name, "Laser Booster script activation failed.");
			} 
		}
	}
Scripts/laserBooster_worldScript.js
this.name					= "laserBooster_worldScript.js";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for laser booster";
this.version				= "1.02";

this.startUp = function()
	{ 
	this.laserTemp = 2; 
	missionVariables.laserBooster = "INACTIVE"; 
	}

this.shipLaunchedFromStation = function()
	{
	missionVariables.laserBooster = "INACTIVE"; 
	this.callCount = 0;
	this.laserTemp = 2;
	this.findLaser();
	this.callbackID = addFrameCallback(this.checkTemp.bind(this));
	}

this.checkTemp = function()
	{
	this.callCount++;
	if(player.ship.laserHeatLevel > this.laserTemp && this.callCount >= 10)
		{
		this.callCount = 0;
		this.breakChance = 0.002;
		if(missionVariables.laserBooster === "ACTIVE") 
			{ this.breakChance += (player.ship.laserHeatLevel / 100); }
		if(Math.random() < this.breakChance) { this.breakLaser(); }
		}
	this.laserTemp = player.ship.laserHeatLevel;
	}

this.shipAttackedOther = function(other)
	{
	if(player.ship.equipmentStatus("EQ_LASERBOOSTER") !== "EQUIPMENT_OK" || missionVariables.laserBooster !== "ACTIVE" || this.laserString === "NONE" || !other || other.isMainStation || !other.isValid) { return; }
	
	this.findLaser();
	if(player.ship.energy > 64)
		{
		other.energy -= this.weaponDamage;
		player.ship.energy -= this.weaponDrain;
		}
	else
		{
		player.consoleMessage("Laser booster deactivated - energy low");
		missionVariables.laserBooster = "INACTIVE";
		}
	}
	
this.shipDied = this.shipDockedWithStation = this.stopCallback = function()
	{
	missionVariables.laserBooster = "INACTIVE";
	if(this.callbackID) 
		{ removeFrameCallback(this.callbackID); } 
	delete this.callbackID; 
	};
	
this.viewDirectionChanged = function(viewString)
	{ 
	this.laserTemp = 2; 
	this.findLaser();
	}	

this.equipmentDamaged = function(equipment)
	{
	if(equipment === "EQ_LASERBOOSTER") 
		{ 
		missionVariables.laserBooster = "INACTIVE";
		this.stopCallback(); 
		}
	}	

this.breakLaser = function()
	{
	player.consoleMessage("Laser failure detected!");
	player.ship.currentWeapon = null;					
	
	this.dummyLaser = "EQ_LBOOST_" + this.laserString + "_" + this.viewString;
	switch(this.laserString)
		{
		case "PULSE":
			{
			EquipmentInfo.infoForKey(this.dummyLaser).effectiveTechLevel = 3;
			break;
			}
		case "BEAM":
			{
			EquipmentInfo.infoForKey(this.dummyLaser).effectiveTechLevel = 4;
			break;
			}
		case "MILITARY":
		case "MINING":
			{
			EquipmentInfo.infoForKey(this.dummyLaser).effectiveTechLevel = 10;
			break;
			}
		}	
	player.ship.awardEquipment(this.dummyLaser);
	player.ship.setEquipmentStatus(this.dummyLaser, "EQUIPMENT_DAMAGED");
	this.laserString = "NONE";
	this.weaponDamage = 0;
	this.weaponDrain = 0;
	}
	
this.equipmentRepaired = function(equipment)
	{
	switch(equipment)
		{
		case "EQ_LBOOST_PULSE_FWD": // Forward pulse laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_PULSE_FWD").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_PULSE_FWD");
			player.ship.forwardWeapon = "EQ_WEAPON_PULSE_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_BEAM_FWD": // Forward beam laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_BEAM_FWD").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_BEAM_FWD");
			player.ship.forwardWeapon = "EQ_WEAPON_BEAM_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MINING_FWD": // Forward mining laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MINING_FWD").effectiveTechLevel = 99;			
			player.ship.removeEquipment("EQ_LBOOST_MINING_FWD");
			player.ship.forwardWeapon = "EQ_WEAPON_MINING_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MILITARY_FWD": // Forward military laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MILITARY_FWD").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MILITARY_FWD");
			player.ship.forwardWeapon = "EQ_WEAPON_MILITARY_LASER";
			this.callCount = 0;
			break;
			}

		case "EQ_LBOOST_PULSE_AFT": // Aft pulse laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_PULSE_AFT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_PULSE_AFT");
			player.ship.aftWeapon = "EQ_WEAPON_PULSE_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_BEAM_AFT": // Aft beam laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_BEAM_AFT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_BEAM_AFT");
			player.ship.aftWeapon = "EQ_WEAPON_BEAM_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MINING_AFT": // Aft mining laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MINING_AFT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MINING_AFT");
			player.ship.aftWeapon = "EQ_WEAPON_MINING_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MILITARY_AFT": // Aft military laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MILITARY_AFT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MILITARY_AFT");
			player.ship.aftWeapon = "EQ_WEAPON_MILITARY_LASER";
			this.callCount = 0;
			break;
			}			

		case "EQ_LBOOST_PULSE_PORT": // Port pulse laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_PULSE_PORT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_PULSE_PORT");
			player.ship.portWeapon = "EQ_WEAPON_PULSE_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_BEAM_PORT": // Port beam laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_BEAM_PORT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_BEAM_PORT");
			player.ship.portWeapon = "EQ_WEAPON_BEAM_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MINING_PORT": // Port mining laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MINING_PORT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MINING_PORT");
			player.ship.portWeapon = "EQ_WEAPON_MINING_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MILITARY_PORT": // Port military laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MILITARY_PORT").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MILITARY_PORT");
			player.ship.portWeapon = "EQ_WEAPON_MILITARY_LASER";
			this.callCount = 0;
			break;
			}
			
		case "EQ_LBOOST_PULSE_STAR": // Starboard pulse laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_PULSE_STAR").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_PULSE_STAR");
			player.ship.starboardWeapon = "EQ_WEAPON_PULSE_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_BEAM_STAR": // Starboard beam laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_BEAM_STAR").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_BEAM_STAR");
			player.ship.starboardWeapon = "EQ_WEAPON_BEAM_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MINING_STAR": // Starboard mining laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MINING_STAR").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MINING_STAR");
			player.ship.starboardWeapon = "EQ_WEAPON_MINING_LASER";
			this.callCount = 0;
			break;
			}
		case "EQ_LBOOST_MILITARY_STAR": // Starboard military laser
			{
			EquipmentInfo.infoForKey("EQ_LBOOST_MILITARY_STAR").effectiveTechLevel = 99;
			player.ship.removeEquipment("EQ_LBOOST_MILITARY_STAR");
			player.ship.starboardWeapon = "EQ_WEAPON_MILITARY_LASER";
			this.callCount = 0;
			break;
			}			
		}	
		
	this.findLaser();
	}

this.findLaser = function()
	{
	switch(player.ship.viewDirection)
		{
		case "VIEW_FORWARD":
		case "VIEW_CUSTOM":
			{
			if(player.ship.forwardWeapon !== "EQ_WEAPON_TWIN_PLASMA_CANNON" && player.ship.forwardWeapon !== null)
				{ this.laserString = player.ship.forwardWeapon.equipmentKey.split("_")[2]; }
			else
				{ this.laserString = "NONE"; }
			this.viewString = "FWD";
			break;
			}
		case "VIEW_AFT":
			{
			if(player.ship.aftWeapon !== "EQ_WEAPON_TWIN_PLASMA_CANNON" && player.ship.aftWeapon !== null)
				{ this.laserString = player.ship.aftWeapon.equipmentKey.split("_")[2]; }
			else
				{ this.laserString = "NONE"; }
			this.viewString = "AFT";
			break;
			}
		case "VIEW_PORT":
			{
			if(player.ship.portWeapon !== "EQ_WEAPON_TWIN_PLASMA_CANNON" && player.ship.portWeapon !== null)
				{ this.laserString = player.ship.portWeapon.equipmentKey.split("_")[2]; }
			else
				{ this.laserString = "NONE"; }
			this.viewString = "PORT";
			break;
			}
		case "VIEW_STARBOARD":
			{
			if(player.ship.starboardWeapon !== "EQ_WEAPON_TWIN_PLASMA_CANNON" && player.ship.starboardWeapon !== null)
				{ this.laserString = player.ship.starboardWeapon.equipmentKey.split("_")[2]; }
			else
				{ this.laserString = "NONE"; }
			this.viewString = "STAR";
			break;
			}		
		}	

	switch(this.laserString)
		{
		case "NONE":
			{
			this.weaponDamage = 0;
			this.weaponDrain = 0;
			break;
			}
		case "PULSE":
			{
			this.weaponDamage = 15;
			this.weaponDrain = 0.8;
			break;
			}
		case "BEAM":
			{
			this.weaponDamage = 15;
			this.weaponDrain = 1.0;
			break;
			}
		case "MILITARY":
			{
			this.weaponDamage = 23;
			this.weaponDrain = 1.2;
			break;
			}
		case "MINING":
			{
			this.weaponDamage = 50;
			this.weaponDrain = 1.4;
			break;
			}	
		}
	}