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

Expansion Compass target mode autoswitch

Content

Warnings

  1. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0
  2. Unknown key 'upload_date' at https://wiki.alioth.net/img_auth.php/3/33/Oolite.oxp.Astrobe.compass-target-autoswitch.oxz!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Automatically switch your ASC to target mode when in red alert and a target is locked. The ASC gives a better idea of where the target is compared to the HUD indicator. In particular, it tells immediately if the target is ahead or behind. Automatically switch your ASC to target mode when in red alert and a target is locked. The ASC gives a better idea of where the target is compared to the HUD indicator. In particular, it tells immediately if the target is ahead or behind.
Identifier oolite.oxp.astrobe.compassautoswitch oolite.oxp.astrobe.compassautoswitch
Title Compass target mode autoswitch Compass target mode autoswitch
Category Miscellaneous Miscellaneous
Author Astrobe Astrobe
Version 1.0.0 1.0.0
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/3/33/Oolite.oxp.Astrobe.compass-target-autoswitch.oxz http://wiki.alioth.net/img_auth.php/3/33/Oolite.oxp.Astrobe.compass-target-autoswitch.oxz
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1610873264

Documentation

Also read http://wiki.alioth.net/index.php/Compass%20target%20mode%20autoswitch

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
Config/script.js
"use strict";

this.name    = "compass target autoswitch";
this.version = "1.0.0"; 
this.$checkTimer = null;

this.$targetcheck = function()
{
	var my = player.ship; // :-P
	if(my.equipmentStatus("EQ_ADVANCED_COMPASS")=="EQUIPMENT_OK")
	{	
		// the compassTarget checks handles indirectly a target change by phkb's ManualWitchSpaceAlignment.
		// This is a terrible way to do it because it relies on an implementation detail of this OXZ.
		// One of those temporary hacks that will last forever... 2017-11-16.
		if(my.target && (my.compassMode!="COMPASS_MODE_TARGET") && (player.alertCondition==3)) my.compassMode="COMPASS_MODE_TARGET";
	}
	else
	{
		log(this.name, "ASC not ok, no candy for you.");
		this.$checkTimer.stop();
	}
}

this.shipLaunchedFromStation = function(station)
{
	log(this.name, "Starting.");
	if(this.$checkTimer) this.$checkTimer.start();
	else this.$checkTimer= new Timer(this, this.$targetcheck, 0, 0.250); // can't be more frequent, but 1/4 sec is good enough.
}

this.shipExitedWitchspace= this.shipLaunchedFromStation;

this.shipDockWithStation = function(station)
{
	log(this.name, "Suspended.");
	this.$checkTimer.stop();
}