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

Expansion Masslock Reimagined

Content

Warnings

  1. 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 Masslock delays (rather than always holds) torus drive Masslock delays (rather than always holds) torus drive
Identifier oolite.oxp.redspear.masslock_reimagined oolite.oxp.redspear.masslock_reimagined
Title Masslock Reimagined Masslock Reimagined
Category Mechanics Mechanics
Author Redspear Redspear
Version 1.2 1.2
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/e/ea/Oolite.oxp.redspear.masslock_reimagined.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1670108791

Documentation

Also read http://wiki.alioth.net/index.php/Masslock%20Reimagined

Equipment

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

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/masslock_reimagined.js
this.name			= "masslock_reimagined";
this.author			= "Redspear";
this.copyright		= "2022 Redspear";
this.licence		= "CC BY-NC-SA 4.0"; 
this.description	= "Masslock delays (rather than always holds) torus drive";
this.version		= "1.2";

"use strict";

// establish toggles

this.startUpComplete  = this.playerBoughtNewShip = function()
{
	this._MLOR = 1; // orbital release
	//this._MLCR = 1; // combat release
}


// establish where masslock may be overridden

this.shipExitedPlanetaryVicinity = this.shipExitedWitchspace = function()
{
	this._MLOR = 1;
}


// establish where masslock may not be overridden

this.shipEnteredPlanetaryVicinity = function()
{
	this.$stopTimer();
	this._MLOR = 0;
	player.ship.massLockable = true;
	player.consoleMessage ("Gravity Well Influence Detected");
	
}

this.shipBeingAttacked = function()
{
	this.$stopTimer();
	//this._MLCR = 0;
	player.ship.massLockable = true;
	player.consoleMessage ("Torus Drive Recalibrating");
	this.$startTimer3();
	
}


// timer management

this.shipDied = function()
{	
	this.$stopTimer();
}	

this.$startTimer1 = function $startTimer1 () {
			this.$stopTimer(); // reset safety check
			this._myTimer = new Timer(this, this.$masslockReleaseTimer, 30, 0); // 30 seconds, no repeat
			}
			
this.$startTimer2 = function $startTimer2 () {
			this.$stopTimer(); // reset safety check
			this._myTimer = new Timer(this, this.$masslockRestoreTimer, 0.1, 0); // tenth of a second, no repeat unless scanner still not clear
			}
			
this.$startTimer3 = function $startTimer3 () {
			this.$stopTimer(); // reset safety check
			this._myTimer = new Timer(this, this.$masslockRecalibrationTimer, 30, 0); // 30 seconds, no repeat
			}			

this.$stopTimer = function $stopTimer ()
{
    if (this._myTimer && this._myTimer.isRunning) this._myTimer.stop();
}


// masslock management

this.alertConditionChanged = this.shipLaunchedFromStation = function()
{
	if (player.alertCondition === 2 && _MLOR === 1)
		{this.$startTimer1();
		}
		
	if (player.alertCondition === 2 && _MLOR === 0)
		{this.$stopTimer();
		}
		
	if (player.alertCondition === 1)
		{this.$startTimer2();
		//this._MLCR = 1;
		}	
}

this.$masslockReleaseTimer = function $masslockReleaseTimer ()
{
	player.ship.massLockable = false;
	player.consoleMessage ("Torus Drive Online");
}

this.$masslockRestoreTimer = function $masslockRestoreTimer ()
{
	var shpsNear = player.ship.checkScanner();
	
	if (shpsNear.length === 0) {
		player.ship.massLockable = true;
		player.consoleMessage ("Mass-Lock Sensitivity Restored");
	}
	else {
	this.$startTimer2();
	}
}

this.$masslockRecalibrationTimer = function $masslockRecalibrationTimer ()
{
	player.consoleMessage ("Torus Drive Recalibrated... rerouting...");
	//this._MLCR = 1;
	this.$startTimer1();
}