Back to Index Page generated: May 19, 2025, 12:03:06 PM

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 2.2 2.2
Tags equipment, weapons equipment, weapons
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL https://wiki.alioth.net/index.php/Laser_Booster_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/e/e8/Laser_Booster_2.2.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 1746613101

Documentation

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

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.

If the any of the following OXP's are installed, they need to be at the indicated version number or newer in order to work:
- Ship Storage Helper v0.39
- Laser Mount Switching System v2.7
- Laser Arrangement v1.4
- Vimana-X HUD v1.23

--------------------------------------------------------------
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 2.0.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.
24/04/2025 - Version 2.0 - Rewritten to allow the laser booster to operation with any laser (core or OXP).
25/04/2025 - Version 2.1 - Added "use strict"; to script file. Fixed issue with calculation of equipment price for the repair items.
27/04/2025 - Version 2.2 - Added "use strict"; to main script file.

Equipment

Name Visible Cost [deci-credits] Tech-Level
Aft laser yes 0 1+
Aft secondary laser yes 0 1+
Forward laser yes 0 1+
Forward secondary laser yes 0 1+
Laser Booster yes 250000 13+
Port laser yes 0 1+
Port secondary laser yes 0 1+
Starboard laser yes 0 1+
Starboard secondary laser yes 0 1+
Laser (Damaged) yes 0 1+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/laserBooster_activate.js
"use strict";
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_conditions.js
"use strict";
this.name = "LaserBooster_Conditions";
this.author = "phkb";
this.copyright = "2025 phkb";
this.description = "Condition script to handle equipment items";
this.licence = "CC BY-NC-SA 4.0";

// can only repair laser in primary position (if LMSS is installed)

//-------------------------------------------------------------------------------------------------------------
this.allowAwardEquipment = function (equipment, ship, context) {
	if (context == "scripted") return true; // note: this doesn't fire when changing weapons
    var lb = worldScripts["laserBooster_worldScript.js"];
	if (lb._switching == true) return true;
	if (worldScripts.LMSS_Core && worldScripts.LMSS_Core._switching == true) return true;

    var p = player.ship;
	if (equipment == "EQ_WEAPON_LBOOST_DAMAGED_LASER") return false;
    if (equipment.indexOf("LBOOST_REPAIRITEM") == -1) return false;

    var key = "";
    if (equipment == "EQ_FORWARD_LBOOST_REPAIRITEM") {
		if (p.forwardWeapon.equipmentKey == lb._damagedEq) {
			var key = lb._holdDamage["FORWARD"].primary;
		}
	}
	if (equipment == "EQ_AFT_LBOOST_REPAIRITEM") {
		if (p.aftWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["AFT"].primary;
		}
	}
	if (equipment == "EQ_PORT_LBOOST_REPAIRITEM") {
		if (p.portWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["PORT"].primary;
		}
	}
	if (equipment == "EQ_STARBOARD_LBOOST_REPAIRITEM") {
		if (p.starboardWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["STARBOARD"].primary;
		}
	}

    if (equipment == "EQ_FORWARD_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["FORWARD"].secondary != "") {
			key = lb._holdDamage["FORWARD"].secondary;
		}
	}
	if (equipment == "EQ_AFT_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["AFT"].secondary != "") {
			key = lb._holdDamage["AFT"].secondary;
		}
	}
	if (equipment == "EQ_PORT_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["PORT"].secondary != "") {
			key = lb._holdDamage["PORT"].secondary;
		}
	}
	if (equipment == "EQ_STARBOARD_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["STARBOARD"].secondary != "") {
			key = lb._holdDamage["STARBOARD"].secondary;
		}
	}
    if (key != "") {
        var eq = EquipmentInfo.infoForKey(key);
        if (p.dockedStation.equivalentTechLevel >= eq.techLevel) return true;
    }

    return false;
}

