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

Expansion Military Shields Ships

Content

Warnings

  1. Unresolved dependency reference to oolite.oxp.Ngalo.NPC_Energy_Units:0
  2. No version in dependency reference to oolite.oxp.Ngalo.N-Shields:null
  3. No version in dependency reference to oolite.oxp.Ngalo.NPC_Equipment_Damage:null
  4. No version in dependency reference to oolite.oxp.Ngalo.NPC_Energy_Units:null
  5. Optional Expansions mismatch between OXP Manifest and Expansion Manager at character position 0060 (DIGIT ZERO vs LATIN SMALL LETTER N)
  6. Unknown key 'upload_date' at https://wiki.alioth.net/img_auth.php/d/d4/MilitaryShields_Ships.oxz!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description This OXP set a military shields for NPC-ships with large monolithic mass. This OXP set a military shields for NPC-ships with large monolithic mass.
Identifier oolite.oxp.Rustem.MilitaryShields_Ships oolite.oxp.Rustem.MilitaryShields_Ships
Title Military Shields Ships Military Shields Ships
Category Ships Ships
Author Rustem Rustem
Version 0.2.0 0.2.0
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
  • oolite.oxp.Ngalo.N-Shields:0
  • oolite.oxp.Ngalo.NPC_Equipment_Damage:0
  • oolite.oxp.Ngalo.NPC_Energy_Units:0
  • oolite.oxp.Ngalo.N-Shields:
  • oolite.oxp.Ngalo.NPC_Equipment_Damage:
  • oolite.oxp.Ngalo.NPC_Energy_Units:
  • Conflict Expansions
    Information URL http://aegidian.org/bb/viewtopic.php?f=4&t=18127&p=261523 n/a
    Download URL https://wiki.alioth.net/img_auth.php/d/d4/MilitaryShields_Ships.oxz http://wiki.alioth.net/img_auth.php/d/d4/MilitaryShields_Ships.oxz
    License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
    File Size n/a
    Upload date 1610873479

    Documentation

    Also read http://wiki.alioth.net/index.php/Military%20Shields%20Ships

    readme.txt

    Military Shields Ships
    By Rustem
    
    This OXP based on the N-Shields OXP. Thanks go to Ngalo for his N-Shields code.
    
    Overview (WIP)
    ========
    
    This OXP set a military shields for NPCs with large mass. This ship upgrade include in-build shield boosters and energy grids(grid technologies).
    
    (!) This ship only for NPCs, so:
         - player has many equipment OXPs for upgrade: Energy Capacitors, Naval Grids, Shield Cycler and Ship Configuration.
         - also if will solved a compartibility with equipment OXPs, this grid technologies will available for player ship.
    
    For NPCs has highest energy recharge rate (more 10, simulated NEU), this OXP will replaced usual shield boosters to NPC Shield Boosters and NPC Shield Enhancers in order to simulate correctly and avoid an overfitting recharge rate.
    
    Military Multiply Shields Enhancement (MMS) = grid technologies = (?). //WAIT
    
    The lebel 'MMS' from ship names will deleted before public release.
    
    
    Recommended OXP's (WIP)
    =================
    
    The following OXP's are listed as recommended:
    
    - NShields (v0.7.1). //WIP: create a simple script mechanics(like used in vanila oolite)
    
    The following OXP's are listed as recommended, in that additional ships will become available if they are installed.
    
    - gsagostinho's Texture Packs
    	Added a 3 ships: Cobra Mark IV(1 textures), Python(v1.1, 1 texture).
    
    - Griff's Retextures : TODO
            Added a 2 ships: Cobra Mark III(v1.04, 2 textures).
    	
    - wildShips's Shipset (v0.9.1) : TODO
            Added a 3 ships: Chatu, Duma(2 ships).
    
    - Laser Cannons (v1.12)
            Rebalance addition ships with laser cannons. Added a 17 ships: Anaconda(4 ships), Boa(3 ships), Boa Class Cruiser(3 ships), Cobra Mark III(2 ships), Python(5 ships).
    
    - Sniper Gun (v1.3)
            Added a 2 ships: Python, Python BattleCruiser.
    
    - Staer9's Shipset (v1.12)
            Added a 1 ship: Python ET Special.
    
    
    Optional OXP's
    ==============
    
    - NPC Equipment Damage
          Helps balance this OXP by allowing NPC equipment to be damaged when shields are down.
    
    - NPC_Energy_Units
          Allowing NPCs to fit extra energy units is important for fairness if they have proper Military Shield Enhancers.
          TODO: Need upgrade for correct set a recharge rates for ship with simulated EEU and NEU.
    
    
    License
    =======
    This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
    
    Discussion
    ==========
    This OXP is discussed at this forum link: http://aegidian.org/bb/viewtopic.php?f=4&t=18127&p=261523 //TEMP
    
    http://aegidian.org/bb/viewtopic.php?f=4&t=18127 // NShields OXP
    
    Info
    ====
    http://wiki.alioth.net/index.php/Military_Shield_Enhancement //TODO : /Military_Multiply_Shields
    
    
    Version History
    ===============
    
    0.2.0
    - Adds the Naval Energy Unit for NEU simulated.
    - Adjustments a max shields and shield recharge rates.
    - Upgrade of the main script (thanks go to Ngalo for his N-Shields code).
    
    0.1.0
    - Added the script for spawn of the military ships without N-Shields OXP.
    - Added a recharge rate in the script info.
    
    0.0.3
    - Added a ships with with laser cannons : anaconda-pirate-lasercannon and anaconda-lasercannon(4 ships), boa-pirate-lasercannon2, boa-mk2-lasercannon(3 ships), python-lasercannon(3 ships).
    - Reduced military shield vars : python-sg, python-battlecruiser.
    - Renamed and resorted a some roles.
    
    0.0.2
    - For experimental testing added script_info vars: cargoext, recharge.
    - Added a ships with with laser cannons : python-blackdog-lasercannon and python-lasercannon.
    - Deleted a word 'MMS' from ship names.
    - Added a optional oxps to manifest.
    
    0.0.1
    - Initial beta release.
    
    
    --------------------------------------------------------------------------------
     Help info
    --------------------------------------------------------------------------------
    
    For simulated the NEG a max shields must be more 256. A shield recharge least than ~ 95% from (recharge * 1.5) * 0.5.
    
    Table:
    --------------------------------------------------------------------------------------------------
    Ship:           info:[max_cargo: max_energy/recharge  grid/max_shield/shield_recharge        max ]
    --------------------------------------------------------------------------------------------------
    
    //--- Oolite-core ships ---
    
    Ship mass > 350t        info                                                                 max cargo reduced to
    ----------------
    anaconda                250: 500/15.0                 192/448/4.66                           -
    anaconda-pirate
    
    Ship mass > 300t
    ----------------
    -> cobra_mk4            45: 320/13.5                   144/400/4.25                           -
    
    Ship mass > 250t
    ----------------
    python                  100: 450/12.0                  128/384/3.8                            -
    python-blackdog
    python-trader
    
    Ship mass > 200t
    ----------------
    boa-mk2                 175: 525/12.0                  160/416/3.8                            -
    boa-mk2-pirate
    
    cobra3-trader           20: 256/12.0                   128/384/3.8                            -
    cobra3-alternate
    cobra3-pirate
    
    Ship mass > 150t
    ----------------
    boa                     125: 450/10.65                  96/352/3.34                            -
    boa-pirate
    
    
    //--- ships OXPs ---
    
    Ship mass > 350t
    ----------------
    dtt_cyclops
    kirin-cv
    kirin-m-police
    wildShips_chatu_trader
    wildShips_chatu_hunter
    wildShips_tribalChatu
    wildShips_tembo
    wildShips_dumaFleet
    mw-asp
    
    Ship mass > 300t
    ----------------
    cobra_mk4*              45: 320/13.5                   144/400/4.25                           -
    python-x                145: 450/13.5                  144/400/4.25                           -
    
    Ship mass > 250t
    ----------------
    python-cruiser          100: 350/13.5                  144/400/4.25                           -
    python-hsg              100: 450/13.5                  144/400/4.25                           -
    python-battlecruiser    100: 450/13.5                  144/400/4.25                           -
    
    python_red-mms          100: 450/12.0                  128/384/3.8                            -
    python-lasercannon-mms  100: 450/12.0                  128/384/3.8                            -
    
    Ship mass > 200t
    ----------------
    cobra3-cannon           20: 256/12.0                   128/384/3.8                            -
    cobra3-sg               20: 256/12.0                   128/384/3.8                            -
    gsagostinho_cobra3**
    griff_cobra_Mk3***
    wildShips_duma****
    z_groovy_cobra_Mk3*****
    
    Ship mass > 150t
    ----------------
    cobra2x
    boa-sg                 125: 450/10.65                   96/352/3.34                            -
    dtt_kraken
    dtt_war_lance
    dtt_galaxy_liner
    feudal_prince_Pirate_shipset
    feudal_prince_Hunter_shipset
    
    ---
    
    (*)
    gsagostinho_cobra_mk4_pirate-NPC, x9, v1.4
    gsagostinho_cobra_mk4_trader-NPC, x6, v1.4
    
    (**)
    gsagostinho_cobra3-NPC, x21, v1.5
    gsagostinho_cobra3_pirate-NPC,x2,v1.5
    gsagostinho-cobra3_blue_darkblue-sg
    gsagostinho-cobra3_neon_pink-sg
    
    (***)
    griff_cobra_Mk3_trader-NPC, x5, v1.04
    griff_cobra_Mk3_pirate-NPC, x5, v1.04
    griff_cobra_Mk3_alt-sg
    griff_cobra_Mk3_alt_pirate-NPC_scuffed, v1.3.4
    griff_cobra_Mk3_alt_trader-NPC_clean, v1.3.4
    griff_cobra_Mk3_alt_trader-NPC_scuffed, v1.3.4
    
    (****)
    wildShips_duma
    wildShips_tribalDuma
    wildShips_policeDuma
    
    (*****)
    noshaders_z_groovy_cobra_Mk3_alpha-NPC, x28
    
    ================================================================================
    

    Equipment

    Name Visible Cost [deci-credits] Tech-Level
    Naval Energy Grid yes 650000 101+
    Naval Energy Unit yes 500000 101+
    Shield Boosters yes 147500 101+
    Military Shield Enhancement yes 475500 101+

    Ships

    Name
    Anaconda
    Anaconda
    Anaconda
    Anaconda
    Anaconda
    Boa Class Cruiser
    Boa Class Cruiser
    Boa Class Cruiser
    Boa Class Cruiser
    Boa
    Boa
    Boa
    Boa
    Cobra Mark III
    Cobra Mark III
    Cobra Mark IV
    Python BattleCruiser
    Python
    Python
    Python
    Python
    Python
    Python
    Python
    python-staer9-mms
    Python

    Models

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

    Scripts

    Path
    Config/script.js
    "use strict";
    
    this.name = "MilitaryShields_Ships";
    this.author = "Rustem";
    this.copyright = "2018";
    this.description = "Script for spawn of the military ships without N-Shields OXP";
    this.licence = "CC-BY-SA 4.0";
    this.version = "0.2";
    
    //---- Logging ----
    
    this.logging = false;
    this.debugging = null; // used in check for special event. 
    
    //---- Start Setting ----
    
    this.NEU_multiplier = parseFloat(EquipmentInfo.infoForKey("EQ_MMS_NPC_NAVAL_ENERGY_UNIT").scriptInfo.oolite_energy_recharge_multiplier);
    this.EEU_multiplier = parseFloat(EquipmentInfo.infoForKey("EQ_MMS_NPC_NAVAL_ENERGY_UNIT").scriptInfo.oolite_energy_recharge_multiplier);
    
    // Shield Boosters
    this.SB_shields = 2 * parseInt(EquipmentInfo.infoForKey("EQ_SHIELD_BOOSTER").scriptInfo.oolite_shield_increase);
    this.SB_multiplier = parseFloat(EquipmentInfo.infoForKey("EQ_SHIELD_BOOSTER").scriptInfo.oolite_shield_recharge_multiplier);
    
    // Military Shield Enhancement, Shield Enhancers
    this.MSE_shields = 2 * parseInt(EquipmentInfo.infoForKey("EQ_MMS_NPC_SHIELD_ENHANCER").scriptInfo.oolite_shield_increase);
    this.MSE_multiplier = parseFloat(EquipmentInfo.infoForKey("EQ_MMS_NPC_SHIELD_ENHANCER").scriptInfo.oolite_shield_recharge_multiplier);
    
    this.NEG_shields = 2 * parseInt(EquipmentInfo.infoForKey("EQ_MMS_NPC_NAVAL_ENERGY_GRID").scriptInfo.oolite_shield_increase);
    this.NEG_multiplier = parseFloat(EquipmentInfo.infoForKey("EQ_MMS_NPC_NAVAL_ENERGY_GRID").scriptInfo.oolite_shield_recharge_multiplier);
    // or read from ship script_info
    
    //---- WorldScript Event Handlers ----
    
    this.startUp = function () {
    	if (worldScripts.NShields) this.$npc_shields = true;
    	if (worldScripts.NPC_Energy_Units) this.$npc_units = true;
    
    	// if (worldScripts.ShipConfiguration_NPCShips) { // TODO: if the Naval Energy Unit will damaged
    	// 	this.NPC_equipmentDamagedHandlers.push(this._shipconf_equipmentDamaged);
    	// }
    
    	if (worldScripts.NPC_Equipment_Damage) { // for NPC_Equipment_Damage v0.2.2
    		worldScripts.NPC_Equipment_Damage.NPC_equipmentDamagedHandlers.push(this.NPC_energy_equipmentDamaged);
    	}
    
    	if (this.$npc_shields) {
    		delete this.NPC_shield_equipmentDamaged;
    	} else if (worldScripts.NPC_Equipment_Damage) { // for NPC_Equipment_Damage v0.2.2
    		worldScripts.NPC_Equipment_Damage.NPC_equipmentDamagedHandlers.push(this.NPC_shield_equipmentDamaged)
    	}
    }
    
    this.shipSpawned = function (ship) {
    	if (!this.$shipHasShields(ship)) {
    		return;
    	}
    
    	if (ship.energyRechargeRate < 7) return; // ship has opportunity for enchancements: is simulated NEU? // rate for v0.1: 10 // v0.2: 7
    
    	//if (!ship.isPiloted || ship.isStation || ship.isThargoid || ship.energyRechargeRate > 5 || !ship.autoWeapons) return;
    	//log(this.name, ship.name + " has recharge: " + ship.energyRechargeRate);
    
    	// Setup of the Energy Units:
    
    	this.$configureNPCUnits(ship); // if not intalled NPC Energy Units OXP
    
    	// Setup of the Shields Equipments:
    
    	this.$configureNPCShields(ship);
    }
    
    //---- Ship Setup ----
    
    this.$shipHasShields = function (ship) {
    	if (ship.scriptInfo && ship.scriptInfo.npc_shields == "no") return false;
    	return (ship.isPiloted && !(ship.primaryRole == "escape-capsule") && !ship.isStation) // isPiloted rules out buoys, rocks, weapons and debris
    }
    
    this.$configureNPCUnits = function (ship) {
    	if ((this.$npc_units && (ship.equipmentStatus("EQ_NPC_ENERGY_UNIT") === "EQUIPMENT_OK" || // EQ_ENERGY_UNIT ?
    			ship.equipmentStatus("EQ_NPC_NAVAL_ENERGY_UNIT") === "EQUIPMENT_OK" || // EQ_NAVAL_ENERGY_UNIT ?
    			worldScripts.NPC_Energy_Units._alreadyGotOne[ship.dataKey]))) return;
    	//||
    	//ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_GRID") === "EQUIPMENT_OK" ||
    	//ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_UNIT") === "EQUIPMENT_OK") return;
    
    
    	// Get info about initial equipment status
    
    	var sc = ship.script;
    	if (!sc.$enhrs) sc.$enhrs = 0; // TODO : may be will deleted, used in damage state
    	if (!sc.$grids) sc.$grids = 0; // TODO : may be will deleted, used in damage state	
    
    	var grids_boost = 0;
    	var recharge = ship.energyRechargeRate;	
    	var sci = ship.scriptInfo;	
    	if (sci) {
    		if (sci.recharge) recharge = parseFloat(sci.recharge);
    		if (sci.max_shield_forward) grids_boost += parseInt(sci.max_shield_forward);
    		if (sci.max_shield_aft) grids_boost += parseInt(sci.max_shield_aft);
    		if (grids_boost > 0) sc.$grids = grids_boost
    	}
    
    	// initial recharge rate without MSE
    	var ench = 0;
    	if (ship.equipmentStatus("EQ_SHIELD_ENHANCER") === "EQUIPMENT_OK") { // MSE
    		ench = 1;
    		recharge = ship.energyRechargeRate / this.MSE_multiplier;
    		//log(this.name, "MSE will be replace: " + ship.energyRechargeRate.toFixed(2) + " to " + recharge.toFixed(2));
    	} else if (ship.equipmentStatus("EQ_NSHIELDS_NPC_NAVAL_SHIELD_BOOSTER") === "EQUIPMENT_OK") {
    		ench = 2;
    		recharge = ship.energyRechargeRate;
    		//log(this.name, "NPC MSE will be upgrade: " + recharge.toFixed(2));
    	}
    	if (ench) {
    		sc.$enhrs = this.MSE_multiplier; // : may be will deleted
    
    		// Info for upgrading of the OXP: EEU or NEU simulated?		
    		if (!grids_boost && recharge > 6.99) { //special event
    			if (!this.logging) {
    				this.logging = true;
    				this.debugging = true;
    			}
    			log(this.name, "check shipdata to correctly sets a recharge rate[" + ship.energyRechargeRate.toFixed(2) + "] by MSE to " + ship.dataKey);
    		}
    	}
    
    	// ship has NEU simulated or has MSE?
    	if (recharge > 6.99) {
    		if (ship.awardEquipment("EQ_MMS_NPC_NAVAL_ENERGY_UNIT")) {
    			if (!this.$npc_shields) {
    				if (grids_boost) ship.energyRechargeRate /= this.NEG_multiplier; // Adjustment for NEG
    				if (recharge > 9.99) ship.energyRechargeRate /= this.MSE_multiplier; // Adjustment for dummy MSE				
    			}
    			if (this.logging) log(this.name, "Dummy NEU awarded to " + ship.name + ", has recharge: " + ship.energyRechargeRate.toFixed(2))
    		} else log(this.name, "Fail NEU awarding to " + ship.name);
    	} else return;
    
    	// Addition to NPC Shield Enhancers for NEU simulated, avoiding an overfitting of the recharge rate
    	if (!this.$npc_shields && ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_UNIT") === "EQUIPMENT_OK") {
    		ship.removeEquipment("EQ_SHIELD_ENHANCER");
    		if (ship.awardEquipment("EQ_MMS_NPC_SHIELD_ENHANCER")) {
    			this.$shieldBoosterAdjustment(ship, "EQ_NAVAL_SHIELD_BOOSTER");
    			if (this.logging) log(this.name, "MSE[NEU] was replaced: " + ship.energyRechargeRate.toFixed(2))
    		}
    	}
    }
    
    this.$configureNPCShields = function (ship) {
    	//var recharge_rt = 0;
    	var grids_boost = 0;
    
    	var sc = ship.script;
    	var sci = ship.scriptInfo;
    	if (sci) { // Possible non-standard adjustments:
    		//if (sci.recharge) recharge_rt = parseFloat(sci.recharge);
    		if (sci.max_shield_forward) grids_boost += parseInt(sci.max_shield_forward);
    		if (sci.max_shield_aft) grids_boost += parseInt(sci.max_shield_aft);
    
    		// Replacement to NPC Shield Boosters for simulate correctly
    		if (!this.$npc_shields && ship.equipmentStatus("EQ_SHIELD_BOOSTER") === "EQUIPMENT_OK") {
    			ship.removeEquipment("EQ_SHIELD_BOOSTER");
    			if (ship.awardEquipment("EQ_MMS_NPC_SHIELD_BOOSTER")) {
    				this.$shieldBoosterAdjustment(ship, "EQ_SHIELD_BOOSTER");
    				if (this.logging) log(this.name, "SB was replaced: " + ship.energyRechargeRate.toFixed(2))
    			}
    		}
    
    		// Replacement to NPC Shield Enhancers for simulate correctly
    		if (!this.$npc_shields && ship.equipmentStatus("EQ_SHIELD_ENHANCER") === "EQUIPMENT_OK") {
    			ship.removeEquipment("EQ_SHIELD_ENHANCER");
    			if (ship.awardEquipment("EQ_MMS_NPC_SHIELD_ENHANCER")) {
    				this.$shieldBoosterAdjustment(ship, "EQ_NAVAL_SHIELD_BOOSTER");
    				if (this.logging) log(this.name, "MSE was replaced: " + ship.energyRechargeRate.toFixed(2))
    			}
    		}
    
    		// Addition a Naval Grids
    		if (grids_boost > 0) {
    			//log(this.name, "NEG will be awarded to " + ship.name);
    			if (ship.awardEquipment("EQ_MMS_NPC_NAVAL_ENERGY_GRID")) { // ~ Naval Shield Boosters (EQ_NPC_SHIELD_BOOSTER, EQ_NPC_NAVAL_SHIELD_BOOSTER, EQ_NPC_SHIELD_ENHANCER)
    				sc.$grids = grids_boost; // : may be will deleted			
    				if (!this.$npc_shields) {
    					this.$energyGridAdjustment(ship, "EQ_MMS_NPC_NAVAL_ENERGY_GRID");
    				}
    				if (this.logging) log(this.name, "NEG was awarded to " + ship.name + ", has recharge: " + ship.energyRechargeRate.toFixed(2));
    				return
    			} else log(this.name, "failed to award NEG to " + ship.name)
    		}
    	}
    
    	// Info for upgrading of the OXP
    	if (!sc.$enhrs) {		
    		log(this.name, "no shields script info to award NEG to " + ship.name)
    	} else if (this.debugging) {
    		this.logging = false;
    		this.debugging = null;
    	}
    }
    
    this.$energyUnitAdjustment = function (ship, type, reverse) {
    	let eq = EquipmentInfo.infoForKey(type);
    	let recharge_boost = parseFloat(eq.scriptInfo.oolite_energy_recharge_multiplier);
    
    	if (reverse) { // damaging/removing energy unit, not awarding
    		if (ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_GRID") === "EQUIPMENT_OK") {
    			if (this.$npc_shields && ship.equipmentStatus("EQ_NSHIELDS_NPC_NAVAL_SHIELD_BOOSTER") !== "EQUIPMENT_OK" || ship.equipmentStatus("EQ_MMS_NPC_SHIELD_ENHANCER") !== "EQUIPMENT_OK") {
    				worldScripts.MilitaryShields_Ships.$energyGridAdjustment(ship, "EQ_MMS_NPC_NAVAL_ENERGY_GRID", true);
    				ship.setEquipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_GRID", "EQUIPMENT_DAMAGED");
    				//log(this.name, "NEU fail, damaging EQ_MMS_NPC_NAVAL_ENERGY_GRID on "+ship.displayName)				
    			}
    		}
    		ship.energyRechargeRate /= recharge_boost
    	} else {
    		ship.energyRechargeRate *= recharge_boost
    	}
    }
    
    this.$shieldBoosterAdjustment = function (ship, type, reverse) {
    	//var shield_boost = this.shieldBoosters[type].shield_boost;
    	//var recharge_boost = this.shieldBoosters[type].recharge_boost;
    	let eq = EquipmentInfo.infoForKey(type);
    	let shield_boost = parseInt(eq.scriptInfo.oolite_shield_increase);
    	let recharge_boost = parseFloat(eq.scriptInfo.oolite_shield_recharge_multiplier);
    	if (!recharge_boost) recharge_boost = 1; //just in case, to avoid NaN and divide-by-zero errors
    
    	if (reverse) // damaging/removing shield booster, not awarding
    	{
    		if (type === "EQ_NAVAL_SHIELD_BOOSTER" && ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_GRID") === "EQUIPMENT_OK") {
    			if (this.$npc_shields && ship.equipmentStatus("EQ_NSHIELDS_NPC_NAVAL_SHIELD_BOOSTER") !== "EQUIPMENT_OK" || ship.equipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_UNIT") !== "EQUIPMENT_OK") {
    				worldScripts.MilitaryShields_Ships.$energyGridAdjustment(ship, "EQ_MMS_NPC_NAVAL_ENERGY_GRID", true);
    				ship.setEquipmentStatus("EQ_MMS_NPC_NAVAL_ENERGY_GRID", "EQUIPMENT_DAMAGED");
    				//log(this.name, "MSE fail, damaging EQ_MMS_NPC_NAVAL_ENERGY_GRID on "+ship.displayName)				
    			}
    		}
    		if (this.$npc_shields) {
    			ship.maxForwardShield -= shield_boost;
    			ship.maxAftShield -= shield_boost;
    			ship.forwardShieldRechargeRate /= recharge_boost;
    			ship.aftShieldRechargeRate /= recharge_boost;
    			if (ship.forwardShield > ship.maxForwardShield) ship.forwardShield = ship.maxForwardShield;
    			if (ship.aftShield > ship.maxAftShield) ship.aftShield = ship.maxAftShield;
    		} else {
    			ship.maxEnergy -= 2 * shield_boost;
    			ship.energyRechargeRate /= recharge_boost;
    			if (ship.energy > ship.maxEnergy) ship.energy = ship.maxEnergy;
    		}
    	} else {
    		if (this.$npc_shields) {
    			ship.maxForwardShield += shield_boost;
    			ship.maxAftShield += shield_boost;
    			ship.forwardShieldRechargeRate *= recharge_boost;
    			ship.aftShieldRechargeRate *= recharge_boost;
    			ship.forwardShield = ship.maxForwardShield; // in case this was called after another script awarded equipment
    			ship.aftShield = ship.maxAftShield;
    		} else {
    			ship.energy = ship.maxEnergy += 2 * shield_boost;
    			ship.energyRechargeRate *= recharge_boost;
    		}
    	}
    }
    
    this.$energyGridAdjustment = function (ship, type, reverse) {
    	let eq = EquipmentInfo.infoForKey(type);
    	let shield_boost = parseInt(eq.scriptInfo.oolite_shield_increase); // 0.0
    	let recharge_boost = parseFloat(eq.scriptInfo.oolite_shield_recharge_multiplier); // 1.5
    	if (ship.script.$grids) { // setup by script info
    		shield_boost = 0.5 * ship.script.$grids
    	}
    	if (!recharge_boost) recharge_boost = 1; //just in case, to avoid NaN and divide-by-zero errors
    
    	if (reverse) // damaging/removing energy grid, not awarding
    	{
    		if (this.$npc_shields) {
    			ship.energyRechargeRate /= recharge_boost;
    			ship.forwardShieldRechargeRate /= recharge_boost;
    			ship.aftShieldRechargeRate /= recharge_boost;
    			if (ship.forwardShield > ship.maxForwardShield) ship.forwardShield = ship.maxForwardShield;
    			if (ship.aftShield > ship.maxAftShield) ship.aftShield = ship.maxAftShield;
    		} else {
    			ship.maxEnergy -= 2 * shield_boost;
    			ship.energyRechargeRate /= recharge_boost;
    			if (ship.energy > ship.maxEnergy) ship.energy = ship.maxEnergy;
    		}
    	} else {
    		if (this.$npc_shields) {
    			ship.energyRechargeRate *= recharge_boost;
    			ship.forwardShieldRechargeRate *= recharge_boost;
    			ship.aftShieldRechargeRate *= recharge_boost;
    			ship.forwardShield = ship.maxForwardShield; // in case this was called after another script awarded equipment
    			ship.aftShield = ship.maxAftShield;
    		} else {
    			ship.energy = ship.maxEnergy += 2 * shield_boost;
    			ship.energyRechargeRate *= recharge_boost;
    		}
    	}
    }
    
    //---- Handler for NPC Shields Damage ----
    
    this.NPC_energy_equipmentDamaged = function (equipment) {
    
    	if (equipment == "EQ_MMS_NPC_NAVAL_ENERGY_UNIT") { // TODO: compartibility with: equipment == "EQ_NPC_NAVAL_ENERGY_UNIT"
    		worldScripts.MilitaryShields_Ships.$energyUnitAdjustment(this.ship, "EQ_MMS_NPC_NAVAL_ENERGY_UNIT", true); // for NPC_Equipment_Damage v0.2.2
    		//return;
    	}
    	if (equipment == "EQ_MMS_NPC_NAVAL_ENERGY_GRID") {
    		worldScripts.MilitaryShields_Ships.$energyGridAdjustment(this.ship, "EQ_MMS_NPC_NAVAL_ENERGY_GRID", true); // for NPC_Equipment_Damage v0.2.2
    	}
    }
    
    this.NPC_shield_equipmentDamaged = function (equipment) {
    	if (equipment == "EQ_MMS_NPC_SHIELD_BOOSTER") {
    		worldScripts.MilitaryShields_Ships.$shieldBoosterAdjustment(this.ship, "EQ_SHIELD_BOOSTER", true); // for NPC_Equipment_Damage v0.2.2
    	}
    	if (equipment == "EQ_MMS_NPC_SHIELD_ENHANCER") {
    		worldScripts.MilitaryShields_Ships.$shieldBoosterAdjustment(this.ship, "EQ_NAVAL_SHIELD_BOOSTER", true); // for NPC_Equipment_Damage v0.2.2
    	}
    }