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

Expansion GalTech Escort Fighter Fix

Content

Warnings

  1. Unknown key 'requires_oxp' at https://wiki.alioth.net/img_auth.php/3/39/Oolite.oxp.zzz.Montana05.GalTech_escort_fighter_Fix.OXZ!manifest.plist

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Update of the GalTech Escort Fighter: Fixes problems and adjusts to later Oolite versions Update of the GalTech Escort Fighter: Fixes problems and adjusts to later Oolite versions
Identifier oolite.oxp.zzz.Montana05.GalTech_escort_fighter_Fix oolite.oxp.zzz.Montana05.GalTech_escort_fighter_Fix
Title GalTech Escort Fighter Fix GalTech Escort Fighter Fix
Category Ships Ships
Author Montana05 Montana05
Version 1.10 1.10
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://aegidian.org/bb/viewtopic.php?p=272885#p272885 n/a
Download URL https://wiki.alioth.net/img_auth.php/3/39/Oolite.oxp.zzz.Montana05.GalTech_escort_fighter_Fix.OXZ n/a
License CC BY-NC-SA 4.0 CC BY-NC-SA 4.0
File Size n/a
Upload date 1610873272

Documentation

Also read http://wiki.alioth.net/index.php/GalTech%20Escort%20Fighter%20Fix

read_me.txt

Overview
========

This GalTech Escort Fighter package is fixing some bugs, upgrades to features from later versions of Oolite and, inspired by Shipbuilders original
message "Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP", includes some
new features, all of them to be removed if Shipbuilder disagrees.

Fixes
=====

changed "optional_equipment" to correct price calculation in shipyards (shipyard.plist)

added shiplibrary.plist to replace the obsolete demoships.plist

equalized the boosted fore lasers

some small modifications at the model

Upgrades
========

changed fore lasers to "multiply" (shipdata.plist)

improved the energy banks to 5 and 6 (police)

merged all ship-scripts into one, this scrip is handling messages, death actions (including escape pods),
and some new features

included a normal map and modified the diffuse map slightly to work better with the normal map (and to fix some problems)

included "gloss"

New Features
============

As mentioned above this are not part of the original OXP and will be removed if Shipbuilder disagrees:

reduced the spin time for hyperspace jumps to 5 (shipdata.plist)

added some groups with the roles pirate-medium-fighter, hunter-medium and police(0.50) (shipdata.plist)

races, ranks and various descriptions for rescued crew members (script)

included "explosive shrapnels", "burning quirium fuel" and "ship debris" to the ship explosions, 
all part of Montanas Resource Pack 01 OXP (script)

changed the assignment of cargo pods (script)

assigned GalTech escape pods to the ships (slightly redesigned)
 
Credits
=======

original work and escape pods: Shipbuilder

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

to work correct this pack needs to install Montanas Resource Pack 01 OXP (minimum V 0.51) as well

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 1.00:
basic fix

V 1.10:
fix with upgrades and new features

Equipment

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

Ships

Name
GalTech_Escort_Fighter-hunter_team_01
GalTech_Escort_Fighter-pirate_team_01
GalTech_Escort_Fighter-police_police_team_01
GalTech_escort_fighter_escape_capsule
GalTech_escort_fighter_escape_capsule_pirate
GalTech_escort_fighter_escape_capsule_police

Models

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

Scripts

Path
Scripts/GalTech_escort_fighter.js
this.name			= "GalTech_escort_fighter";
this.author			= "Montana05";
this.description	= "event handler for GalTech escort fighter OXP";
this.version		= "1.10";
this.copyright		= "2020 Montana05";
this.licence   		= "CC BY-NC-SA 4.0";
"use strict";

// new features for Escort Fighter (will be removed if Shipbuilder disagrees):