//-------------------------------------------------------------------------------------------------------------
this.updateEquipmentPrice = function (equipment, price) {
	var newprice = price;
	var p = player.ship;
    var lb = worldScripts["laserBooster_worldScript.js"];

    if (equipment.indexOf("LBOOST_REPAIRITEM") == -1) return newprice;

    var key = "";

    if (equipment == "EQ_FORWARD_LBOOST_REPAIRITEM") {
		if (p.forwardWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["FORWARD"].primary;
		}
	}
	if (equipment == "EQ_AFT_LBOOST_REPAIRITEM") {
		if (p.aftWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["AFT"].primary;
		}
	}
	if (equipment == "EQ_PORT_LBOOST_REPAIRITEM") {
		if (p.portWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["PORT"].primary;
		}
	}
	if (equipment == "EQ_STARBOARD_LASER_REPAIRITEM") {
		if (p.starboardWeapon.equipmentKey == lb._damagedEq) {
			key = lb._holdDamage["STARBOARD"].primary;
		}
	}

    if (equipment == "EQ_FORWARD_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["FORWARD"].secondary != "") {
			key = lb._holdDamage["FORWARD"].secondary;
		}
	}
	if (equipment == "EQ_AFT_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["AFT"].secondary != "") {
			key = lb._holdDamage["AFT"].secondary;
		}
	}
	if (equipment == "EQ_PORT_SECONDARY_LBOOST_REPAIRITEM") {
		if (lb._holdDamage["PORT"].secondary != "") {
			key = lb._holdDamage["PORT"].secondary;
		}
	}
	if (equipment == "EQ_STARBOARD_SECONDARY_LASER_REPAIRITEM") {
		if (lb._holdDamage["STARBOARD"].secondary != "") {
			key = lb._holdDamage["STARBOARD"].secondary;
		}
	}
    var eq = EquipmentInfo.infoForKey(key);
    if (eq) {
		newprice = eq.price;
	}
	return newprice;
}
Scripts/laserBooster_worldScript.js
"use strict";
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 = "2.1";

this._holdDamage = {
	"FORWARD": { primary: "", secondary: "" },
	"AFT": { primary: "", secondary: "" },
	"PORT": { primary: "", secondary: "" },
	"STARBOARD": { primary: "", secondary: "" }
};
this._damagedEq = "EQ_WEAPON_LBOOST_DAMAGED_LASER";
this._notAvailable = ["EQ_WEAPON_NONE", this._damagedEq];
this._switching = false;
this._baseBreakChance = 0.002;
this._baseLaserTemp = 2;
this._normalLaserDamage = true;

