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

Expansion Power To Engines

Content

Warnings

  1. License not specified
  2. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Grants more power to the player ship's engines (but not injectors) when weapons are off-line. Grants more power to the player ship's engines (but not injectors) when weapons are off-line.
Identifier oolite.oxp.redspear.power_to_engines oolite.oxp.redspear.power_to_engines
Title Power To Engines Power To Engines
Category Mechanics Mechanics
Author Redspear Redspear
Version 1.4 1.4
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/2/2e/Oolite.oxp.redspear.power_to_engines.oxz n/a
License
File Size n/a
Upload date 1670185165

Documentation

Also read http://wiki.alioth.net/index.php/Power%20To%20Engines

Equipment

Name Visible Cost [deci-credits] Tech-Level
Weapons Off-line no 1 101+

Ships

This expansion declares no ships. This may be related to warnings.

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/power_to_engines.js
this.name        = "power_to_engines"; 
this.author      = "Redspear"; 
this.copyright   = "2019 Redspear";
this.licence     = "CC BY-NC-SA 4.0"; 
this.description = "more engine power when weapons off-line"; 
this.version     = "1.4";

"use strict";

// establish speed boost according to ship speed
this.startUpComplete = this.playerBoughtNewShip = this.playerBoughtEquipment = this.equipmentDamaged = this.equipmentRepaired = function ()
{
	// base values
	this._dms = player.ship.maxSpeed;
	this._dsf = player.ship.injectorSpeedFactor;
	
	if (player.ship.weaponFacings === 1 || player.ship.weaponFacings === 2 || player.ship.weaponFacings === 4 || player.ship.weaponFacings === 8) {
	this. _db = 25;
	}
	
	if (player.ship.weaponFacings === 3 || player.ship.weaponFacings === 5 || player.ship.weaponFacings === 9 || player.ship.weaponFacings === 6 || player.ship.weaponFacings === 10 || player.ship.weaponFacings === 12) {
	this. _db = 40;
	}
	
	if (player.ship.weaponFacings === 7 || player.ship.weaponFacings === 11 || player.ship.weaponFacings === 13 || player.ship.weaponFacings === 14) {
	this. _db = 55;
	}
	
	if (player.ship.weaponFacings === 15) {
	this. _db = 70;
	}
	
	if (player.ship.weaponFacings === 0) {
	this. _db = 0;
	}
		
	// when weapons off-line
	this._nms = _dms + _db;	// boosted according to laser mounts offline
	this._nsf = _dsf;	// if you prefer injector speed to be unaffected by any bonus then 'un-comment' the next line (i.e. remove the "//") back in...
	// this._nsf = _dsf - ((_db / _nms) * _dsf); // ...if using this line then you can comment the previous line out
	
	// compatibility with masslock compensator oxp
	this._mds = _dms * 2; // 200 % base speed
	this._mdf = _dsf; // MLC injector speed unaffected
	this._mcs = _nms * 2; // 200 % PtE speed
	this._mcf = _nsf; // MLC injector speed unaffected
}

// check if weapons off-line when launching
this.shipWillLaunchFromStation = function ()
{
	if (player.ship.weaponsOnline === true) {
		player.ship.maxSpeed = _dms;
		player.ship.injectorSpeedFactor = _dsf;
		} else {
			player.ship.awardEquipment ("EQ_POWER_TO_ENGINES");
			player.ship.maxSpeed = _nms;
			player.ship.injectorSpeedFactor = _nsf;
			}
}

// when weapons brought on or off-line, adjust speed accordingly
this.weaponsSystemsToggled = function ()
{
	// weapons on-line and masslock compensators active
	if (player.ship.weaponsOnline === true && player.ship.equipmentStatus("EQ_MASSLOCK_COMPENSATOR") == "EQUIPMENT_OK") {
		player.ship.removeEquipment ("EQ_POWER_TO_ENGINES");
		player.ship.maxSpeed = _mds;
		player.ship.injectorSpeedFactor = _mdf;
		} else {
		// weapons on-line and masslock compensators inactive
		if (player.ship.weaponsOnline === true) {
			player.ship.removeEquipment ("EQ_POWER_TO_ENGINES");
			player.ship.maxSpeed = _dms;
			player.ship.injectorSpeedFactor = _dsf;
			} else {
			// weapons off-line and masslock compensators active
			if (player.ship.weaponsOnline === false && player.ship.equipmentStatus("EQ_MASSLOCK_COMPENSATOR") == "EQUIPMENT_OK") {
				player.ship.awardEquipment ("EQ_POWER_TO_ENGINES");
				player.consoleMessage ("Power redirected to engines");
				player.ship.maxSpeed = _mcs;
				player.ship.injectorSpeedFactor = _mcf;
				} else {
				// weapons off-line and masslock compensators inactive
				if (player.ship.weaponsOnline === false) {
					player.ship.awardEquipment ("EQ_POWER_TO_ENGINES");
					player.consoleMessage ("Power redirected to engines");
					player.ship.maxSpeed = _nms;
					player.ship.injectorSpeedFactor = _nsf;
					}
				}
			}
		}
}

// reset to base speed when docked
this.shipWillDockWithStation = function ()
{
	player.ship.removeEquipment ("EQ_POWER_TO_ENGINES");
	player.ship.maxSpeed = _dms;
	player.ship.injectorSpeedFactor = _dsf;
}