Back to Index Page generated: Dec 20, 2024, 7:22:10 AM

Expansion Military Missile G2

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description An enhanced hardened missile developed exclusively for the Galactic Navy and the GalCop police forces. The Military Missile G2 is the next generation after the G1. For more details please check the wiki page. An enhanced hardened missile developed exclusively for the Galactic Navy and the GalCop police forces. The Military Missile G2 is the next generation after the G1. For more details please check the wiki page.
Identifier oolite.oxp.zzz.Montana05.GalCop_military_missile_G2 oolite.oxp.zzz.Montana05.GalCop_military_missile_G2
Title Military Missile G2 Military Missile G2
Category Weapons Weapons
Author Wyvern, Montana05 Wyvern, Montana05
Version 0.51 0.51
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Military_Missile n/a
Download URL https://wiki.alioth.net/img_auth.php/4/48/Oolite.oxp.zzz.Montana05.GalCop_military_missile_G2.OXZ n/a
License CC BY-NC-SA 4.0 CC BY-NC-SA 4.0
File Size n/a
Upload date 1639300938

Documentation

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

read_me.txt

History
=======

Since the aging original Military Missile doesn't include a license I decided to make a remake and while doing so
include some modifications.

The wiki page of the original and this missile could be viewed here: http://wiki.alioth.net/index.php/Military_Missile

Overview
========

An enhanced hardened missile developed exclusively for the Galactic Navy and the GalCop police forces but a hacked
version is available as well.

Modifications
=============

Faster, more resistant to ECM, and with an extended array of targets. The original Military Missile G2 could only be 
purchased at a Navy SecCom Station and therefore require Galactic Navy to be installed. If you chose the career of a 
criminal you can find the hacked version once in a while in systems with an unstable government or at independent 
and "sleazy" locations. 
 
Credits
=======

The Military Missile G2 is an improved version of the work of Wyvern, all credits, therefore, belongs to him. 

Dependencies
============

none

License
=======

This work is licensed under Creative Commons Attribution Non-Commercial Share Alike 4.0 International (CC BY-NC-SA 4.0).
To view a copy of this license visit https://creativecommons.org/licenses/by-nc-sa/4.0

Version History
===============

V 0.50:
initial release

V 0.51:
fixed a logical error in the purchase chances

Equipment

Name Visible Cost [deci-credits] Tech-Level
Hawking HMX-11 Military Smart Missile yes 4100 2+
Hacker HMX-11 Military Smart Missile yes 10000 2+

Ships

Name
Hawking HMX-11 Military Smart Missile
Hacker HMX-11 Military Smart Missile

Models

This expansion declares no models.

Scripts

Path
Scripts/GalCop_military_missile_conditions.js
this.name			= "GalCop_military_missile_conditions";
this.author			= "Montana05";
this.description	= "conditions for the purchase of Military Missiles G2";
this.version		= "0.51";
this.copyright		= "2021 Montana05";
this.licence   		= "CC BY-NC-SA 4.0";
"use strict";