this._weaponInfoLookup = {
    "EQ_WEAPON_ACHENAR_PULSE_02_LASER": {energy: 0.8, damage: 30.0},
    "EQ_WEAPON_ANDERSON_LASER": {energy: 1.4, damage: 100.0},
    "EQ_WEAPON_ASSAULT_LASER": {energy: 1.5, damage: 28.0},
    "EQ_WEAPON_BEAM_LASER": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_BEAM_LASER_2": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_BEAM_LASER_3": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_BEAM_LASER_4": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_BEAM_LASER_5": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_BLAST_LASER": {energy: 0.5, damage: 15.0},
    "EQ_WEAPON_BURST_LASER": {energy: 1.4, damage: 20.0},
    "EQ_WEAPON_CANNON_1": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_10": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_10_2": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_10_3": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_10_4": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_10_5": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_11": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_CANNON_11_2": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_CANNON_11_3": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_CANNON_11_4": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_CANNON_11_5": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_CANNON_12": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_12_2": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_12_3": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_12_4": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_12_5": {energy: 10.0, damage: 100.0},
    "EQ_WEAPON_CANNON_13": {energy: 20.0, damage: 200.0},
    "EQ_WEAPON_CANNON_14": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_15": {energy: 15.0, damage: 300.0},
    "EQ_WEAPON_CANNON_16": {energy: -20.0, damage: 80.0},
    "EQ_WEAPON_CANNON_17": {energy: 15.0, damage: 300.0},
    "EQ_WEAPON_CANNON_18": {energy: 15.0, damage: 150.0},
    "EQ_WEAPON_CANNON_2": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_2_2": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_2_3": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_2_4": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_2_5": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_3": {energy: 10.0, damage: 60.0},
    "EQ_WEAPON_CANNON_4": {energy: 7.0, damage: 75.0},
    "EQ_WEAPON_CANNON_4_2": {energy: 7.0, damage: 75.0},
    "EQ_WEAPON_CANNON_4_3": {energy: 7.0, damage: 75.0},
    "EQ_WEAPON_CANNON_4_4": {energy: 7.0, damage: 75.0},
    "EQ_WEAPON_CANNON_4_5": {energy: 7.0, damage: 75.0},
    "EQ_WEAPON_CANNON_5": {energy: 14.0, damage: 150.0},
    "EQ_WEAPON_CANNON_5_2": {energy: 14.0, damage: 150.0},
    "EQ_WEAPON_CANNON_5_3": {energy: 14.0, damage: 150.0},
    "EQ_WEAPON_CANNON_5_4": {energy: 14.0, damage: 150.0},
    "EQ_WEAPON_CANNON_5_5": {energy: 14.0, damage: 150.0},
    "EQ_WEAPON_CANNON_6": {energy: 5.0, damage: 100.0},
    "EQ_WEAPON_CANNON_7": {energy: 5.0, damage: 60.0},
    "EQ_WEAPON_CANNON_7_2": {energy: 5.0, damage: 60.0},
    "EQ_WEAPON_CANNON_7_3": {energy: 5.0, damage: 60.0},
    "EQ_WEAPON_CANNON_7_4": {energy: 5.0, damage: 60.0},
    "EQ_WEAPON_CANNON_7_5": {energy: 5.0, damage: 60.0},
    "EQ_WEAPON_CANNON_8": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_9": {energy: -20.0, damage: 80.0},
    "EQ_WEAPON_CANNON_EA": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_EA_2": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_EA_3": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_EA_4": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_EA_5": {energy: 0.0, damage: 40.0},
    "EQ_WEAPON_CANNON_ECO": {energy: 2.0, damage: 100.0},
    "EQ_WEAPON_CANNON_ECO_2": {energy: 2.0, damage: 100.0},
    "EQ_WEAPON_CANNON_ECO_3": {energy: 2.0, damage: 100.0},
    "EQ_WEAPON_CANNON_ECO_4": {energy: 2.0, damage: 100.0},
    "EQ_WEAPON_CANNON_ECO_5": {energy: 2.0, damage: 100.0},
    "EQ_WEAPON_CANNON_HEAVY_SAPPER": {energy: 10.0, damage: 20.0},
    "EQ_WEAPON_CANNON_HEAVY_SNIPER_GUN": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_HEAVY_SNIPER_GUN_2": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_HEAVY_SNIPER_GUN_3": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_HEAVY_SNIPER_GUN_4": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_HEAVY_SNIPER_GUN_5": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_SAPPER": {energy: 5.0, damage: 10.0},
    "EQ_WEAPON_CANNON_SNIPER_GUN": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_SNIPER_GUN_2": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_SNIPER_GUN_3": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_SNIPER_GUN_4": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_SNIPER_GUN_5": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_CANNON_THARGOID": {energy: 2.2, damage: 60.0},
    "EQ_WEAPON_DEXM_LASER": {energy: 1.0, damage: 40.0},
    "EQ_WEAPON_DUAL_LASER": {energy: 0.8, damage: 12.0},
    "EQ_WEAPON_EBEAM_LASER": {energy: 0.4, damage: 6.0},
    "EQ_WEAPON_ECO_LASER": {energy: 0.3, damage: 16.0},
    "EQ_WEAPON_ECO_LASER_2": {energy: 0.3, damage: 16.0},
    "EQ_WEAPON_ECO_LASER_3": {energy: 0.3, damage: 16.0},
    "EQ_WEAPON_ECO_LASER_4": {energy: 0.3, damage: 16.0},
    "EQ_WEAPON_ECO_LASER_5": {energy: 0.3, damage: 16.0},
    "EQ_WEAPON_ECO_REACTOR": {energy: -1.0, damage: 0.0},
    "EQ_WEAPON_ECO_REACTOR_2": {energy: -1.0, damage: 0.0},
    "EQ_WEAPON_ECO_REACTOR_3": {energy: -1.0, damage: 0.0},
    "EQ_WEAPON_ECO_REACTOR_4": {energy: -1.0, damage: 0.0},
    "EQ_WEAPON_ECO_REACTOR_5": {energy: -1.0, damage: 0.0},
    "EQ_WEAPON_ECU_BEAM_LASER": {energy: 0.5, damage: 6.0},
    "EQ_WEAPON_ECU_MILITARY_LASER": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_ECU_MINING_LASER": {energy: 1.4, damage: 50.0},
    "EQ_WEAPON_ECU_PULSE_LASER": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_EMILITARY_LASER": {energy: 1.5, damage: 12.0},
    "EQ_WEAPON_EPULSE_LASER": {energy: 0.6, damage: 13.0},
    "EQ_WEAPON_FRONTIER_LASER": {energy: 0.8, damage: 30.0},
    "EQ_WEAPON_GATLING_LASER_1": {energy: 1.0, damage: 10.0},
    "EQ_WEAPON_GATLING_LASER_2": {energy: 2.0, damage: 20.0},
    "EQ_WEAPON_GATLING_LASER_3": {energy: 3.0, damage: 30.0},
    "EQ_WEAPON_GATLING_LASER_4": {energy: 4.0, damage: 40.0},
    "EQ_WEAPON_GATLING_LASER_5": {energy: 5.0, damage: 50.0},
    "EQ_WEAPON_GATLING_LASER_COOLER": {energy: 1.0, damage: 0.0},
    "EQ_WEAPON_HIRAD_LASER": {energy: 0.9, damage: 30.0},
    "EQ_WEAPON_HVARISCAN_LASER": {energy: 0.8, damage: 18.0},
    "EQ_WEAPON_JKMINING_LASER": {energy: 1.4, damage: 100.0},
    "EQ_WEAPON_LASER_COOLER": {energy: 3.0, damage: 0.0},
    "EQ_WEAPON_LUCAS_LASER": {energy: 0.5, damage: 10.0},
    "EQ_WEAPON_MILITARY_LASER": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_MILITARY_LASER_2": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_MILITARY_LASER_3": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_MILITARY_LASER_4": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_MILITARY_LASER_5": {energy: 1.1, damage: 12.0},
    "EQ_WEAPON_MINING_LASER": {energy: 1.4, damage: 50.0},
    "EQ_WEAPON_NONE": {energy: 0.0, damage: 0.0},
    "EQ_WEAPON_PARTICLE_ACCELERATOR_LASER": {energy: 0.0, damage: 6.5},
    "EQ_WEAPON_PULSE_LASER": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_PULSE_LASER_2": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_PULSE_LASER_3": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_PULSE_LASER_4": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_PULSE_LASER_5": {energy: 0.8, damage: 15.0},
    "EQ_WEAPON_QVC_LASER": {energy: 1.4, damage: 35.0},
    "EQ_WEAPON_REV_THARGOID_LASER": {energy: 1.1, damage: 24.0},
    "EQ_WEAPON_RIMMERACE_LASER": {energy: 1.1, damage: 20.0},
    "EQ_WEAPON_STAR_LASER": {energy: 1.0, damage: 14.0},
    "EQ_WEAPON_THARGOID_LASER": {energy: 1.1, damage: 12.5},
    "EQ_WEAPON_THARGOID_PLASMA_ACCELERATOR": {energy: 100.0, damage: 437.5},
    "EQ_WEAPON_VARISCAN_LASER": {energy: 0.8, damage: 20.0},
    "EQ_WEAPON_VIMANA_BEAM": {energy: 0.5, damage: 15.0},
    "EQ_WEAPON_WILLIAMS_LASER": {energy: 0.5, damage: 25.0},
    "EQ_WEAPON_ZEUSCORP_LASER": {energy: 0.8, damage: 30.0},
	"EQ_WEAPON_ULTRA_LASER": {energy: 1.1, damage: 200.0},
};