this.shipSpawned = function(ship)
{
	this.$GalTech_shipType = this.ship.dataKey;
	this.$GalTech_pod = 0;
	var dice = 0;
	
	if(this.ship.hasRole("escape-capsule"))
	{
		// neutral inits first
		var $GalTech_crewName = expandDescription("[nom]");
		var $GalTech_description = "a crew member of an evacuated ship";
		var $GalTech_crewRole = "hunter";  // not perfect but somewhere in the middle
		var $GalTech_crewRace = expandDescription("[GalTech_GalCop_races]");  // added a race to the crew members
				
		// now it's time to be more specific, based on an estimated crew of up to 2 person
		// every individual without insurance or bounty will be defined as a slave
		switch(this.$GalTech_shipType) 
		{
			case "GalTech_escort_fighter_escape_capsule":
			
				this.$GalTech_escort_fighter_crew_ranks_Array = 
				["Gunner", "Pilot", "Commander"];
				var $GalTech_crewRanks = 
				$GalTech_escort_fighter_crew_ranks_Array[Math.floor(Math.random() * $GalTech_escort_fighter_crew_ranks_Array.length)];
			
				$GalTech_crewName = ("the " + $GalTech_crewRace + " " + $GalTech_crewRanks + " " + expandDescription("[nom]"));
				$GalTech_description = "a fighter crew member";
				$GalTech_crewRole = "hunter"; 	
				break;
			
			case "GalTech_escort_fighter_escape_capsule_police":
				
				this.$GalTech_escort_fighter_police_ranks_Array = 
				["Ensign", "Space Junior Lieutenant", "Space Lieutenant", "Lt. Commander"];
				var $GalTech_policeRank = 
				$GalTech_escort_fighter_police_ranks_Array[Math.floor(Math.random() * $GalTech_escort_fighter_police_ranks_Array.length)];
			
				$GalTech_crewName = ("the " + $GalTech_crewRace + " " + $GalTech_policeRank + " " + expandDescription("[nom]"));
				$GalTech_description = "a crew member of a space police ship";
				$GalTech_crewRole = "police"; 		
				break;
			
			case "GalTech_escort_fighter_escape_capsule_pirate":
				
				$GalTech_crewName = 
				("the " + $GalTech_crewRace + " " + expandDescription("[GalTech_pirate_nicknames]") + expandDescription("[nom]"));
				
				$GalTech_description = "a criminal wanted by GalCop police";
				$GalTech_crewRole = "pirate";
				break;	
			
			default: 
				break;			
		};

		this.ship.setCrew
		(
			{
				name: $GalTech_crewName,
				short_description: $GalTech_description,
				role: $GalTech_crewRole,
				species: $GalTech_crewRace
			}
		);
	}
	else
	{
		// checks if the ship is equipped with an escape pod, if yes the pod is removed and a flag is set to true
		if(this.ship.hasEquipmentProviding("EQ_ESCAPE_POD"))
		{
			this.ship.removeEquipment("EQ_ESCAPE_POD");
			this.$GalTech_pod = 1;
		};
				
		var $GalTech_shipRole = this.ship.primaryRole;

		// if the ship got no cargo some containers are added
		if(this.ship.cargoSpaceUsed === 0)
		{
			switch($GalTech_shipRole) 
			{
				// group members of a pirate-medium-fighter still have role escort
				case "pirate":
				case "pirate-medium-fighter":
				// individual roles per ship, will only be called from other OXP's	
				case "GalTech_Escort_Fighter-pirate":
				case "GalTech_Escort_Fighter-pirate_team_01":	
					
					this.ship.setCargoType("ILLEGAL_GOODS");
					break;
					
				case "escort":
				case "hunter":
				case "hunter-medium":
				// individual roles per ship, will only be called from other OXP's
				case "GalTech_Escort_Fighter-escort":
				case "GalTech_Escort_Fighter-hunter":	
				case "GalTech_Escort_Fighter-hunter_team_01":		
									
					dice = this.$getRndInteger(1, 2);
						
					// added some diversity
					if(dice === 1)
						this.ship.setCargoType("SCARCE_GOODS");

					if(dice === 2)
						this.ship.setCargoType("PLENTIFUL_GOODS");
					break;
					
				// police most likely will have weapons, not goods
				case "police":
				case "wingman":
				// individual role of the ship, will only be called from other OXP's	
				case "GalTech_Escort_Fighter-police":	
									
					dice = this.$getRndInteger(1, 2);
					this.ship.adjustCargo("firearms", dice);
					break;

				default: 
					break;
			};
		};
	};
};