this.allowAwardEquipment = function(equipment, ship, context)
{
	var diceRoll = worldScripts.GalCop_military_missile_dice;
	var dice = diceRoll.$GalCop_military_missile_dice;
			
	var shipRole = ship.primaryRole;
	
	// remainder from oolite-conditions.js:

	// OXP hook to allow stations to forbid specific equipment
	if(context == "purchase" && player.ship.dockedStation && player.ship.dockedStation.scriptInfo["oolite-barred-equipment"])
	{
		if (player.ship.dockedStation.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
		{
			return false;
		};
	};

	// OXP hook to allow ships to forbid specific "available to all" equipment
	if(ship.scriptInfo && ship.scriptInfo["oolite-barred-equipment"] && ship.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
	{
		return false;
	};
			
	// awarded equipment to NPC's on setup or added by JS
	if(context == "npc" || context == "scripted")
	{
		// exclusively for Navy and police
		if(equipment === "EQ_GALCOP_MILITARY_MISSILE" && (ship.scanClass === "CLASS_MILITARY" || ship.scanClass === "CLASS_POLICE"))
		{
			return true;
		};
		
		// for some criminals only
		// roleIsInCategory always return "false" so check every role
		if(equipment === "EQ_GALCOP_MILITARY_MOD_MISSILE" &&
		   (shipRole == "pirate-heavy-fighter" ||
		    shipRole == "pirate-heavy-freighter" ||
		    shipRole == "pirate-interceptor" ||
		    shipRole == "pirate-aegis-raider" ||
			shipRole == "assassin-medium" ||
			shipRole == "assassin-heavy"))
		{
			return true;
		};
	};

	if(system && !system.sun.hasGoneNova && !system.sun.isGoingNova)
	{
		// shipyards at stations
		if((context == "newShip" || context == "purchase") && player.ship.dockedStation)
		{
			// the original missiles are only available at 
			// Galactic Navy Sector Commands (Galactic Navy OXP) and Sentinel Stations (Anarchies OXP)
			if(equipment === "EQ_GALCOP_MILITARY_MISSILE" && 
			  (player.ship.dockedStation.primaryRole.indexOf("navystat") != -1) || 
			   player.ship.dockedStation.primaryRole == "anarchies_sentinel_station")
			{
				return true;
			};

			// modified missiles
			if(equipment === "EQ_GALCOP_MILITARY_MOD_MISSILE")
			{
				// there is a chance in anarchies, feudals and multi-gov systems
				if(system.info.government <= 2 && dice > 75)
				{
					return true;
				};

				// independent and sleazy locations offer them as well once in a while
				if(system.info.government > 2 && player.ship.dockedStation.allegiance != "galcop" && dice > 65)
				{
					return true;
				};
			};
		};
	};	
	// otherwise prohibited
	return false;
};



Scripts/GalCop_military_missile_dice.js
this.name			= "GalCop_military_missile_dice";
this.author			= "Montana05";
this.description	= "rolls the dice for the condition script";
this.version		= "0.51";
this.copyright		= "2021 Montana05";
this.licence   		= "CC BY-NC-SA 4.0";
"use strict";

// offers a chance for purchase on some stations (condition script)

// on startup
this.startUp = function()
{
	this.$GalCop_military_missile_dice = Math.round(Math.random() * 100);
};

// with every docking
this.shipDockedWithStation = function(station)
{
	this.$GalCop_military_missile_dice = Math.round(Math.random() * 100);
};
Scripts/GalCop_military_missile_supply.js
this.name			= "GalCop_military_missile_supply";
this.author			= "Montana05";
this.description	= "replaces on some ships the core missiles";
this.version		= "0.51";
this.copyright		= "2021 Montana05";
this.licence   		= "CC BY-NC-SA 4.0";
"use strict";

// replaces on some police, assassin and pirate ships "Missiles" and "ECM Hardened Missiles" with "Military Missiles G2"

this.shipSpawned = function(ship) 
{
	var dice = Math.round(Math.random() * 100);
	var shipRole = ship.primaryRole;
	var shipMissiles = ship.missiles;
	
	// basic check, shouldn't be necessary but better safe than sorry
	if(ship.isSubEntity == false &&
	   ship.isWeapon == false &&
	   ship.isCargo == false &&
	   ship.isRock == false &&
	   shipMissiles.length > 0 &&
	   shipRole != "wreckage" ) 
	{
		// police ships in advanced government systems with money
		if(ship.isPolice == true &&
		   system.info.government > 4 &&
		   system.info.economy < 2)
		{   
			for(var i = shipMissiles.length - 1 ; i >= 0 ; i-- )
			{
				if(shipMissiles[i].equipmentKey == "EQ_MISSILE")
				{
					ship.removeEquipment("EQ_MISSILE");
					ship.awardEquipment("EQ_GALCOP_MILITARY_MISSILE");
				};

				if(shipMissiles[i].equipmentKey == "EQ_HARDENED_MISSILE")
				{
					ship.removeEquipment("EQ_HARDENED_MISSILE");
					ship.awardEquipment("EQ_GALCOP_MILITARY_MISSILE");
				};
			};
		};
	
		// random heavily armed pirates and assassins
		if((shipRole == "pirate-heavy-fighter" ||
		    shipRole == "pirate-heavy-freighter" ||
		    shipRole == "pirate-interceptor" ||
		    shipRole == "pirate-aegis-raider" ||
			shipRole == "assassin-medium" ||
			shipRole == "assassin-heavy") &&
	        dice < 20)
		{
			for(var i = shipMissiles.length - 1 ; i >= 0 ; i-- )
			{
				if(shipMissiles[i].equipmentKey == "EQ_MISSILE")
				{
					ship.removeEquipment("EQ_MISSILE");
					ship.awardEquipment("EQ_GALCOP_MILITARY_MOD_MISSILE");
				};

				if(shipMissiles[i].equipmentKey == "EQ_HARDENED_MISSILE")
				{
					ship.removeEquipment("EQ_HARDENED_MISSILE");
					ship.awardEquipment("EQ_GALCOP_MILITARY_MOD_MISSILE");
				};
			};
		};
	};
};