this._trueValues = ["yes", "1", 1, "true", true];

this._lbConfig = {
    Name: this.name,
    Display: "Settings",
    Alias: "Laser Booster",
    Alive: "_lbConfig",
	Bool: {
		B0: { Name: "_normalLaserDamage", Def: true, Desc: "Non-booster damage" },
		Info: "0: Indicates whether damage can occur to lasers without the booster being in use."
	},
	SInt: {
		S0: { Name: "_baseBreakChance", Def: 0.002, Min: 0, Max: 1, Float:true, Desc: "Break chance" },
		Info: "0: The base chance that damage will occur. Will be increased by a factor related to laser temperature when booster in use; "
	},
};

//-------------------------------------------------------------------------------------------------------------
this.startUp = function () {
	this.laserTemp = this._baseLaserTemp;
	missionVariables.laserBooster = "INACTIVE";
}

//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function() {
    if (missionVariables.LaserBooster_Data) {
        this._holdDamage = JSON.parse(missionVariables.LaserBooster_Data);
    }
    if (missionVariables.LaserBooster_BreakChance) {
        this._baseBreakChance = parseFloat(missionVariables.LaserBooster_BreakChance);
    }
    if (missionVariables.LaserBooster_NormalDamage) {
        this._normalLaserDamage = (this._trueValues.indexOf(missionVariables.LaserBooster_NormalDamage) >= 0 ? true : false);
    }
    this.$updateManifest();
    // register our settings, if Lib_Config is present
    if (worldScripts.Lib_Config) {
        worldScripts.Lib_Config._registerSet(this._lbConfig);
    }
}

