Back to Index | Page generated: Dec 20, 2024, 7:22:09 AM |
from Expansion Manager's OXP list | from Expansion Manifest | |
---|---|---|
Description | A software update for the standard scanner targeting enhancement equipment that automatically locks onto attacking ships if you have no prior target selected. | A software update for the standard scanner targeting enhancement equipment that automatically locks onto attacking ships if you have no prior target selected. |
Identifier | oolite.oxp.Thargoid.TAP | oolite.oxp.Thargoid.TAP |
Title | Target Autolock Plus | Target Autolock Plus |
Category | Equipment | Equipment |
Author | Thargoid | Thargoid |
Version | 1.14 | 1.14 |
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/Target_Autolock_OXP | n/a |
Download URL | https://wiki.alioth.net/img_auth.php/8/86/TargetAutolockPlus-1.14.oxz | n/a |
License | CC BY-NC-SA 3.0 | CC BY-NC-SA 3.0 |
File Size | n/a | |
Upload date | 1610873352 |
Also read http://wiki.alioth.net/index.php/Target%20Autolock%20Plus
Target Autolock OXP ------------------- v1.14, by Thargoid A little OXP that offers a software upgrade to the Scanner Targeting Enhancement equipment (which is of course required). This adds the functionality that if the ship is attacked by surprise, or any other situation where there is currently no target set, then the attacking ship is automatically targetted. It is also tagged red/magenta on the scanner, so you know exactly who to take your aggression out on. The modification is designed for bounty hunters and other hard-edged combat veterans to enable swift location of the hostile craft using the Targeting Enhancement's directional arrow and/or more simple useage of missiles and other ordinance. Note that this update offers target lock not laser lock, that kind of aiming still needs to be done manually. Also as a new addition, the currently targetted entity on your scanner will now be artifically recoloured to flashing blue/grey (or whatever you prefer, see below) to make it easier to track amongst whatever else may be around you. If you close down your target or aim at something else it will return to its original colouration. Available from all good tech 13+ systems for the small price of 200 credits. Requires Oolite v1.74 or above. Note for OXP Makers ------------------- If you don't want Target Autolock to be able to lock onto your ship, just include "TAP_noAutolock" as one of the ships roles. Also if you are creating a stealth ship that does not show up on scanner and includes the "OXP_stealthShip" role in its role list, this also will not be locked on to by Autolock. Also in both cases the ship will not be highlighted on the scanner if the player manually targets it. Scanner Colours --------------- If blue/cyan isn't your thing, just open the script.js file in the OXPs config folder using your preferred text editor (not Notepad under Windows!) and change the definitions of this.scanColor1 and this.scanColor2 in lines 10 & 11 of this.startUp to your preferred colours. Then save the file and restart Oolite whilst holding down the shift key until you get the spinning Cobra mkIII screen to clear the cache. License ------- This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license (https://creativecommons.org/licenses/by-nc-sa/3.0/) Version history --------------- 21/04/2009 - Version 1.00 * Initial release. 19/08/2009 - Version 1.01 * Minor script tweak to deal with attacker getting destroyed before autolock. 14/04/2010 - Version 1.10 * Update for scanner colour marking. Now requires Oolite v1.74 or higher. 15/04/2010 - Version 1.10 * Added scanner colour-marking of current target. 23/06/2010 - Version 1.11 * Scanner colour markers now easier to change in script. Also script check for self-locking included 13/02/2011 - Version 1.12 * Removal of upper limit, to allow running with 1.75 25/11/2020 - Version 1.13 * Updated license to remove the "Thargoid clauses" after Thargoid allowed modification when retired from maintaining his OXps (http://aegidian.org/bb/viewtopic.php?f=4&t=17085). * Discards the use of a mission variable to indicate the equipment installation in the player ship and keeps the purchased equipment. * Resets the highlighting of the target in the scanner if Scanner Target Enhancement is damaged. 30/11/2020 - Versiion 1.14 * Fixes typo that prevented resetting scanner when target is lost * Some optimizations to avoid repeatedly setting up the target scanner display colors.
Name | Visible | Cost [deci-credits] | Tech-Level |
---|---|---|---|
Automatic Target Acquisition | yes | 2000 | 13+ |
Path | |
---|---|
Config/script.js | this.name = "targetAutolock"; this.author = "Thargoid"; this.license = "CC BY-NC-SA 3.0"; this.description = "Automatic target locking to attacking ships."; this.version = "1.14"; this.$installed = false; this.$oldTarget; this.$scanColor1; this.$scanColor2; this.$targetTimer; // // Event Handlers // //--------------------------------------------------------------------------------- this.startUp = function _tap_startUp() { this.$oldTarget = null; this.$scanColor1 = "cyanColor"; this.$scanColor2 = "grayColor"; var old_color1 = player.ship.scannerDisplayColor1; var old_color2 = player.ship.scannerDisplayColor2; // uses the player ship to convert the color name strings to the color tuples so we can compare the later player.ship.scannerDisplayColor1 = this.$scanColor1; this.$scanColor1 = player.ship.scannerDisplayColor1; player.ship.scannerDisplayColor1 = old_color1; player.ship.scannerDisplayColor2 = this.$scanColor2; this.$scanColor2 = player.ship.scannerDisplayColor2; player.ship.scannerDisplayColor2 = old_color2; } //--------------------------------------------------------------------------------- this.startUpComplete = this.playerBoughtNewShip = this.playerReplacedShip = this.$newShip = function _tap_newShip() { this.ship = player.ship; if (this.ship.equipmentStatus("EQ_TARGET_AUTOLOCK") === "EQUIPMENT_OK") this.$installed = true; else if (missionVariables.targetAutolock != null) { if (missionVariables.targetAutolock === "TRUE") this.ship.awardEquipment("EQ_TARGET_AUTOLOCK"); else this.$installed = false; } if (missionVariables.targetAutolock) delete missionVariables.targetAutolock; } //--------------------------------------------------------------------------------- this.equipmentAdded = function _tap_equipmentAdded(equipmentKey) { if (equipmentKey === "EQ_TARGET_AUTOLOCK") this.$installed = true; } //--------------------------------------------------------------------------------- this.equipmentRemoved = function _tap_equipmentRemoved(equipmentKey) { if (equipmentKey === "EQ_TARGET_AUTOLOCK") { this.$installed = false; this.$reset(); } else if (equipmentKey === "EQ_SCANNER_SHOW_MISSILE_TARGET" && this.$targetTimer && this.$targetTimer.isRunning) this.$reset(); } //--------------------------------------------------------------------------------- this.shipDied = this.shipWillEnterWitchspace = this.$reset = function _tap_reset() { var oldTarget = this.$oldTarget; if (this.$targetTimer && this.$targetTimer.isRunning) this.$targetTimer.stop(); if (oldTarget) { oldTarget.scannerDisplayColor1 = null; oldTarget.scannerDisplayColor2 = null; } this.$oldTarget = null; } //--------------------------------------------------------------------------------- this.shipDockedWithStation = function _tap_shipDockedWithStation(station) { if (this.$installed) this.$reset(); } //--------------------------------------------------------------------------------- this.shipTargetAcquired = function _tap_newTarget(newTarget) { if (!this.$installed || this.ship.equipmentStatus("EQ_SCANNER_SHOW_MISSILE_TARGET") !== "EQUIPMENT_OK") return; if (!this.$targetTimer) this.$targetTimer = new Timer(this, this.$lockOn, 0, 0.25); else if (!this.$targetTimer.isRunning) this.$targetTimer.start(); } //--------------------------------------------------------------------------------- this.shipTargetLost = this.shipTargetDestroyed = function _tap_lostTarget(lostTarget) { if (this.$installed && this.ship.equipmentStatus("EQ_SCANNER_SHOW_MISSILE_TARGET") === "EQUIPMENT_OK") this.$reset(); } //--------------------------------------------------------------------------------- this.shipBeingAttacked = function _tap_shipBeingAttacked(attacker) { var _player = player; var pship = _player.ship; if (this.$installed && pship.equipmentStatus("EQ_SCANNER_SHOW_MISSILE_TARGET") === "EQUIPMENT_OK" && pship.target == null && attacker && !attacker.isCloaked && !attacker.hasRole("OXP_stealthShip") && !attacker.hasRole("OXP_noAutolock") && !attacker.hasRole("TAP_noAutolock")) { pship.target = attacker; _player.commsMessage("Auto-locked onto attacker - " + attacker.displayName + ".", 5); } } // // Internal Functions // //--------------------------------------------------------------------------------- this.$lockOn = function _tap_lockOn() { var pship = this.ship; var ptarget = ship.target; if (this.$oldTarget && !this.$oldTarget.isValid) this.$oldTarget = null; if (!ptarget || ptarget == pship) { pship.target = null; this.$reset(); return; } if (this.$oldTarget && this.$oldTarget != ptarget) { this.$oldTarget.scannerDisplayColor1 = null; this.$oldTarget.scannerDisplayColor2 = null; } if (this.$oldTarget && ptarget == this.$oldTarget && ptarget.scannerDisplayColor1.toString() == this.$scanColor1.toString() && ptarget.scannerDisplayColor2.toString() == this.$scanColor2.toString()) return; if (ptarget) { this.$oldTarget = ptarget; ptarget.scannerDisplayColor1 = this.$scanColor1; ptarget.scannerDisplayColor2 = this.$scanColor2; } } |