Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Nexus Missile

Content

Warnings

  1. Unresolved dependency reference to Nexus missile:0
  2. No version in dependency reference to Nexus missile:null
  3. Conflict Expansions mismatch between OXP Manifest and Expansion Manager at character position 0047 (DIGIT ZERO vs LATIN SMALL LETTER N)
  4. Unknown key 'upload_date' at https://wiki.alioth.net/img_auth.php/d/da/Oolite.oxp.UK_Eliter.NexusMissile.oxz!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Provides various multi-warhead, semi-automatically-targetting, missiles. Available for purchase in various locations. Provides various multi-warhead, semi-automatically-targetting, missiles. Available for purchase in various locations.
Identifier oolite.oxp.UK_Eliter.NexusMissile oolite.oxp.UK_Eliter.NexusMissile
Title Nexus Missile Nexus Missile
Category Weapons Weapons
Author UK_Eliter UK_Eliter
Version 2.79 2.79
Tags Weapons Weapons
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
  • Nexus missile:0
  • Nexus missile:
  • Information URL http://www.aegidian.org/bb/viewtopic.php?f=4&t=14420 n/a
    Download URL https://wiki.alioth.net/img_auth.php/d/da/Oolite.oxp.UK_Eliter.NexusMissile.oxz http://wiki.alioth.net/img_auth.php/d/da/Oolite.oxp.UK_Eliter.NexusMissile.oxz
    License Creative Commons Attribution - Non-Commercial - Share Alike 4.0 license Creative Commons Attribution - Non-Commercial - Share Alike 4.0 license
    File Size n/a
    Upload date 1646067340

    Documentation

    Also read http://wiki.alioth.net/index.php/Nexus%20Missile

    Readme & License.txt

    ==========================================
    "Nexus missile" OXP by (the unimaginatively named) 'UK_Eliter'
    ==========================================
    
    --------------------------
    GENERAL NOTES
    --------------------------
    
    This OXP provides various multi-warhead, semi-automatically-targetting, missiles.
    
    --------------------------
    LICENSE
    --------------------------
    
    This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license.
    
    This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. 
    To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/ 
    or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. 
    
    You are free: 
    
    � to copy, distribute, display, and perform the work 
    � to make derivative works 
    
    Under the following conditions.
    
    � Attribution. You must give the original author credit. 
    � Non-commercial. You may not use this work for commercial purposes. 
    � Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license materially identical to this one. 
    
    For any reuse or distribution, you must make clear to others the license terms of this work. 
    Any of these conditions can be waived if you get permission from the copyright holder. 
    Your fair use and other rights are in no way affected by the above.
    
    
    ACKNOWLEDGEMENTS
    
    The following provided advice and/or materials for this OXP.
    
    - Eric Walch;
    - Thargoid;
    - Ramirez;
    - Rustem.
    

    Equipment

    Name Visible Cost [deci-credits] Tech-Level
    Nexus Missile yes 10950 8+
    Nexus Bug-Off Missile yes 82500 13+
    Nexus Bug-Off Missile (naval reject) yes 40000 3+
    Nexus Missile (premium version) yes 19000 9+
    Nexus Missile (ultimate version) yes 56000 12+

    Ships

    Name
    nexus Bug-Off Missile (naval reject)
    Nexus missile (basic version)
    Nexus bug-off missile
    Nexus warhead (bug-off version)
    nexus-bugOff-warheadSECONDARY
    Nexus missile (premium version)
    Nexus warhead (premium version)
    Nexus missile (ultimate version)
    Nexus warhead (ultimate version)
    Nexus warhead

    Models

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

    Scripts

    Path
    Scripts/nexus_conditions.js
    /* nexus_conditions.js */
    
    /*
    ------------------------
    JSHINT: Options
    ------------------------
    */
    
    /*jshint esversion: 6*/
    /*jshint sub:true*/
    
    
    this.name = "nexus_conditionsScript";
    this.author = "UK_Eliter";
    this.description = "Conditions script for Nexus missile";
    this.copyright = "2014 Creative Commons: attribution, non-commercial, sharealike.";
    this.licence = "CC-NC-SA 3";
    
    
    /*
    --------------
    DEBUG SWITCHES
    --------------
    */
    
    //this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
    //this.debug = false;
    
    
    
    /*
    ------------------------
    JSHINT: start of wrapper
    ------------------------
    */
    
    (function() {
    	"use strict";
    
    
    	/*
    	---------
    	MAIN CODE
    	---------
    	*/
    
    	this.allowAwardEquipment = function(eqKey, ship, context) {
    		var chance = 0;
    		//
    		switch (eqKey) {
    			case "EQ_NEXUS_BASIC_MISSILE":
    				chance = 0.9;
    				break;
    			case "EQ_NEXUS_PREMIUM_MISSILE":
    				chance = 0.8;
    				break;
    			case "EQ_NEXUS_ULTIMATE_MISSILE":
    				chance = 0.6;
    				break;
    			case "EQ_NEXUS_BUG_MISSILE":
    				if (player.ship.dockedStation === "Navy SecCom Station") {
    					chance = 0.9;
    				} else {
    					chance = 0.4;
    				}
    				break;
    			case "EQ_NEXUS_BUG_R_MISSILE":
    				if (player.ship.dockedStation === "Navy SecCom Station") {
    					chance = 0.5;
    				} else {
    					chance = 0.8;
    				}
    		}
    		if (chance === 0) {
    			return false;
    		}
    		if (Math.random() < 0.9) {
    			if (system.scrambledPseudoRandomNumber(5922) < chance) {
    				return true;
    			}
    		} else if (Math.random() < chance) {
    			return true;
    		}
    		return false;
    	};
    
    
    	/*
    	----------------------
    	JSHINT: end of wrapper
    	----------------------
    	*/
    
    }).call(this);
    
    // EOF
    Scripts/nexus_missile_basicOrPremiumOrUltimate.js
    /* nexus_missile_basicOrPremiumOrUltimate.js */
    
    /*
    ------------------------
    JSHINT: Options
    ------------------------
    */
    
    /*jshint esversion: 6*/
    /*jshint sub:true*/
    
    
    this.name = "nexus_missile_basicOrPremiumOrUltimate";
    this.author = "UK_Eliter";
    this.description = "";
    this.copyright = "2014 Creative Commons: attribution, non-commercial, sharealike.";
    this.licence = "CC-NC-SA 3";
    
    
    /*
    ------------------
    DEBUGGING SWTICHES
    ------------------
    */
    
    //this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
    
    
    /*
    -------
    GLOBALS
    -------
    */
    
    this.debug = false;
    
    this.typeOfNexusMissile = "undetermined";
    
    
    /*
    ------------------------
    JSHINT: start of wrapper
    ------------------------
    */
    
    (function() {
    	"use strict";
    
    
    	/*
    	====================
    	MAIN CODE
    	====================
    	*/
    
    	this.shipSpawned = function() {
    		this.MissileEnergyThreshhold = this.ship.maxEnergy * 0.8;
    		if (this.ship.hasRole("EQ_NEXUS_BASIC_MISSILE")) {
    			this.typeOfNexusMissile = "basic";
    		} else if (this.ship.hasRole("EQ_NEXUS_PREMIUM_MISSILE")) {
    			this.typeOfNexusMissile = "premium";
    		} else {
    			this.typeOfNexusMissile = "ultimate";
    		}
    		delete this.shipSpawned;
    	};
    
    	this.shipTakingDamage = function(amount, whom, type) {
    		if (this.ship.target) {
    			if (whom == this.ship.target) {
    				if (type === "scrape damage") {
    					this.$detonate();
    					return;
    				}
    			}
    		}
    		if (amount > 60 && Math.random() < 0.9) {
    			return;
    		}
    		if (this.ship.energy > this.MissileEnergyThreshhold || Math.random() > 0.8) {
    			return;
    		}
    		this.$spawnWarheads();
    	};
    
    	this.$isHostile = function(e) {
    		// if (this.debug) {player.consoleMessage("Hostile scan from MISSILE script", 6);}
    		return e.isShip && e.hasHostileTarget && (e.target == this.ship.owner);
    	};
    
    
    	this.$spawnWarheads = function() {
    		// SPAWN THE WARHEADS & do related stuff *
    
    		// Note: original missile will be removed by its AI
    		if (!this.ship || !this.ship.owner || !this.ship.owner.isValid) {
    			return;
    		}	
    
    		var numWarheads;
    		var submunition;
    		switch (this.typeOfNexusMissile) {
    			case "basic":
    				numWarheads = 3;
    				submunition = "nexus_warhead";
    				break;
    			case "premium":
    				numWarheads = 3;
    				submunition = "nexus-premium-warhead";
    				break;
    			case "ultimate":
    				numWarheads = 4;
    				submunition = "nexus-ultimate-warhead";
    		}
    
    		// Actual spawn
    		var warheads = this.ship.spawn(submunition, numWarheads); // this will set warheads targets to the missile's target
    		var counter;
    		// set the owner of the warhead to the original missile's owner. Can't set '.owner' because read-only.
    		for (counter = 0; counter < numWarheads; counter++) {
    			warheads[counter].ultimateOwner = this.ship.owner;
    		}
    
    		// ALLOCATE TARGETS etc TO THE WARHEADS *
    		var targets = system.filteredEntities(this, this.$isHostile, this.ship.owner, this.ship.owner.scannerRange);
    		var numTargets = targets.length;
    		// NN: NOT 'if (numTargets < 2)' - i.e. abort if no target or one target - because could be one hostile AND missile's original target. We will investigate that below.
    		if (numTargets < 1) {
    			// if (this.debug) {player.consoleMessage("Missile script - No hostiles", 8);}
    			this.ship.explode(); // Do need this here!
    			return; // need do nothing else, because all the warheads will be set to what is, presently, their only possible target, = the original one. (If that target's been lost, the warhead AI will deal with that.)
    		}
    		// Create an array of possible targets, and a corresponding array that will record whether a potential target has yet been targeted
    		var isTargetTargetted = new Array(numTargets);
    		for (counter = 0; counter < numTargets; counter++) {
    			isTargetTargetted[counter] = false;
    		}
    		var startWarheadCounterAt;
    		if (this.ship.target && this.ship.target.isValid) {
    			// if (this.debug) {player.consoleMessage("Warhead 0 target is"+warheads[0].target, 8);player.consoleMessage("Num targets is "+numTargets, 8);}
    			// Now see if the target warheads inherited from the missile is *amongst the array of possible targets.* If it is (may not be, 'cos initial target may not be hostile) mark the ship as targetted. 
    			for (counter = 0; counter < numTargets; counter++) {
    				if (targets[counter] == warheads[0].target) {
    					isTargetTargetted[counter] = true;
    					break;
    				}
    			}
    			startWarheadCounterAt = 1; // determine which warhead the targetting procedure should start with
    		} else {
    			startWarheadCounterAt = 0;
    		}
    		// Use the array of potential targets (hostiles) to assign targets to rest of the warheads (that 'rest' being either (1) all of them or (2) all but the first one)
    		// if (this.debug) {player.consoleMessage("Script targetting starts with (could be 0): "+startWarheadCounterAt, 6);}
    		var warheadCounter;
    		for (warheadCounter = startWarheadCounterAt; warheadCounter < numWarheads; warheadCounter++) {
    			for (counter = 0; counter < numTargets; counter++) {
    				if (!isTargetTargetted[counter]) {
    					warheads[warheadCounter].target = targets[counter];
    					isTargetTargetted[counter] = true;
    					// if (this.debug) {player.consoleMessage("Warhead "+ warheadCounter +" target: "+ targets[counter], 6);}
    					break; // have given the warhead a target, so should stop trying to do that!
    				}
    			}
    		}
    		this.ship.explode();
    	};
    
    	this.$detonate = function() {
    		// function dealEnergyDamage(damage : Number, idealRange : Number [, velocityBias : Number])
    		// The standard Oolite missile uses dealEnergyDamage(170, 32.5, 0.25), has a maximum speed of 0.75LM, and its AI tries to detonate it 25m from its target. [NB: If target within ideal range, takes full damage.]
    		switch (this.typeOfNexusMissile) {
    			case "basic":
    				this.ship.dealEnergyDamage(330, 50, 0.25);
    				break;
    			case "premium":
    				this.ship.dealEnergyDamage(470, 70, 0.25);
    				break;
    			case "ultimate":
    				this.ship.dealEnergyDamage(600, 90, 0.25);
    		}
    		this.ship.explode();
    	};
    
    
    	/*
    	=======================
    	JSHINT: end of wrapper
    	=======================
    	*/
    
    }).call(this);
    
    // EOF
    Scripts/nexus_missile_bugOff.js
    /* nexus_missile_bugOff.js */
    
    /*
    ------------------------
    JSHINT: Options
    ------------------------
    */
    
    /*jshint esversion: 6*/
    /*jshint sub:true*/
    
    
    this.name = "nexus_missile_bugOff";
    this.author = "UK_Eliter";
    this.description = "Script for Nexus BugOff missile";
    this.copyright = "2014 Creative Commons: attribution, non-commercial, sharealike.";
    this.licence = "CC-NC-SA 3";
    
    
    /*
    --------------
    DEBUG SWTICHES
    --------------
    */
    
    // this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
    // this.debug = false;
    
    
    /*
    ------------------------
    JSHINT: start of wrapper
    ------------------------
    */
    
    (function() {
    	"use strict";
    
    
    	/*
    	---------
    	MAIN CODE
    	---------
    	*/
    
    	this.shipSpawned = function() {
    		this.MissileEnergyThreshhold = this.ship.maxEnergy * 0.7;
    		delete this.shipSpawned;
    	};
    
    	this.shipTakingDamage = function(amount) {
    		if (amount > 65 || this.ship.energy > this.MissileEnergyThreshhold) {
    			return;
    		}
    		if (Math.random() < 0.9) {
    			this.$spawnWarheads();
    		}
    	};
    
    	this.$spawnWarheads = function() {
    		var chanceMalfunction;
    		if (this.ship.hasRole("EQ_NEXUS_BUG_R_MISSILE")) {
    			chanceMalfunction = 0.1;
    		} else {
    			chanceMalfunction = 0.025;
    		}
    		var totalNumberOfWarheadsToBeSpawned;
    		if (Math.random() < chanceMalfunction) {
    			// Malfunctioning missile
    			totalNumberOfWarheadsToBeSpawned = ~~(Math.random() * 5); // = Between - and 4.
    			if (totalNumberOfWarheadsToBeSpawned < 3) {
    				if (Math.random() < 0.7) {
    					totalNumberOfWarheadsToBeSpawned++;
    				} else if (totalNumberOfWarheadsToBeSpawned === 0) {
    					if (Math.random() < 0.3) {
    						this.ship.explode();
    					} else {
    						this.ship.switchAI("nullAI.plist");
    					}
    					return;
    				}
    			}
    		} else {
    			totalNumberOfWarheadsToBeSpawned = 5;
    		}
    
    		var primaryWarhead = this.ship.spawnOne("nexus-bug-warhead-primary");
    		// PRIMARY warhead. Its target will be the missile's target
    
    		if (totalNumberOfWarheadsToBeSpawned > 1) {
    			var secondaryWarheads;
    			if (!primaryWarhead || !primaryWarhead.isValid) {
    				secondaryWarheads = this.ship.spawn("nexus-bug-warhead-secondary", totalNumberOfWarheadsToBeSpawned);
    				// this will set warheads targets to the missile's target
    			} else {
    				secondaryWarheads = this.ship.spawn("nexus-bug-warhead-secondary", (totalNumberOfWarheadsToBeSpawned - 1));
    				// this will set warheads targets to the missile's target
    			}
    		}
    		// this.ship.switchAI("nullAI.plist");
    		this.ship.explode();
    	};
    
    	this.$detonate = function() {
    		// Called only by AI.
    		this.ship.dealEnergyDamage(650, 50, 0.25);
    		this.ship.explode();
    	};
    
    
    	/*
    	----------------------
    	JSHINT: end of wrapper
    	----------------------
    	*/
    
    }).call(this);
    
    
    // EOF
    Scripts/nexus_warhead_basicOrPremiumOrUltimate.js
    /* nexus_warhead_basicOrPremiumOrUltimate.js */
    
    /*
    ------------------------
    JSHINT: Options
    ------------------------
    */
    
    /*jshint esversion: 6*/
    /*jshint sub:true*/
    
    
    this.name = "nexus_warhead_basicPremiumOrUltimate";
    this.author = "UK_Eliter";
    this.description = "Script for Nexus missile warheads";
    this.copyright = "2014 Creative Commons: attribution, non-commercial, sharealike.";
    this.licence = "CC-NC-SA 3";
    
    // Associated AI: nexus_warheadAI.PLIST
    
    
    /*
    --------------
    DEBUG SWTICHES
    --------------
    */
    
    //this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
    //this.debug = false;
    
    
    /*
    -------
    GLOBALS
    -------
    */
    
    this.typeOfWarhead = 0; // This gets set to something meaningful below.
    
    
    /*
    ------------------------
    JSLINT: start of wrapper
    ------------------------
    */
    
    (function() {
    	"use strict";
    
    
    	/*
    	--------------
    	EVENT HANDLERS
    	--------------
    	*/
    
    	this.shipSpawned = function() {
    		if (this.ship.primaryRole === "nexus_warhead") {
    			this.typeOfWarhead = 1; // 1 = basic
    		} else if (this.ship.primaryRole === "nexus-premium-warhead") {
    			this.typeOfWarhead = 2; // 2 = premium;
    		} else {
    			this.typeOfWarhead = 3; // 3 = ultimate;
    		}
    		this.oldTarget = 0;
    		delete this.shipSpawned;
    	};
    
    	this.shipTakingDamage = function(amount, whom, type) {
    		//if (this.debug) {player.consoleMessage("Warhead AI - taking damage:" + amount, 5);}
    		if (amount > 14) {
    			return;
    		}
    		if (Math.random() < 0.2) {
    			this.ship.energy = this.ship.energy + amount; // Prevent it from being destroyed - but also so that we can *detonate* it.
    			this.$detonate();
    		}
    	};
    
    
    	/*
    	---------------
    	OTHER FUNCTIONS
    	---------------
    	*/
    
    	this.$detonateOrSeek = function() {
    		if (this.ship.target && !this.ship.target.isValid) {
    			this.$detonate();
    			return;
    		}
    		this.ship.reactToAIMessage("SCRIPT_SEEK");
    	};
    
    
    	this.$scanForTargets = function() {
    		//if (this.debug) {player.consoleMessage("Scanning for targets", 6);}
    		function $isHostileToOwnerOrWarhead(e) {
    			if (this.ship.ultimateOwner && this.ship.ultimateOwner.isValid) {
    				return e.isShip && e.hasHostileTarget && (e.target == this.ship.ultimateOwner || e.target == this.ship);
    			} else {
    				return e.isShip && e.hasHostileTarget && (e.target == this.ship);
    			}
    		}
    		var targetsArray = system.filteredEntities(this, $isHostileToOwnerOrWarhead, this.ship, this.ship.scannerRange);
    		if (targetsArray.length > 0) {
    			this.ship.target = targetsArray[0]; // go for nearest
    			this.ship.reactToAIMessage("TARGET");
    			this.ship.oldTarget = this.ship.target;
    		} else if ((this.oldTarget !== 0) && this.oldTarget.isValid) {
    			//if (this.debug) {player.consoleMessage("Nexus warhead - located first found target", 4);}
    			this.ship.target = this.oldTarget;
    			this.ship.reactToAIMessage("TARGET");
    			this.oldTarget = 0; // reset it
    		} else {
    			this.ship.reactToAIMessage("NO_TARGET");
    		}
    	};
    
    	this.$detonate = function() {
    		// function dealEnergyDamage(damage : Number, idealRange : Number [, velocityBias : Number])
    		// The standard Oolite missile uses dealEnergyDamage(170, 32.5, 0.25), has a maximum speed of 0.75LM, and its AI tries to detonate it 25m from its target. [NB: If target within ideal range, takes full damage.]
    		//
    		// 1 = basic; 2 = premium; 3 = ultimate.
    		switch (this.typeOfWarhead) {
    			case 1:
    				this.ship.dealEnergyDamage(110, 27, 0.25);
    				break;
    			case 2:
    				this.ship.dealEnergyDamage(150, 31, 0.22);
    				break;
    			case 3:
    				this.ship.dealEnergyDamage(195, 36, 0.15);
    		}
    		this.ship.explode();
    	};
    
    
    	/*
    	----------------------
    	JSHINT: end of wrapper
    	----------------------
    	*/
    
    }).call(this);
    
    // EOF
    Scripts/nexus_warhead_bugOff.js
    /* nexus_warhead_bugOff.js */
    
    /*
    ------------------------
    JSHINT: Options
    ------------------------
    */
    
    /*jshint esversion: 6*/
    /*jshint sub:true*/
    
    
    this.name = "nexus_warhead_bugOff";
    this.author = "UK_Eliter";
    this.description = "Script for Nexus BugOff warhead";
    this.copyright = "2014 Creative Commons: attribution, non-commercial, sharealike.";
    this.licence = "CC-NC-SA 3";
    
    // Associated AI	nexus_warheadAI.PLIST
    
    
    /*
    --------------
    DEBUG SWTICHES
    ---------------
    */
    //this.logging = true; // THIS SHOULD BE COMMENTED OUT WHEN NOT TESTING
    //this.debug = false;
    
    
    /*
    ------------------------
    JSHINT: start of wrapper
    ------------------------
    */
    
    (function() {
    	"use strict";
    
    
    	/*
    	---------
    	MAIN CODE
    	---------
    	*/
    
    	this.$isBug = function(e) {
    		return e.isShip && e.isThargoid;
    	};
    
    
    	// Called only by AI.
    	this.$detonate = function() {
    		this.ship.dealEnergyDamage(140, 30, 0.14);
    		// function dealEnergyDamage(damage : Number, idealRange : Number [, velocityBias : Number])
    		// The standard Oolite missile uses dealEnergyDamage(170, 32.5, 0.25), has a maximum speed of 0.75LM, and its AI tries to detonate it 25m from its target. [NB: If target within ideal range, takes full damage.]
    
    		// Deal additional damage to anything thargoid.
    		var s = system.filteredEntities(this, this.$isBug, this.ship, 150);
    		var i = s.length;
    		while (i--) {
    			s[i].energy -= 65;
    		}
    
    		// Remove the warhead.
    		this.ship.explode();
    	};
    
    
    	/*
    	----------------------
    	JSHINT: end of wrapper
    	----------------------
    	*/
    
    }).call(this);
    
    
    // EOF