//-------------------------------------------------------------------------------------------------------------
this.playerWillSaveGame = function() {
    missionVariables.LaserBooster_Data = JSON.stringify(this._holdDamage);
    missionVariables.LaserBooster_BreakChance = this._baseBreakChance;
    missionVariables.LaserBooster_NormalDamage = this._normalLaserDamage;
}

//-------------------------------------------------------------------------------------------------------------
this.shipLaunchedFromStation = function () {
	missionVariables.laserBooster = "INACTIVE";
	this.callCount = 0;
	this.laserTemp = this._baseLaserTemp;
	this.findLaser();
    if (!this._normalLaserDamage) {
        this._holdBreakChance = this._baseBreakChance;
        this._baseBreakChance = 0;
    }
	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 = this._baseBreakChance;
		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" || !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); }
    this._baseBreakChance = this._holdBreakChance;
	delete this.callbackID;
}

//-------------------------------------------------------------------------------------------------------------
this.viewDirectionChanged = function (viewString) {
	this.laserTemp = this._baseLaserTemp;
	this.findLaser();
}

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

//-------------------------------------------------------------------------------------------------------------
this.breakLaser = function () {
	var p = player.ship;
	player.consoleMessage("Laser failure detected!");
	var side = "";	
	switch (player.ship.viewDirection) {
		case "VIEW_FORWARD":
		case "VIEW_CUSTOM":
            this._holdDamage["FORWARD"].primary = p.forwardWeapon.equipmentKey;
            p.forwardWeapon = this._damagedEq;
			side = "EQ_FORWARD_LBOOST_REPAIRITEM";
			break;
		case "VIEW_AFT":
            this._holdDamage["AFT"].primary = p.aftWeapon.equipmentKey;
            p.aftWeapon = this._damagedEq;
			side = "EQ_AFT_LBOOST_REPAIRITEM";
			break;
		case "VIEW_PORT":
            this._holdDamage["PORT"].primary = p.portWeapon.equipmentKey;
            p.portWeapon = this._damagedEq;
			side = "EQ_PORT_LBOOST_REPAIRITEM";
			break;
		case "VIEW_STARBOARD":
			this._holdDamage["STARBOARD"].primary = p.starboardWeapon.equipmentKey;
			p.starboardWeapon = this._damagedEq;
			side = "EQ_STARBOARD_LBOOST_REPAIRITEM";
			break;
	}
	this.$playSound();
	this.$updateManifest();
	p.awardEquipment(side);
	p.setEquipmentStatus(side, "EQUIPMENT_DAMAGED");
	this.weaponDamage = 0;
	this.weaponDrain = 0;
}

