Back to Index | Page generated: Dec 20, 2024, 7:22:09 AM |
from Expansion Manager's OXP list | from Expansion Manifest | |
---|---|---|
Description | Prevent accidental Q-Bomb and other mine launches when using missiles. In addition when a fast activation key is set to this equipment then surely launch a missile and not a Q-Bomb. | Prevent accidental Q-Bomb and other mine launches when using missiles. In addition when a fast activation key is set to this equipment then surely launch a missile and not a Q-Bomb. |
Identifier | oolite.oxp.Norby.SafetyCatch | oolite.oxp.Norby.SafetyCatch |
Title | SafetyCatch | SafetyCatch |
Category | Equipment | Equipment |
Author | Norby | Norby |
Version | 1.3 | 1.3 |
Tags | ||
Required Oolite Version | ||
Maximum Oolite Version | ||
Required Expansions | ||
Optional Expansions | ||
Conflict Expansions | ||
Information URL | http://wiki.alioth.net/index.php/SafetyCatch | n/a |
Download URL | https://wiki.alioth.net/img_auth.php/2/24/SafetyCatch_1.3.oxz | n/a |
License | CC BY-NC-SA 3 | CC BY-NC-SA 3 |
File Size | n/a | |
Upload date | 1610873250 |
Also read http://wiki.alioth.net/index.php/SafetyCatch
Safety Catch OXP If you ever dropped a Q-Bomb accidentally when wanted to launch a missile then this equipment is for you. All mine will be replaced by a "mine in safety" rectangle on your HUD if this catch is in safe state. Prime "Mine Safety Catch" equipment by Shift+N then press mode (b) key to arm your mines. Press again for safety. The activate (n) key launch the first available missile and surely not a bomb. This allow to set a fast activation key (named to Item shoprtcut 1 and 2 in keyboard settings screen) to this equipment and fire a missile to your target without risking a bomb drop regardless of the catch is not in safe position. Safety Catch defend Q-Bombs only by default. If you use custom mines from OXPs then you can enable the handling of these in safetycatch.js by setting the SafetyCatchQMineOnly variable to false, but this part of the code is caused problems to a player (awarded more mine than bought before) what I can not fix due to I can not reproduce, so be wise with it and report if you get it also. Cost: 20.0 Cr Techlevel: 1 Dependencies: Oolite v1.77 or later. Instructions: Unzip the file, and then move the folder named ".oxp" into the AddOns directory of your Oolite installation. License: This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0. If you are re-using any piece of this OXP, please let me know by sending an e-mail to norbylite@gmail.com. Changelog: 2015.05.15. v1.3 Activate key launch a missile. The arm-disarm mines feature transferred to the mode key. 2014.01.04. v1.2 Fixed problems reported by ffutures. 2013.12.27. v1.1 Cost raised to 20cr. 2013.12.26. v1.0 Initial release.
Name | Visible | Cost [deci-credits] | Tech-Level |
---|---|---|---|
Mine Safety Catch | yes | 200 | 1+ |
Safety Mine | yes | 0 | 100+ |
Name |
---|
Safety Mine |
Path | |
---|---|
Scripts/safetycatch.js | "use strict"; this.name = "safetycatch"; this.author = "Norby"; this.copyright = "2013 Norbert Nagy"; this.licence = "CC BY-NC-SA 4.0"; this.description = "Use to prevent unwanted launch of your mines."; //customizable properties this.$SafetyCatchQMineOnly = true; //turn off if you use custom mines also, but test it carefully //due to ffutures reported the following bug using the custom-mines code: //"it gave me two mines although there was only one loaded - the next time TWO appeared after I fired." //internal properties, should not touch this.$SafetyCatchIsSafe = true; //true if catch currently prevent launching mines this.$SafetyCatchMines = []; //array of guarded mines to award these back when catch turned off //world script events this.startUp = function() { this.$SafetyCatchIsSafe = false; //true if catch currently prevent launching mines var m = player.ship.missiles; var i=-1; while(m[++i]) { if( m[i].equipmentKey == "EQ_SAFETY_MINE" ) { this.$SafetyCatchIsSafe = true; //true if catch currently prevent launching mines } } var mv = missionVariables.$SafetyCatchMines; if( !mv ) this.$SafetyCatchMines = []; //array of guarded mines to award these back when catch turned off else if( (mv+"").indexOf(",") ) this.$SafetyCatchMines = (mv+"").split(","); //need +"" for bugfix else this.$SafetyCatchMines = [mv]; } this.equipmentDamaged = this.equipmentDestroyed = function(equipment) { if( equipment == "EQ_SAFETYCATCH" ) this.$SafetyCatchOff(); } this.equipmentRepaired = function(equipment) { if( equipment == "EQ_SAFETYCATCH" ) this.$SafetyCatchOn(); } this.playerBoughtEquipment = function(equipmentKey) { if( equipmentKey == "EQ_SAFETYCATCH" ) { this.$SafetyCatchOn(); // player.ship.setEquipmentStatus("EQ_SAFETYCATCH", "EQUIPMENT_DAMAGED");//test of repair cost } if( ( equipmentKey == "EQ_QC_MINE" && this.$SafetyCatchQMineOnly || !this.$SafetyCatchQMineOnly && equipmentKey != "EQ_SAFETY_MINE" && equipmentKey.substr(-5,5) == "_MINE" ) && player.ship.equipmentStatus("EQ_SAFETYCATCH") == "EQUIPMENT_OK" ) { this.$SafetyCatchMines.push( equipmentKey ); player.ship.removeEquipment( equipmentKey ); player.ship.awardEquipment( "EQ_SAFETY_MINE" ); player.consoleMessage("Your new mine is in safe state."); } } this.playerWillSaveGame = function(message) { missionVariables.$SafetyCatchMines = this.$SafetyCatchMines; } //SafetyCatch methods this.$SafetyCatchOn = function() { //replace mines with safety mines if( player.ship.equipmentStatus("EQ_SAFETYCATCH") != "EQUIPMENT_OK" ) return; //damaged or not installed var w = worldScripts["safetycatch"]; var k = ""; var m = player.ship.missiles; var oldlength = w.$SafetyCatchMines.length; var i=-1; while(m[++i]) { k = m[i].equipmentKey; if( w.$SafetyCatchQMineOnly && k == "EQ_QC_MINE" || !w.$SafetyCatchQMineOnly && k != "EQ_SAFETY_MINE" && k.substr(-5,5) == "_MINE" ) { w.$SafetyCatchMines.push( k ); player.ship.removeEquipment( k ); if( w.$SafetyCatchQMineOnly ) player.ship.awardEquipment( "EQ_SAFETY_MINE" ); } // log("safetycatch", k+" "+k.substr(-5,5)+" "+w.$SafetyCatchMines); } var newlength = w.$SafetyCatchMines.length; if( !w.$SafetyCatchQMineOnly ) for( var i = oldlength; i < newlength; i++ ) player.ship.awardEquipment( "EQ_SAFETY_MINE" ); w.$SafetyCatchIsSafe = true; player.consoleMessage("Mines in safe state."); } this.$SafetyCatchOff = function() { //replace safety mines with saved mines var w = worldScripts["safetycatch"]; if( w.$SafetyCatchQMineOnly ) { var m = player.ship.missiles; var s = 0; for( var i = 0; i < m.length; i++ ) if( m[i].equipmentKey == "EQ_SAFETY_MINE" ) s++; for( var i = 0; i < s; i++ ) { player.ship.removeEquipment( "EQ_SAFETY_MINE" ); player.ship.awardEquipment( "EQ_QC_MINE" ); } } else { var m = w.$SafetyCatchMines; for( var i = 0; i < m.length; i++ ) { player.ship.removeEquipment( "EQ_SAFETY_MINE" ); player.ship.awardEquipment( m[i] ); } } delete w.$SafetyCatchMines; w.$SafetyCatchMines = []; w.$SafetyCatchIsSafe = false; player.consoleMessage("Mines ARMED!"); } |
Scripts/safetycatcheq.js | "use strict"; this.name = "safetycatcheq"; this.author = "Norby"; this.copyright = "2013 Norbert Nagy"; this.licence = "CC BY-NC-SA 4.0"; this.description = "Use to prevent unwanted launch of your mines."; //equipment events this.activated = function() { if( !player.ship.missilesOnline ) { player.consoleMessage("Arm your missiles first."); return; } var w = worldScripts["safetycatch"]; var back = false; if( !w.$SafetyCatchIsSafe ) { w.$SafetyCatchOn(); back = true; } player.ship.fireMissile(); if(back) w.$SafetyCatchOff(); } this.mode = function() { var w = worldScripts["safetycatch"]; if( w.$SafetyCatchIsSafe ) w.$SafetyCatchOff(); else w.$SafetyCatchOn(); } |
Scripts/safetymine.js | "use strict"; this.name = "safetymine"; this.author = "Norby"; this.copyright = "2013 Norbert Nagy"; this.licence = "CC BY-NC-SA 3.0"; this.description = "Use to prevent unwanted launch of your mines."; this.version = "1.2"; this.shipSpawned = function() { player.ship.awardEquipment("EQ_SAFETY_MINE"); player.consoleMessage("Arm your mine with Mine Safety Catch.", 5); this.ship.remove(true); } |