this.shipDied = function(whom, why)
{
	if(this.ship.hasRole("escape-capsule"))
	{
		return;
	}
	else
	{
		// neutral inits first
		var $GalTech_podType = "escape-capsule";
		var debrisCount = 1;  // for pods
		var $GalTech_cargoLoad = this.ship.cargoSpaceUsed;
				
		// time to eject the escape pods
		if(this.ship.bounty > 7)
		{
			this.ship.commsMessage(expandDescription("[GALTECH_ESCORT_FIGHTER_PIRATE_ROLE_KILLED_MESSAGE]"), player.ship);
			$GalTech_podType = "GalTech_escort_fighter_escape_capsule_pirate";
		}
		else
		{
			switch(this.$GalTech_shipType) 
			{
				case "GalTech_Escort_Fighter-escort":

					this.ship.commsMessage(expandDescription("[GALTECH_ESCORT_FIGHTER_ESCORT_ROLE_KILLED_MESSAGE]"), player.ship);
					$GalTech_podType = "GalTech_escort_fighter_escape_capsule";
					break;

				case "GalTech_Escort_Fighter-hunter":
				case "GalTech_Escort_Fighter-hunter_team_01":	

					this.ship.commsMessage(expandDescription("[GALTECH_ESCORT_FIGHTER_HUNTER_ROLE_KILLED_MESSAGE]"), player.ship);
					$GalTech_podType = "GalTech_escort_fighter_escape_capsule";
					break;

				case "GalTech_Escort_Fighter-police":
				
					this.ship.commsMessage(expandDescription("[GALTECH_ESCORT_FIGHTER_POLICE_ROLE_KILLED_MESSAGE]"), player.ship);
					$GalTech_podType = "GalTech_escort_fighter_escape_capsule_police";	
					break;	
				
				// for pirates with small bounty, unlikely but better make sure
				case "GalTech_Escort_Fighter-pirate":
				case "GalTech_Escort_Fighter-pirate_team_01":	
		
					this.ship.commsMessage(expandDescription("[GALTECH_ESCORT_FIGHTER_PIRATE_ROLE_KILLED_MESSAGE]"), player.ship);
					$GalTech_podType = "GalTech_escort_fighter_escape_capsule_pirate";
					break;

				default: 
					break;	
			};	
		};
						
		// if the flag for pods is true the correct capsule is spawned
		if(this.$GalTech_pod == 1)
		{
			debrisCount = this.$getRndInteger(1, 2);
			system.addShips($GalTech_podType, debrisCount, this.ship.position);
		};

		debrisCount = this.$getRndInteger(4, 6);
		// added explosive shrapnels similar to Constitution Class Heavy Cruiser
		system.addShips("GalTech_effects_explosive_shrapnel", debrisCount, this.ship.position);
		// added various depris as a new feature
		system.addShips("GalTech_ship_debris", debrisCount, this.ship.position);

		// added burning fuel as a new feature
		debrisCount = (this.ship.fuel.toFixed(0)) * 2;	
		system.addShips("GalTech_effects_burningFuel", debrisCount, this.ship.position);

		// added some cargopods as a new feature
		if($GalTech_cargoLoad > 0)
		{
			var cargoIndex = this.ship.cargoList;
			var cargoTotal = 0;
			
			// calculate all containers from ship.cargoList
			for (var i = cargoIndex.length - 1 ; i >= 0 ; --i)
			{
				cargoTotal = cargoTotal + this.ship.cargoList[i].quantity;
			};

			// shouldn't happen but better save than sorry
			if(cargoTotal > $GalTech_cargoLoad)
				$GalTech_cargoLoad = cargoTotal;
			
			// time to eject cargopods
			for(var i = cargoIndex.length - 1 ; i >= 0 ; --i)
			{
				var cargoType = this.ship.cargoList[i].commodity;
				var cargoPod = ("GalTech_container_" + cargoType);
				var cargoCount = this.ship.cargoList[i].quantity;
												
				// Warning: additional commodities from an OXP are not covered and therefore will not be ejected 
				// exceptions: witchfire_whiskey, holy_artifacts, quirium_crystal
				while(cargoCount > 0)
				{
					this.ship.ejectSpecificItem(cargoPod);
					cargoCount = cargoCount - 1;
				};
			};
		};
	};
};	

this.$getRndInteger = function(min, max)
{
	return Math.floor(Math.random() * (max - min + 1) ) + min;
};