//-------------------------------------------------------------------------------------------------------------
this.equipmentRepaired = function (equipment) {
    if (equipment.indexOf("LBOOST_REPAIRITEM") == -1) return;
	var p = player.ship;
    var lmss = worldScripts.LMSS_Core;
    if (lmss) lmss._switching = true;
    this._switching = true;
    // repair the item.
    switch (equipment) {
        case "EQ_FORWARD_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			this.callCount = 0;
			if (p.forwardWeapon.equipmentKey == this._damagedEq) {
            	p.forwardWeapon = this._holdDamage["FORWARD"].primary;
            	this._holdDamage["FORWARD"].primary = "";
			}
            break;
		case "EQ_FORWARD_SECONDARY_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			lmss._forwardAltKey = this._holdDamage["FORWARD"].secondary;
			this._holdDamage["FORWARD"].secondary = "";
			break;
        case "EQ_AFT_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			this.callCount = 0;
			if (p.aftWeapon.equipmentKey == this._damagedEq) {
            	p.aftWeapon = this._holdDamage["AFT"].primary;
            	this._holdDamage["AFT"].primary = "";
			}
            break;
		case "EQ_AFT_SECONDARY_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			lmss._aftAltKey = this._holdDamage["AFT"].secondary;
			this._holdDamage["AFT"].secondary = "";
			break;
        case "EQ_PORT_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			this.callCount = 0;
			if (p.portWeapon.equipmentKey == this._damagedEq) {
            	p.portWeapon = this._holdDamage["PORT"].primary;
            	this._holdDamage["PORT"].primary = "";
			}
            break;
		case "EQ_PORT_SECONDARY_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			lmss._portAltKey = this._holdDamage["PORT"].secondary;
			this._holdDamage["PORT"].secondary = "";
			break;
        case "EQ_STARBOARD_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			this.callCount = 0;
			if (p.starboardWeapon.equipmentKey == this._damagedEq) {
            	p.starboardWeapon = this._holdDamage["STARBOARD"].primary;
            	this._holdDamage["STARBOARD"].primary = "";
			}
            break;
		case "EQ_STARBOARD_SECONDARY_LBOOST_REPAIRITEM":
            p.removeEquipment(equipment);
			lmss._starboardAltKey = this._holdDamage["STARBOARD"].secondary;
			this._holdDamage["STARBOARD"].secondary = "";
			break;
    }
    if (lmss) {
		lmss._switching = false;
		lmss.$updateManifest();
	}
    this._switching = false;
	this.$updateManifest();
	this.findLaser();
}

//-------------------------------------------------------------------------------------------------------------
this.findLaser = function () {
	var lasertype = "NONE";
	switch (player.ship.viewDirection) {
		case "VIEW_FORWARD":
		case "VIEW_CUSTOM":
			lasertype = player.ship.forwardWeapon;
			break;
		case "VIEW_AFT":
			lasertype = player.ship.aftWeapon;
			break;
		case "VIEW_PORT":
			lasertype = player.ship.portWeapon;
			break;
		case "VIEW_STARBOARD":
			lasertype = player.ship.starboardWeapon;
			break;
	}

	var eq = this._weaponInfoLookup[lasertype];
	if (eq) {
		this.weaponDamage = eq.damage;
		this.weaponDrain = eq.energy;
	} else {
		this.weaponDamage = 0;
		this.weaponDrain = 0;
	}
}

//-------------------------------------------------------------------------------------------------------------
this.$updateManifest = function $updateManifest() {
	var list = [];
	var p = player.ship;

	list.push("Damaged Lasers:");
    var lmss = worldScripts.LMSS_Core;

	if (p.forwardWeapon.equipmentKey == this._damagedEq) {
        list.push("Forward: " + this.$getEquipmentName(this._holdDamage["FORWARD"].primary));
    }
    if (lmss && lmss._forwardAltKey == this._damagedEq) {
        list.push("Forward (secondary): " + this.$getEquipmentName(this._holdDamage["FORWARD"].secondary));
    }
	if (p.aftWeapon.equipmentKey == this._damagedEq) {
        list.push("Aft: " + this.$getEquipmentName(this._holdDamage["AFT"].primary));
	}
    if (lmss && lmss._aftAltKey == this._damagedEq) {
        list.push("Aft (secondary): " + this.$getEquipmentName(this._holdDamage["AFT"].secondary));
    }
	if (p.portWeapon.equipmentKey == this._damagedEq) {
        list.push("Port: " + this.$getEquipmentName(this._holdDamage["PORT"].primary));
	}
    if (lmss && lmss._portAltKey == this._damagedEq) {
        list.push("Port (secondary): " + this.$getEquipmentName(this._holdDamage["PORT"].secondary));
    }
	if (p.starboardWeapon.equipmentKey == this._damagedEq) {
        list.push("Starboard: " + this.$getEquipmentName(this._holdDamage["STARBOARD"].primary));
	}
    if (lmss && lmss._starboardAltKey == this._damagedEq) {
        list.push("Starboard (secondary): " + this.$getEquipmentName(this._holdDamage["STARBOARD"].secondary));
    }

	if (list.length === 1) {
		// no secondary lasers installed
		mission.setInstructions(null);
	} else {
		mission.setInstructions(list, this.name);
	}
}

//-------------------------------------------------------------------------------------------------------------
// returns the name of a particular equipment item
this.$getEquipmentName = function $getEquipmentName(equipment) {
	var laser = EquipmentInfo.infoForKey(equipment);
	if (!laser || laser.name === "Remove Laser") {
		return "--None--";
	} else {
		return laser.name;
	}
}

//-------------------------------------------------------------------------------------------------------------
this.$switchPosition = function $switchPosition(position) {
	var p = player.ship;
    var hold = this._holdDamage[position].primary;
	if (hold != "") {
		p.removeEquipment("EQ_" + position + "_LBOOST_REPAIRITEM");
		if (worldScripts.VimanaX_HUD) worldScripts.VimanaX_HUD.equipmentRepaired("EQ_" + position + "_LBOOST_REPAIRITEM");
	}
	if (this._holdDamage[position].secondary != "") {
		p.removeEquipment("EQ_" + position + "_SECONDARY_LBOOST_REPAIRITEM");
		if (worldScripts.VimanaX_HUD) worldScripts.VimanaX_HUD.equipmentRepaired("EQ_" + position + "_SECONDARY_LBOOST_REPAIRITEM");
	}
    this._holdDamage[position].primary = this._holdDamage[position].secondary;
    this._holdDamage[position].secondary = hold;
	if (this._holdDamage[position].primary != "") {
		p.awardEquipment("EQ_" + position + "_LBOOST_REPAIRITEM");
		p.setEquipmentStatus("EQ_" + position + "_LBOOST_REPAIRITEM", "EQUIPMENT_DAMAGED");
	}
	if (this._holdDamage[position].secondary != "") {
		p.awardEquipment("EQ_" + position + "_SECONDARY_LBOOST_REPAIRITEM");
		p.setEquipmentStatus("EQ_" + position + "_SECONDARY_LBOOST_REPAIRITEM", "EQUIPMENT_DAMAGED");
	}
    this.$updateManifest();
}

//-------------------------------------------------------------------------------------------------------------
this.$transferPrimaryLaser = function $transferPrimaryLaser(fromPosition, toPosition) {
	if (this._holdDamage[toPosition].primary != "") {
		p.removeEquipment("EQ_" + toPosition + "_LBOOST_REPAIRITEM");
		if (worldScripts.VimanaX_HUD) worldScripts.VimanaX_HUD.equipmentRepaired("EQ_" + toPosition + "_LBOOST_REPAIRITEM");
	}
	if (this._holdDamage[fromPosition].primary != "") {
		p.removeEquipment("EQ_" + fromPosition + "_LBOOST_REPAIRITEM");
		if (worldScripts.VimanaX_HUD) worldScripts.VimanaX_HUD.equipmentRepaired("EQ_" + fromPosition + "_SECONDARY_LBOOST_REPAIRITEM");
	}
    var hold = this._holdDamage[toPosition].primary;
    this._holdDamage[toPosition].primary = this._holdDamage[fromPosition].primary;
    this._holdDamage[fromPosition].primary = hold;
	if (this._holdDamage[toPosition].primary != "") {
		p.awardEquipment("EQ_" + toPosition + "_LBOOST_REPAIRITEM");
		p.setEquipmentStatus("EQ_" + toPosition + "_LBOOST_REPAIRITEM", "EQUIPMENT_DAMAGED");
	}
	if (this._holdDamage[fromPosition].primary != "") {
		p.awardEquipment("EQ_" + fromPosition + "_LBOOST_REPAIRITEM");
		p.setEquipmentStatus("EQ_" + fromPosition + "_LBOOST_REPAIRITEM", "EQUIPMENT_DAMAGED");
	}
    this.$updateManifest();
}

//-------------------------------------------------------------------------------------------------------------
// play the scrape damage sound effect
this.$playSound = function $playSound() {
	var mySound = new SoundSource;
    mySound.sound = "[player-scrape-damage]";
	mySound.loop = false;
	mySound.play();
}