Back to Index Page generated: Jun 13, 2026, 7:54:55 PM

Expansion Xenon UI

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description New background images all standard gui screens, plus new title screen theme music. Needs one of the Xenon UI Resources packs to be installed: Pack A, C, E, G, I, K or M for 16:9 screens, Pack B, D, F, H, J, L or N for 16:10 screens. Choose a pack that matches the font you are using - see resources pack details for information on which font is used. This OXP will override any backgrounds currently applied by other OXP's. This is by design, in order to maintain the illusion of looking at a computer display. If conflicts arise, where important information needs to be given to the player via a background screen, code can be applied to allow exceptions to take place. See the Wiki page for more information. New background images all standard gui screens, plus new title screen theme music. Needs one of the Xenon UI Resources packs to be installed: Pack A, C, E, G, I, K or M for 16:9 screens, Pack B, D, F, H, J, L or N for 16:10 screens. Choose a pack that matches the font you are using - see resources pack details for information on which font is used. This OXP will override any backgrounds currently applied by other OXP's. This is by design, in order to maintain the illusion of looking at a computer display. If conflicts arise, where important information needs to be given to the player via a background screen, code can be applied to allow exceptions to take place. See the Wiki page for more information.
Identifier oolite.oxp.z.phkb.XenonUI oolite.oxp.z.phkb.XenonUI
Title Xenon UI Xenon UI
Category Ambience Ambience
Author phkb phkb
Version 3.15 3.15
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Dependent Expansions
  • oolite.oxp.Cholmondeley.Addons_for_Beginners_(Vital_Statistics):1.2
  • oolite.oxp.z.phkb.XenonUIResources:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesB:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesC:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesD:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesE:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesF:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesG:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesH:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesI:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesJ:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesK:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesL:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesM:2.1
  • oolite.oxp.z.phkb.XenonUIResourcesN:2.1
  • Information URL http://wiki.alioth.net/index.php/XenonUI n/a
    Download URL https://wiki.alioth.net/img_auth.php/0/0b/XenonUI.oxz http://wiki.alioth.net/img_auth.php/0/0b/XenonUI.oxz
    License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
    File Size n/a
    Upload date 1780931710

    Relationships Diagram

    Documentation

    Also read http://wiki.alioth.net/index.php/Xenon%20UI

    readme.txt

    Xenon UI OXP
    By Nick Rogers
    
    About this OXP
    ==============
    This OXP replaces all background UI screens with a new look and feel, based on the assumption that the Oolite UI screens are accessed through some form of computer terminal. 
    
    The method used to add the backgrounds will mean that the background images of most other OXP's, if they set a background, will be overridden with the Xenon UI images. This is by design. 
    
    If an OXP uses background images to convey important information to the player, and the "mission.runScreen" command in the OXP has a "screenID" parameter attached, it is possible to add exceptions to the override by adding the following code to a worldScript:
    
    	var w = worldScripts.XenonUI;
    	if (w) w.$addMissionScreenException("mymissionscreenid");
    
    Installation
    ============
    The OXP is made up of two parts: the main XenonUI.oxz, which holds all the config, code and the music file, and the resources pack which holds all the images. This will allow fast updates to the code section, which is small, without having to download the large resources file regularly.
    
    This OXP requires one of the Xenon UI Resource packs to be installed. There are packs for screen ratios of 16:9 or 16:10, and using different fonts for the text. For narrower screens, see the XenonReduxUI.OXZ.
    
                        Screen Ratio:
                        16:9      16:10
    Font:               -------   -------
    OCR A Extended      Pack A    Pack B
    Xolonium            Pack C    Pack D
    Dangerous Square    Pack E    Pack F
    Default (Helvetica) Pack G    Pack H
    Dosis               Pack I    Pack J
    Discognate          Pack K    Pack L
    NovaSquare          Pack M    Pack N
    
    F6 Overlay integration
    ======================
    A facility has been provided for other OXP's to supply the overlays on the F6 screen which describe the economy, government, techlevel and sun colors. To use it, add the following code to your startUpComplete world script:
    
        var xui = worldScripts.XenonUI;
        // "economy":   this defines which section the callback applies to, either economy, government, techlevel or suncolor
        // this.name:   this defines the name of your world script where the function can be found
        // "$returnF6EconomyOverlay":   this defines the name of the function that will be called when the F6 overlay is required.
        xui.$setF6OverlayLookup("economy", this.name, "$returnF6EconomyOverlay");
    
    Then create the function that will be called when the various F6 overlays are requested. 
    The parameters "ratio" and "font" will be passed to your function.
    "ratio" will be either "16_9" or "16_10", referring to screen ratio of the Xenon UI images currently active.
    "font" will be the font name of the font type associated with the Xenon UI resources currently active. Will be either "default", "dangeroussquare", "discognate", "dosis", "novasquare", "ocraextended" or "xolonium".
    
        this.$returnF6EconomyOverlay = function(ratio, font) {
            return "my_f6-overlay-economy_" + ratio + "_" + font + ".png";
        }
    
    BGS 1.10 Compatibility
    ======================
    Xenon UI is compatible with BGS v1.10, but depending on where each one is installed, one OXP may end up taking priority over the other when backgrounds are selected and displayed. When BGS has priority, its images will be displayed ahead of the Xenon UI images. This will be particular apparent on screens like the title page or the load/save page.
    
    If both OXP's (Xenon UI and BGS) are installed in the Addons folder, Xenon UI will normally take priority over BGS.
    
    If both OXP's are installed via the download manager, again, Xenon UI will normally take priority over BGS.
    
    If BGS is installed via the download manager, and Xenon UI is installed in the AddOns folder, Xenon UI will take priority over BGS.
    
    If Xenon UI is installed via the download manager, and BGS is installed in the AddOns folder, BGS will take priority over Xenon UI.
    
    To ensure the Xenon UI backgrounds appear, the best approach is to make sure they are both installed in the same location.
    
    If you encounter issues where the BGS backgrounds are being displayed rather than the Xenon UI ones, you will need to open the BGS OXP folder, then open the Config folder. Inside Config you will find a 'screenbackgrounds.plist' file. Either remove this or re-name it - perhaps re-name it to 'screenbackgrounds.Xplist' - and the Xenon UI backgrounds will be used without affecting any other aspect of BGS. By re-naming 'screenbackgrounds.plist' rather than removing it you have the option of switching back easily if required.
    
    BGS 2.0 Compatibility
    =====================
    Xenon UI will hook into Library GUI to register itself as a GUI set. Therefore, you can go to the Library GUI settings and change between BGS 2.0 and Xenon UI anytime you like. 
    
    Because of the way the images are created, Xenon UI is still utilising settings in "screenbackgrounds.plist", which may lead to some inconsistencies. For instance, if Xenon UI and BGS 2.0 are installed, when you start Oolite and select the option to open a saved commander, the background will likely be Xenon UI. Once you have loaded a game where BGS 2.0 is the specified GUI, if you then press F2 to load a new game, you will see the BGS background.
    
    Licence
    =======
    This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
    
    Briefcase image form http://simpleicon.com/briefcase-3.html
    Rocket image form http://simpleicon.com/rocket.html
    ID Card from http://simpleicon.com/id_card-2.html
    Power icon from http://simpleicon.com/switch_button_1.html
    Report icon from http://simpleicon.com/note-11.html
    Gears icon from http://simpleicon.com/gear-6.html
    Load icon from http://simpleicon.com/upload_2.html
    Save icon from http://simpleicon.com/download_2.html
    Interface icon from http://simpleicon.com/retweet.html
    Settings icon from http://simpleicon.com/setting.html
    Keyboard icon from https://commons.wikimedia.org/wiki/File:High-contrast-input-keyboard.svg
    Trolley icon from http://simpleicon.com/shopping_trolley_1.html
    Clipboard icon from http://simpleicon.com/admite_form_1.html
    Tag image from http://simpleicon.com/tag-2.html
    Gamepad image from http://simpleicon.com/gaming_remote.html
    Question mark image from http://simpleicon.com/question_mark_1.html
    Warning image from http://simpleicon.com/warning.html
    
    Version History
    ===============
    3.15
    - Improved integration with Library GUI.
    
    3.14
    - Further improved compatibility with Market Ads and Library GUI.
    
    3.13
    - Further improved compatibility with OXP's that turn the HUD on/off on the System Data screen.
    
    3.12
    - Improved compatibility with Market Ads and Library GUI.
    
    3.11
    - Darkened overlay images for better compatibility with Oolite 1.92.
    
    3.10
    - Fixed issue where mission chart screens had the wrong background if Library is installed.
    - Fixed some small graphic artefacts in some of the overlay images.
    - Moved text into descriptions.plist for easier localisation.
    
    3.9
    - Added fix for issue where the wrong F6 screen overlay could be shown when the screen is first displayed.
    - Added new start menu background.
    
    3.8
    - Added fix for issue where the HUD being turned on/off could result in the wrong size UI screen being shown.
    
    3.7
    - Added custom background for the OXZ Manager screen, with helper text.
    
    3.6.1
    - Fixed for issue where the game is saved while Overlays are disabled and HDBG OXP is installed, and the game is then reloaded.
    
    3.6 
    - Added facility to allow for 3rd party OXP's to provide the F6 overlay images.
    
    3.5
    - Bug fixes.
    
    3.4
    - Bug fixes.
    
    3.3
    - Fixes for Ships Library, Sothis TC, New Cargoes and Iron Raven to restore background images.
    
    3.2
    - Improvements in BGS compatibility.
    
    3.1
    - Small tweak for potential performance improvements.
    - Updated compatibility with Library 1.7.
    
    3.0
    - Added "Amber" background option (selectable via Library Config).
    - Code refactoring.
    
    2.2.1
    - Improvements in Library GUI integration.
    
    2.2.0 
    - Added functions to enable different chart legend overlays to be displayed, based on what the player has selected. (Oolite 1.87/88 required)
    
    2.1.4
    - Improved coverage of different mission screen sequencing scenarios. (Oolite 1.85/86 required)
    - Improved integration with XenonReduxUI via Library GUI.
    - Applied new screenbackgrounds added in v1.87 ("custom_chart_mission").
    
    2.1.3
    - Fixed incorrect key lookup with mission screen overlays.
    - Fixed issue with turning off overlay images with Library GUI.
    - Disabling background images on a mission screen will now also disable any overlays as well.
    
    2.1.2
    - Bug fixes.
    
    2.1.1
    - Rejigged connection to Library GUI for nicer handovers when GUI's change.
    
    2.1.0
    - Updated for simpler integration with Library GUI.
    - Code refactoring.
    
    2.0.4
    - Adjusted the Random Hits screen ID exception.
    
    2.0.2
    - Updated title screen image.
    - F5 Cmdr Profile and F5F5 Manifest were swapped around when using Library GUI.
    
    2.0.1
    - Fixed compatibility issue with HDBG when using Library GUI.
    
    2.0.0
    - Made compatible with Library GUI.
    - Added some configuration settings to Library Config.
    - Added additional overlays to various data screens.
    - Code cleanup.
    
    1.4.3
    - Added "oxz-manager" to screenbackgrounds.plist.
    - Changed "==" comparisons to "===" for performance improvements.
    
    1.4.2
    - Corrected error in Nova Mission runScreen command parameters that was causing the Yes/No option to not display.
    
    1.4.1
    - Updated check for "Allow Big GUI".
    
    1.4.0
    - Changed new game background to the 'no hud' variant.
    - New title screen image.
    - Added mission screen overlays. Can be disabled by setting "this._disableOverlays = true;" in "xenonui.js".
    - Fixed issue with BGS where the F6 overlay image was being removed.
    - Fixed issue where exiting the Ship Library screen would sometimes show the wrong background.
    - Added mission screen exception for Random Hits.
    
    1.3.3
    - Added screenID exceptions for UPS Courier.
    - Added screedID exceptions for Escort Contracts (v1.6.3).
    - Added routine to use 1.83/4 code to check for big GUI HUD's.
    
    1.3.2
    - Fixed Javascript bug.
    
    1.3.1
    - Added screenID exceptions for Blackmonks.
    - Fixed issue where all components were not being disabled correctly when no resource packs are installed.
    
    1.3.0
    - Checks for the "allow_big_gui" option on HUD's. Uses the "nohud" background variations when found.
    - Fixed issue where the wrong background was being selected going to or from the F8 Market screen if Market Observer is installed.
    - Added screenID exceptions for Rescue Stations.
    
    1.2.0
    - Updated all images to be 2048x1024 to stop Oolite from rescaling them. Results in a much cleaner image.
    - Fixed issue with mission screens that exit to the short or long range chart, where the wrong background was being displayed.
    - Added screenID's to nova mission screens.
    - Moved the music file back into the main OXP so it doesn't have to be in all the resource packs.
    - Added a paused overlay.
    - Added a legend overlay to the Galactic chart screens to aid in understanding the various highlight modes.
    - Added a routine to check for the presence of resource pack, and output an error to the log if no pack is found.
    - Added a "requires_oxp" section to all resource packs to require the main OXP.
    
    1.1.4
    - Adjusted the main title colour to match with the background.
    - Adjusted graphical elements to line up better between screens, as noted by Tichy.
    - Fixed issue with Trumbles and Nova missions not showing proper background image.
    - Changed license of code section to CC-BY-NC-SA 3.0 due to inclusion of trumbles and nova mission code.
    
    1.1.3
    - Updated manifest to remove required OXP, as there are now two different resource packs available.
    
    1.1.2
    - Changed manifest identifier to try and position the OXP at the bottom of the install list
    
    1.1.1
    - Fixed bug where "." is missing before "indexOf".
    
    1.1.0
    - Split OXZ into two, one for resources (music and images), one for the code and config.
    - Fixed file name issue for one of the files.
    - Code improvements as suggested by Wildeblood.
    - Added exception for Norby's forthcoming OXP (HDBG)
    - Added some BGS override exceptions
    
    1.0
    - Initial release.
    

    Equipment

    This expansion declares no equipment.

    Ships

    This expansion declares no ships.

    Models

    This expansion declares no models.

    Scripts

    Path
    Scripts/oolite-trumbles-mission.js
    /*
    
    oolite-trumbles-mission.js
    
    Script for random offers of trumbles.
    
    
    Oolite
    Copyright © 2004-2013 Giles C Williams and contributors
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    MA 02110-1301, USA.
    
    Update by phkb to change mission background into overlay, for compatibility with XenonUI.
    
    */
    
    
    /*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
    /*global guiScreen, mission, missionVariables, player*/
    
    
    "use strict";
    
    
    this.name			= "oolite-trumbles";
    this.author			= "Jens Ayton";
    this.copyright		= "© 2008-2016 the Oolite team.";
    this.description	= "Random offers of trumbles.";
    
    
    (function () {
    
    var pendingOffer = false;
    
    
    function cleanUp(script)
    {
    	delete script.shipDockedWithStation;
    	delete script.missionScreenOpportunity;
    	delete script.shipWillExitWitchspace;
    }
    
    
    this.startUp = function startUp()
    {
    	/*	In the pre-JavaScript implementation, the mission variable was set to
    		OFFER_MADE while the mission screen was shown. If the player lanched
    		in that state, the offer would never be made again -- unless some
    		other script used the mission choice keys "YES" or "NO". This
    		implementation uses unique choice keys and doesn't change the mission
    		variable, which should be more reliable in all cases.
    	*/
    	if (missionVariables.trumbles === "OFFER_MADE")
    	{
    		missionVariables.trumbles = "BUY_ME";
    	}
    	else if (missionVariables.trumbles === "TRUMBLE_BOUGHT")
    	{
    		cleanUp(this);
    	}
    	delete this.startUp;
    }
    
    
    this.shipDockedWithStation = function shipDockedWithStation(station)
    {
    	pendingOffer = false;
    	if (missionVariables.novacount || missionVariables.nova)
    	{
    		// So the offers eventually stop for long-time players who keep refusing.
    		return;
    	}
    
    	if (station.isMainStation)
    	{
    		if (!missionVariables.trumbles)	
    		{
    			missionVariables.trumbles = "BUY_ME";
    		}
    
    		if (missionVariables.trumbles === "BUY_ME" &&
    			player.trumbleCount === 0 &&
    			Math.random() < 0.2) // 20% chance of trumble being offered.
    		{
    			pendingOffer = true;
    		}
    	}
    }
    
    
    this.missionScreenOpportunity = function missionScreenOpportunity()
    {
    	if (pendingOffer && player.credits > 6553.5)
    	{
    		pendingOffer = false;
    
    		// Show the mission screen.
    		mission.runScreen({
    			titleKey: "oolite_trumble_title",
    			messageKey: "oolite_trumble_offer",
    			overlay: {name:"trumblebox.png", height:512},
    			choicesKey: "oolite_trumble_offer_yesno",
    			screenID: "oolite-trumbles"
    		},
    		function (choice)
    		{
    			if (choice === "OOLITE_TRUMBLE_YES")
    			{
    				player.credits -= 30;
    				player.ship.awardEquipment("EQ_TRUMBLE");
    
    				missionVariables.trumbles = "TRUMBLE_BOUGHT";
    				cleanUp(this);
    			}
    			else
    			{
    				missionVariables.trumbles = "NOT_NOW";
    			}
    		});
    	}
    };
    
    
    this.shipWillExitWitchspace = function shipWillExitWitchspace()
    {
    	// If player has rejected a trumble offer, reset trumble mission with 2% probability per jump.
    	if (missionVariables.trumbles === "NOT_NOW" && Math.random() < 0.02)
    	{
    		missionVariables.trumbles = "BUY_ME";
    	}
    };
    
    }).call(this);
    
    Scripts/xenonui.js
    (function () {
    	"use strict";
    	this.name = "XenonUI";
    	this.author = "phkb";
    	this.copyright = "2016 phkb";
    	this.description = "New backgrounds for UI screens. Needs one of the Xenon UI Resource packs (A through N) to be installed as well.";
    	this.license = "CC BY-NC-SA 3.0";
    
    	this._lastHUDCheck = false;
    	this._lastHUDHiddenCheck = false;
    	this._defaultsOn = false;
    	this._marketObserverInstalled = false; // flag to indicate when market observer is installed (for wide F8 display)
    	this._marketAdsInstalled = false; // flag to indicate when market ads is installed
    	this._disableMissionScreen = []; // array of mission "screenID's" that will have the background disabled
    	this._chartExitScreenTimer = null;
    	this._missionOverlay = {}; // array of mission screen ID's and image names for overlays
    	this._backgroundOverride = []; // array of mission screen ID's we've forcefully added a background to
    	this._disableOverlays = false; // flag that indicates whether mission overlays will be applied to mission screens
    	this._enableLibGUIInt = true; // flag to indicate whether integration with LibGUI is on or off. true means it is on.
    	this._activeMode = true;
    	this._guiActive = ""; // monitors changes in the currently selected GUI (when Library is installed)
    	this._useBGSSound = ""; // if BGS is installed, will use sounds from BGS with Xenon UI GUI screens
    	this._trueValues = ["yes", "1", 1, "true", true];
    	this._hdbgActive = false; // indicates that the HG Backgrounds OXP is active
    	this._addedID = {}; // keeps track of screen ID's we have added to Library GUI, so we can remove them if another GUI is selected
    	this._xr = null; // link to Xenon Redux UI (if installed)
    	this._defaultBG = {};
    	this._amber = false; // indicates whether blue (false) or amber (true) backgrounds will be used
    	this._ratio = "";
    	this._font = "default";
    	this._f6Overlay = {
    		"economy":null,
    		"government":null,
    		"suncolor":null,
    		"techlevel":null
    	};
    	// configuration settings for use in Lib_Config
    	this._xenonConfig = {
    		Name: this.name,
    		Alias: expandDescription("[xenonui_config_alias]"),
    		Display: expandDescription("[xenonui_config_display]"),
    		Alive: "_xenonConfig",
    		Notify: "$changeSettings",
    		Bool: {
    			B0: {
    				Name: "_disableOverlays",
    				Def: false,
    				Desc: expandDescription("[xenonui_disable_overlays]")
    			},
    			B1: {
    				Name: "_activeMode",
    				Def: true,
    				Desc: expandDescription("[xenonui_active_mode]")
    			},
    			B2: {
    				Name: "_amber",
    				Def: false,
    				Desc: expandDescription("[xenonui_amber]")
    			},
    			Info: expandDescription("[xenonui_config_bool_info]")
    		},
    	};
    
    	/*
    		This OXP replaces all the backgrounds of all UI screens with new versions using a hi-tech-like design theme.
    		In most cases any individual backgrounds supplied by individual OXP's on their mission "runScreen" will overridden by these ones (but see below).
    
    		A resource pack is required to complete the system. Depending on the font you are using in Oolite, you may want to use a specific resource pack to match.
    		The available packs are:
    			Pack name		Font
    			--------------- -----------------------------
    			Pack A (16:9)	OCR A Extended
    			Pack B (16:10)	OCA A Extended
    			Pack C (16:9)	Xolonium
    			Pack D (16:10)	Xolonium
    			Pack E (16:9)	Dangerous Square
    			Pack F (16:10)	Dangerous Square
    			Pack G (16:9)	Default font (Helvetica Bold)
    			Pack H (16:10)	Default font (Helvetica Bold)
    			Pack I (16:9)	Dosis font
    			Pack J (16:10)	Dosis font
    			Pack K (16:9)	Discognate font
    			Pack L (16:10)	Discognate font
    			Pack M (16:9)	NovaSquare font
    			Pack N (16:10)	NovaSquare font
    			
    		More packs may become available as new fonts are released for Oolite.
    
    		This OXP is designed to be compatible with the BackGroundSet (BGS). However, on some systems some BGS images may still be shown,
    		depending on the load order of the OXP's. If this OXP loads after BGS, these images will be used. If BGS loads after this OXP, it's images may be used.
    
    		To disable the BGS images you will need to edit BGS, and rename the "screenbackgrounds.plist" file in the "Config" folder to something like "xcreenbackgrounds.plist".
    
    		If your OXP has backgrounds you want to keep, and you want to still use this OXP, use the "$addMissionScreenException" to your startUpComplete script:
    		Example:
    			var w = worldScripts.XenonUI;
    			if (w) w.$addMissionScreenException("mymissionscreenid");
    
    		Note: When mission screens exit to the short or long range charts, the backgrounds are not being set. So a timer is in place to force the background on.
    
    	*/
    
    	//-------------------------------------------------------------------------------------------------------------
    	// adds a screen ID to the list of mission screen ID's this OXP will not override
    	this.$addMissionScreenException = function $addMissionScreenException(missionScreenID) {
    		var lib = worldScripts.Lib_GUI;
    		if (this._disableMissionScreen.indexOf(missionScreenID) === -1) this._disableMissionScreen.push(missionScreenID);
    		if (lib && this._enableLibGUIInt && (!this._addedID[missionScreenID] || this._addedID[missionScreenID] === 2) && lib.$cur === "XenonUI") {
    			if (!lib.$IDRules[missionScreenID]) {
    				this._addedID[missionScreenID] = 2;
    				this.$passConfig(missionScreenID);
    				// we can only add now...
    				lib.$IDRules[missionScreenID] = {
    					mpic: 0
    				};
    			}
    			//lib.$IDRules[missionScreenID] = {
    			//	mpic: 0
    			//};
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// function to add an overlay image to a mission screen
    	this.$addMissionOverlay = function $addMissionOverlay(missionScreenID, imagename) {
    		if (!this._missionOverlay[missionScreenID] && imagename == null) imagename = "";
    		if (imagename != null) this._missionOverlay[missionScreenID] = imagename;
    		var lib = worldScripts.Lib_GUI;
    		// lib_GUI stuff
    		if (lib && this._enableLibGUIInt) {
    			if (imagename != null && imagename != "") {
    				lib.$IDs.XenonUI[missionScreenID] = {
    					pic: {
    						name: (this._amber === true ? "amber" : "xenon") + "_standard_f0.png",
    						height: 546
    					},
    					picBig: {
    						name: (this._amber === true ? "amber" : "xenon") + "_standard_f0_nohud.png",
    						height: 546
    					},
    					ov: {
    						name: imagename,
    						height: 546
    					},
    					sndRef: this._useBGSSound
    				};
    				if (lib.$cur === "XenonUI") {
    					if (!this._addedID[missionScreenID] || this._addedID[missionScreenID] === 2) {
    						if (!lib.$IDRules[missionScreenID]) {
    							this._addedID[missionScreenID] = 2;
    							this.$passConfig(missionScreenID);
    							// we can only add now...
    							if (this._disableOverlays === true) {
    								lib.$IDRules[missionScreenID] = {
    									pic: 1,
    									ov: 0
    								};
    							} else {
    								lib.$IDRules[missionScreenID] = {
    									pic: 1,
    									ov: 1
    								};
    							}
    						}
    						/*if (this._disableOverlays === true) {
    							lib.$IDRules[missionScreenID] = {
    								pic: 1,
    								ov: 0
    							};
    						} else {
    							lib.$IDRules[missionScreenID] = {
    								pic: 1,
    								ov: 1
    							};
    						}*/
    					}
    				}
    			} else {
    				if (imagename === "") {
    					lib.$IDs.XenonUI[missionScreenID] = {
    						pic: {
    							name: (this._amber === true ? "amber" : "xenon") + "_standard_f0.png",
    							height: 546
    						},
    						picBig: {
    							name: (this._amber === true ? "amber" : "xenon") + "_standard_f0_nohud.png",
    							height: 546
    						},
    						sndRef: this._useBGSSound
    					};
    					if (lib.$cur === "XenonUI" && (!this._addedID[missionScreenID] || this._addedID[missionScreenID] === 2)) {
    						if (!lib.$IDRules[missionScreenID]) {
    							this._addedID[missionScreenID] = 2;
    							this.$passConfig(missionScreenID);
    							// we can only add now...
    							lib.$IDRules[missionScreenID] = {
    								pic: 1
    							};
    						}
    						//lib.$IDRules[missionScreenID] = {
    						//	pic: 1
    						//};
    					}
    				}
    			}
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.$setF6OverlayLookup = function(section, ws, fnName) {
    		var check = ["economy","government","suncolor","techlevel"];
    		if (check.indexOf(section) == -1) {
    			log(this.name, "Exception! Invalid section defined. Must be either 'economy', 'government', 'suncolor' or 'techlevel' - tried to use " + section);
    			return false;
    		}
    		if (!worldScripts[ws][fnName]) {
    			log(this.name, "Exception! WorldScript/Function not found! " + ws + "." + fnName);
    			return false;
    		}
    		this._f6Overlay[section] = {worldscript:ws, functionname:fnName};
    		return true;
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.$clearF6OverlayLookup = function(section) {
    		var check = ["economy","government","suncolor","techlevel"];
    		if (check.indexOf(section) == -1) {
    			log(this.name, "Exception! Invalid section defined. Must be either 'economy', 'government', 'suncolor' or 'techlevel' - tried to use " + section);
    			return false;
    		}
    		this._f6Overlay[section] = null;
    		return true;
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.startUp = function () {
    		if (worldScripts.BGS && worldScripts.BGS.startUp) worldScripts.BGS.startUp();
    		this._xr = worldScripts.XenonReduxUI;
    
    		// check to make sure we have resources (with some scope for new packs)
    		var res = ["Xenon UI Resource Pack A (16:9)", "Xenon UI Resource Pack B (16:10)",
    			"Xenon UI Resource Pack C (16:9)", "Xenon UI Resource Pack D (16:10)",
    			"Xenon UI Resource Pack E (16:9)", "Xenon UI Resource Pack F (16:10)",
    			"Xenon UI Resource Pack G (16:9)", "Xenon UI Resource Pack H (16:10)",
    			"Xenon UI Resource Pack I (16:9)", "Xenon UI Resource Pack J (16:10)",
    			"Xenon UI Resource Pack K (16:9)", "Xenon UI Resource Pack L (16:10)",
    			"Xenon UI Resource Pack M (16:9)", "Xenon UI Resource Pack N (16:10)"
    		];
    
    		var found = false;
    		for (var i = 0; i < res.length; i++) {
    			if (worldScriptNames.indexOf(res[i]) >= 0) {
    				found = true;
    				if (res[i].indexOf("16:9") > 0) this._ratio = "16_9"; else this._ratio = "16_10";
    				break;
    			}
    		}
    		if (found === false) {
    			log(this.name, "ERROR! No Xenon UI Resource packs installed. Xenon UI cannot function without one resource pack installed.");
    			// turn off the OXP here
    			delete this.guiScreenChanged;
    			delete this.missionScreenEnded;
    			delete this.gameResumed;
    			delete this.startUp;
    			delete this.startUpComplete;
    			delete this.infoSystemChanged;
    			delete this.chartHighlightModeChanged;
    			return;
    		}
    
    		var rp = oolite.resourcePaths; 
    		var i = rp.length;
    		while (i--) {
    			if (rp[i].indexOf("Font") >= 0) {
    				if (rp[i].indexOf("NovaSquare") > 0) {this._font = "novasquare"; break;}
    				if (rp[i].indexOf("Discognate") > 0) {this._font = "discognate"; break;}
    				if (rp[i].indexOf("Xolonium") > 0) {this._font = "xolonium"; break;}
    				if (rp[i].indexOf("Dangerous") > 0) {this._font = "dangeroussquare"; break;}
    				if (rp[i].indexOf("Dosis") > 0) {this._font = "dosis"; break;}
    				if (rp[i].indexOf("OCR") > 0) {this._font = "ocraextended"; break;}
    			}
    		}
    
    		var lib = worldScripts.Lib_GUI;
    
    		if (missionVariables.XenonUI_ActiveMode) this._activeMode = (this._trueValues.indexOf(missionVariables.XenonUI_ActiveMode) >= 0 ? true : false);
    		if (missionVariables.XenonUI_DisableOverlays) this._disableOverlays = (this._trueValues.indexOf(missionVariables.XenonUI_DisableOverlays) >= 0 ? true : false);
    		// only reload the amber setting if lib config is present - otherwise we'll just take the preset value
    		if (lib) {
    			if (missionVariables.XenonUI_Amber) this._amber = (this._trueValues.indexOf(missionVariables.XenonUI_Amber) >= 0 ? true : false);
    			this._lastAmber = this._amber;
    		}
    		if (!lib || lib.$cur === "XenonUI") {
    			this.$updateGuiColorSettings();
    		}
    
    		if (worldScripts["BGS"]) this._useBGSSound = "BGS";
    		if (worldScripts["market_observer3"]) this._marketObserverInstalled = true;
    		if (worldScripts["market_ads"]) this._marketAdsInstalled = true;
    		if (worldScripts["hdbg"]) this._hdbgActive = true;
    
    		if (!lib) this._enableLibGUIInt = false;
    		if (lib && this._enableLibGUIInt === true) {
    			// flag some screens as readonly
    			this._addedID["oolite-contracts-parcels-none"] = 1;
    			this._addedID["oolite-contracts-parcels-details"] = 1;
    			this._addedID["oolite-contracts-parcels-summary"] = 1;
    			this._addedID["oolite-contracts-passengers-none"] = 1;
    			this._addedID["oolite-contracts-passengers-details"] = 1;
    			this._addedID["oolite-contracts-passengers-summary"] = 1;
    			this._addedID["oolite-contracts-cargo-none"] = 1;
    			this._addedID["oolite-contracts-cargo-details"] = 1;
    			this._addedID["oolite-contracts-cargo-summary"] = 1;
    			this._addedID["oolite-primablemanager"] = 1;
    			this._addedID["oolite-register"] = 1;
    			this._addedID["Lib_Config"] = 1;
    
    			// disable our standard functions so LibGUI can take over
    			this.$previous_guiScreenChanged = this.guiScreenChanged;
    			delete this.guiScreenChanged;
    			var ver = lib.version.split(".");
    			if (ver.length >= 2) {
    				// only delete the infoSystemChanged if Lib GUI is greater than version 1.1
    				if (parseInt(ver[0]) > 1 || parseInt(ver[1]) > 1 || ver.length > 2)
    					delete this.infoSystemChanged;
    			}
    			delete this.missionScreenEnded;
    			delete this.gameResumed;
    			delete this.startUp;
    			this.$libGUISetup();
    		}
    		// if we don't have library to orchestrate backgrounds, disable "better screens" so xenon UI has priority
    		// otherwise, we end up with a clash of different background sets
    		if (!lib && worldScripts["smivs_screen-backgrounds_worldscript"]) {
    			worldScripts["smivs_screen-backgrounds_worldscript"].hide_guiScreenChanged = worldScripts["smivs_screen-backgrounds_worldscript"].guiScreenChanged;
    			delete worldScripts["smivs_screen-backgrounds_worldscript"].guiScreenChanged;
    		}
    
    		this.$addStandardMissionScreenOverlays();
    		this.$addStandardMissionScreenExceptions();
    
    		if (worldScripts["BGS-M"] && (!lib || this._enableLibGUIInt === false)) {
    			// bgs does a frame callback to apply screen overlays to the LRC
    			// however, with 1.80 the overlays don't work anymore
    			// unfortunately, the frame callback is still running which then removes the XenonUI F6 overlay
    			// to prevent this, we're monkey patching the framecallback destination function to be an empty function
    			// that appears to be the only way to stop BGS from doing the screen overlay thing, without actually getting a separate fix released for it.
    			var bgs = worldScripts["BGS-M"];
    			if (!bgs.x_doBGSChartsTimer) {
    				bgs.x_doBGSChartsTimer = bgs.doBGSChartsTimer;
    				bgs.doBGSChartsTimer = function (delta) {};
    			}
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.startUpComplete = function () {
    		// register our settings, if Lib_Config is present
    		if (worldScripts.Lib_Config) {
    			worldScripts.Lib_Config._registerSet(this._xenonConfig);
    			this.$setBGSDefaultBackgrounds();
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.playerWillSaveGame = function () {
    		missionVariables.XenonUI_ActiveMode = this._activeMode;
    		missionVariables.XenonUI_DisableOverlays = this._disableOverlays;
    		missionVariables.XenonUI_Amber = this._amber;
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.chartHighlightModeChanged = function (newMode) {
    		if (this._enableLibGUIInt === false) {
    			this.guiScreenChanged("", "");
    		} else {
    			var lib = worldScripts.Lib_GUI;
    			var f6ovr = "f6-overlay.png";
    			if (player.ship.hasOwnProperty("chartHighlightMode") === true) {
    				switch (player.ship.chartHighlightMode) {
    					case "OOLRC_MODE_SUNCOLOR":
    						var lookup = this._f6Overlay.suncolor;
    						if (lookup) {
    							f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    						} else {
    							f6ovr = "f6-overlay-suncolor.png";
    						}
    						break;
    					case "OOLRC_MODE_TECHLEVEL":
    						var lookup = this._f6Overlay.techlevel;
    						if (lookup) {
    							f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    						} else {
    							f6ovr = "f6-overlay-techlevel.png";
    						}
    						break;
    					case "OOLRC_MODE_ECONOMY":
    						var lookup = this._f6Overlay.economy;
    						if (lookup) {
    							f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    						} else {
    							f6ovr = "f6-overlay-economy.png";
    						}
    						break;
    					case "OOLRC_MODE_GOVERNMENT":
    						var lookup = this._f6Overlay.government;
    						if (lookup) {
    							f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    						} else {
    							f6ovr = "f6-overlay-government.png";
    						}
    						break;
    				}
    			}
    			lib.$guis.XenonUI.GUI_SCREEN_SHORT_RANGE_CHART.ov = {
    				name: f6ovr,
    				height: 546
    			};
    			lib.$guis.XenonUI.GUI_SCREEN_LONG_RANGE_CHART.ov = {
    				name: f6ovr,
    				height: 546
    			};
    			lib.guiScreenChanged();
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.infoSystemChanged = function (to, from) {
    		var lib = worldScripts.Lib_GUI;
    		if (lib && this._enableLibGUIInt === true) {
    			// force lib gui to do a screen update
    			lib.guiScreenChanged();
    			return;
    		}
    		this.guiScreenChanged(guiScreen, guiScreen);
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.guiScreenChanged = function (to, from) {
    
    		var p = player.ship;
    		var startTimer = false;
    		var imagetype = "standard";
    		var redalert = "";
    		var nohud = "";
    		var imagename = "";
    		var ana = "";
    		var overlay = "";
    		var overlayHeight = 0;
    
    		if (this._marketObserverInstalled) {
    			if (from === "GUI_SCREEN_MARKET" || from === "GUI_SCREEN_MARKETINFO" || to === "GUI_SCREEN_MARKET" || to === "GUI_SCREEN_MARKETINFO")
    				// Because market observer uses a specialised HUD a slightly incorrect background image was being selected.
    				// This was unnoticable if the "allow_big_gui" was not enabled on the default HUD, but quite noticeable on the Xenon HUD.
    				// So we start a timer to force the correct background after Market Observer has set or reset the HUD.
    				startTimer = true;
    		}
    
    		// fix for the issue where exiting the ship library screen could sometimes result in the wrong background being displayed
    		// this would only be apparent with HUD's that don't implement the "allow_big_gui" setting.
    		if (from === "GUI_SCREEN_SHIPLIBRARY" && p && p.docked) startTimer = true;
    
    		if (p.alertCondition === 3) redalert = "_redalert";
    		if (p.hudHidden) nohud = "_nohud";
    		if (this.$isBigGuiActive() === true) nohud = "_nohud";
    		if (p.isInSpace) {
    			imagetype = "inflight";
    			// going to assume that nohud versions of inflight guis are not that important
    			nohud = "";
    		}
    
    		switch (guiScreen) {
    			case "GUI_SCREEN_MAIN":
    				return;
    			case "GUI_SCREEN_SHIPLIBRARY":
    				imagename = "f0";
    				nohud = "_nohud";
    				break;
    			case "GUI_SCREEN_KEYBOARD":
    				imagename = "nomenu";
    				nohud = "_nohud";
    				if (this._disableOverlays === false) overlay = "xui-keyboard.png";
    				break;
    			case "GUI_SCREEN_STICKPROFILE":
    				imagename = "f2";
    				nohud = "";
    				break;
    			case "GUI_SCREEN_STICKMAPPER":
    				imagename = "f2";
    				nohud = "";
    				if (this._disableOverlays === false) overlay = "xui-gamepad.png";
    				break;
    			case "GUI_SCREEN_OPTIONS":
    				imagename = "f2";
    				if (this._disableOverlays === false) overlay = "xui-settings.png";
    				break;
    			case "GUI_SCREEN_LOAD":
    				imagename = "f2";
    				if (this._disableOverlays === false) overlay = "xui-load.png";
    				break;
    			case "GUI_SCREEN_SAVE":
    				imagename = "f2";
    				if (this._disableOverlays === false) overlay = "xui-save.png";
    				break;
    			case "GUI_SCREEN_SAVE_OVERWRITE":
    				imagename = "f2";
    				if (this._disableOverlays === false) overlay = "xui-question.png";
    				break;
    			case "GUI_SCREEN_EQUIP_SHIP":
    				imagename = "f3-1";
    				if (this._disableOverlays === false) overlay = "xui-equipship.png";
    				break;
    			case "GUI_SCREEN_SHIPYARD":
    				imagename = "f3-2";
    				break;
    			case "GUI_SCREEN_INTERFACES":
    				imagename = "f4";
    				if (this._disableOverlays === false) overlay = "xui-interfaces.png";
    				break;
    			case "GUI_SCREEN_STATUS":
    				imagename = "f5-1";
    				// override BGS status and nocrowd image, if installed.
    				if (worldScripts["BGS-M"]) {
    					worldScripts["BGS-M"].bgsI.status = {
    						name: (this._amber === true ? "amber" : "xenon") + "_" + imagetype + "_" + imagename + nohud + redalert + ".png",
    						height: 546
    					};
    					worldScripts["BGS-M"].bgsI.noCrowd = {
    						name: (this._amber === true ? "amber" : "xenon") + "_" + imagetype + "_" + imagename + nohud + redalert + ".png",
    						height: 546
    					};
    				}
    				/*if (this._disableOverlays === false) {
    					if (this.$playerHasDamagedEquipment() === true) {
    						overlay = "xui-warning.png";
    					} else {
    						overlay = "xui-ok.png";
    					}
    				}*/
    				break;
    			case "GUI_SCREEN_MANIFEST":
    				imagename = "f5-2";
    				if (this._disableOverlays === false) overlay = "xui-clipboard.png";
    				break;
    			case "GUI_SCREEN_SHORT_RANGE_CHART":
    			case "GUI_SCREEN_LONG_RANGE_CHART":
    				if (guiScreen == "GUI_SCREEN_SHORT_RANGE_CHART") imagename = "f6";
    				if (guiScreen == "GUI_SCREEN_LONG_RANGE_CHART") {
    					imagename = "f6-2";
    					if (worldScripts["BGS-M"]) worldScripts["BGS-M"].bgsI.lrc = {
    						name: (this._amber === true ? "amber" : "xenon") + "_" + imagetype + "_" + imagename + ana + nohud + redalert + ".png",
    						height: 546
    					};
    				}
    				ana = "_ana";
    				if (p.equipmentStatus("EQ_ADVANCED_NAVIGATIONAL_ARRAY") != "EQUIPMENT_OK") ana = "_no_ana";
    				if (p.hasOwnProperty("chartHighlightMode") === true) {
    					switch (p.chartHighlightMode) {
    						case "OOLRC_MODE_SUNCOLOR":
    							var lookup = this._f6Overlay.suncolor;
    							if (lookup) {
    								overlay = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    							} else {
    								overlay = "f6-overlay-suncolor.png";
    							}
    							break;
    						case "OOLRC_MODE_TECHLEVEL":
    							var lookup = this._f6Overlay.techlevel;
    							if (lookup) {
    								overlay = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    							} else {
    								overlay = "f6-overlay-techlevel.png";
    							}
    							break;
    						case "OOLRC_MODE_ECONOMY":
    							var lookup = this._f6Overlay.economy;
    							if (lookup) {
    								overlay = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    							} else {
    								overlay = "f6-overlay-economy.png";
    							}
    							break;
    						case "OOLRC_MODE_GOVERNMENT":
    							var lookup = this._f6Overlay.government;
    							if (lookup) {
    								overlay = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    							} else {
    								overlay = "f6-overlay-government.png";
    							}
    							break;
    					}
    				} else {
    					overlay = "f6-overlay.png";
    				}
    				break;
    			case "GUI_SCREEN_SYSTEM_DATA":
    				imagename = "f7";
    				var sysinf = System.infoForSystem(galaxyNumber, p.targetSystem);
    				if (sysinf["sun_gone_nova"] || sysinf["sun_going_nova"]) imagename += "_nova";
    				break;
    			case "GUI_SCREEN_MARKET":
    				imagename = "f8";
    				if (this._disableOverlays === false) overlay = "xui-market.png";
    				if (this._marketObserverInstalled) imagename += "_wide";
    				break;
    			case "GUI_SCREEN_MARKETINFO":
    				imagename = "f8-2";
    				if (this._marketObserverInstalled) imagename += "_wide";
    				if (this._disableOverlays === false) overlay = "xui-tag.png";
    				break;
    			case "GUI_SCREEN_REPORT":
    				imagename = "f0";
    				if (this._disableOverlays === false) overlay = "xui-report.png";
    				if (this._hdbgActive === true) return;
    				break;
    			case "GUI_SCREEN_MISSION":
    				imagename = "f0";
    				// look for any exceptions and jump out if found
    				if (this._disableMissionScreen.indexOf(mission.screenID) != -1) imagename = "disable";
    				// check if we have an overlay to apply to this mission screen
    				if (this._disableOverlays === false && this._disableMissionScreen.indexOf(mission.screenID) === -1) {
    					if (this._missionOverlay[mission.screenID]) overlay = this._missionOverlay[mission.screenID];
    				}
    				break;
    		}
    
    		// build the file filename if it hasn't been disabled
    		if (imagename != "disable") {
    			imagename = (this._amber === true ? "amber_" : "xenon_") + imagetype + "_" + imagename + ana + nohud + redalert + ".png";
    			// load the image to the background
    			setScreenBackground({
    				name: imagename,
    				height: 546
    			});
    		}
    		// apply the overlay if one was found
    		if (overlay != "") setScreenOverlay({
    			name: overlay,
    			height: 546
    		});
    
    		// start a timer to force the background, if required
    		if (startTimer) {
    			if (this._chartExitScreenTimer && this._chartExitScreenTimer.isRunning) this._chartExitScreenTimer.stop();
    			this._chartExitScreenTimer = new Timer(this, this.$addBackground, 0.25, 0);
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.missionScreenEnded = function () {
    		this.guiScreenChanged("", "");
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.gameResumed = function () {
    		this.guiScreenChanged("", "");
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// adds overlays to the standard mission screens
    	this.$addStandardMissionScreenOverlays = function $addStandardMissionScreenOverlays() {
    		this.$addMissionOverlay("oolite-contracts-parcels-none", "xui-briefcase.png");
    		this.$addMissionOverlay("oolite-contracts-parcels-summary", "xui-briefcase.png");
    		this.$addMissionOverlay("oolite-contracts-passengers-none", "xui-boardingpass.png");
    		this.$addMissionOverlay("oolite-contracts-passengers-summary", "xui-boardingpass.png");
    		this.$addMissionOverlay("oolite-contracts-cargo-none", "xui-cargo.png");
    		this.$addMissionOverlay("oolite-contracts-cargo-summary", "xui-cargo.png");
    		this.$addMissionOverlay("oolite-primablemanager", "xui-switch.png");
    		this.$addMissionOverlay("oolite-register", "xui-register.png");
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// adds map screen exceptions for known screen ID's
    	this.$addStandardMissionScreenExceptions = function $addStandardMissionScreenExceptions() {
    		// each of these items can't be set using setScreenBackground - needs to be done via the plist file
    		this.$addMissionScreenException("oolite-contracts-parcels-details");
    		this.$addMissionScreenException("oolite-contracts-passengers-details");
    		this.$addMissionScreenException("oolite-contracts-cargo-details");
    		this.$addMissionScreenException("rrs_mission_map");
    		this.$addMissionScreenException("blackmonks-map");
    		this.$addMissionScreenException("ups-map");
    		this.$addMissionScreenException("escort-contracts");
    		if (worldScripts.Random_Hits) {
    			var ver = worldScripts.Random_Hits.version.split(".");
    			if (parseInt(ver[0]) > 1 ||
    				(parseInt(ver[0]) === 1 && parseInt(ver[1])) > 11 ||
    				(parseInt(ver[0]) === 1 && parseInt(ver[1]) === 11 && parseInt(ver[2]) > 2)) {
    				this.$addMissionScreenException("random_hits_map");
    			} else {
    				this.$addMissionScreenException("random_hits");
    			}
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// callback handler for when settings are changed
    	this.$changeSettings = function $changeSettings() {
    		var lib = worldScripts.Lib_GUI;
    		if (this._amber != this._lastAmber) {
    			this.$libGUISetup();
    			this._lastAmber = this._amber;
    		}
    		if (lib.$cur === "XenonUI") {
    			if (global.setScreenBackgroundForKey) this.$setBackgroundDefaults(true);
    			this.$updateGuiColorSettings();
    		}
    		// because of changes to library gui (from version 1.7), overlays can no longer be changed dynamically and will always be on/off
    		// until the game is saved and reloaded
    		/*if (this._disableOverlays === true) {
    			if (this._enableLibGUIInt === true && lib && lib.$cur === "XenonUI") {
    				var keys = Object.keys(this._missionOverlay);
    				for (var i = 0; i < keys.length; i++) {
    					if (!this._addedID[keys[i]] || this._addedID[keys[i]] === 2) {
    						if (!lib.$IDRules[keys[i]]) {
    							this._addedID[keys[i]] = 2;
    							this.$passConfig(keys[i]);
    						}
    						lib.$IDRules[keys[i]] = {
    							pic: 1,
    							ov: 0
    						};
    					}
    				}
    			}
    		} else {
    			if (this._enableLibGUIInt === true && lib && lib.$cur === "XenonUI") {
    				var keys = Object.keys(this._missionOverlay);
    				for (var i = 0; i < keys.length; i++) {
    					if (!this._addedID[keys[i]] || this._addedID[keys[i]] === 2) {
    						if (!lib.$IDRules[keys[i]]) {
    							this._addedID[keys[i]] = 2;
    							this.$passConfig(keys[i]);
    						}
    						lib.$IDRules[keys[i]] = {
    							pic: 1,
    							ov: 1
    						};
    					}
    				}
    			}
    		}*/
    		// reset our monitoring array regardless of which gui is active
    		if (this._activeMode === false) this._backgroundOverride = [];
    
    		this.$setupGeneralOverlays();
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// sets up the LibGUI parameters
    	this.$libGUISetup = function $libGUISetup() {
    
    		// setup some event callbacks
    		this.guiScreenChanged = this.$guiScreenChanged;
    		this.equipmentDamaged = this.$equipmentDamaged;
    		this.equipmentRepaired = this.$equipmentRepaired;
    		this.equipmentAdded = this.$equipmentAdded;
    		this.equipmentRemoved = this.$equipmentRemoved;
    		this.missionScreenEnded = this.$missionScreenEnded;
    
    		var style = (this._amber === true ? "amber" : "xenon");
    
    		var lib = worldScripts.Lib_GUI;
    		lib.$guis.XenonUI = {
    			GUI_SCREEN_GAMEOPTIONS: {
    				pic: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f2_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f2.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f2_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_LOAD: {
    				pic: {
    					name: style + "_standard_nomenu.png",
    					height: 546
    				}
    			},
    			GUI_SCREEN_SAVE: {
    				pic: {
    					name: style + "_standard_nomenu.png",
    					height: 546
    				}
    			},
    			GUI_SCREEN_SAVE_OVERWRITE: {
    				pic: {
    					name: style + "_standard_nomenu.png",
    					height: 546
    				}
    			},
    			GUI_SCREEN_EQUIP_SHIP: {
    				pic: {
    					name: style + "_standard_f3-1.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f3-1_nohud.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_INTERFACES: {
    				pic: {
    					name: style + "_standard_f4.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f4_nohud.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_KEYBOARD: {
    				pic: {
    					name: style + "_standard_nomenu_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_standard_nomenu_nohud.png",
    					height: 546
    				}
    			},
    			GUI_SCREEN_MANIFEST: {
    				pic: {
    					name: style + "_standard_f5-2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f5-2_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f5-2.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f5-2_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_MARKET: {
    				pic: {
    					name: style + "_standard_f8" + (this._marketObserverInstalled === true ? "_wide" : "") + ".png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f8" + (this._marketObserverInstalled === true ? "_wide" : "") + "_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f8" + (this._marketObserverInstalled === true ? "_wide" : "") + ".png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f8" + (this._marketObserverInstalled === true ? "_wide" : "") + "_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_MARKETINFO: {
    				pic: {
    					name: style + "_standard_f8-2" + (this._marketObserverInstalled === true ? "_wide" : "") + ".png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f8-2" + (this._marketObserverInstalled === true ? "_wide" : "") + "_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f8-2" + (this._marketObserverInstalled === true ? "_wide" : "") + ".png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f8-2" + (this._marketObserverInstalled === true ? "_wide" : "") + "_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_OPTIONS: {
    				pic: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f2_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f2.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f2_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_SHIPLIBRARY: {
    				pic: {
    					name: style + "_standard_f0_nohud.png",
    					height: 546
    				}
    			},
    			GUI_SCREEN_SHIPYARD: {
    				pic: {
    					name: style + "_standard_f3-2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f3-2_nohud.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_STATUS: {
    				pic: {
    					name: style + "_standard_f5-1.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f5-1_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f5-1.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f5-1_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_STICKMAPPER: {
    				pic: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_flight_f2.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_STICKPROFILE: {
    				pic: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f2.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_flight_f2.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    			GUI_SCREEN_SYSTEM_DATA: {
    				pic: {
    					name: style + "_standard_f7.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f7_nohud.png",
    					height: 546
    				},
    				picNova: {
    					name: style + "_standard_f7_nova.png",
    					height: 546
    				},
    				picNovaBig: {
    					name: style + "_standard_f7_nova_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f7.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f7_redalert.png",
    					height: 546
    				},
    				picNovaRed: {
    					name: style + "_inflight_f7_nova_redalert.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			},
    		};
    
    		if (this._hdbgActive === false) {
    			lib.$guis.XenonUI.generic = {
    				pic: {
    					name: style + "_standard_nomenu.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			};
    			lib.$guis.XenonUI.GUI_SCREEN_REPORT = {
    				pic: {
    					name: style + "_standard_f0.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f0_nohud.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			};
    		}
    
    		this.$setupVariableScreens();
    		this.$setupGeneralOverlays();
    
    		// mission screen IDs
    		lib.$IDs.XenonUI = {
    			generic: {
    				pic: {
    					name: style + "_standard_f0.png",
    					height: 546
    				},
    				picBig: {
    					name: style + "_standard_f0_nohud.png",
    					height: 546
    				},
    				picFlight: {
    					name: style + "_inflight_f0.png",
    					height: 546
    				},
    				picRed: {
    					name: style + "_inflight_f0_redalert.png",
    					height: 546
    				},
    				ov: {
    					name: style + "_standard_f0.png",
    					height: 546
    				},
    				ovBig: {
    					name: style + "_standard_f0_nohud.png",
    					height: 546
    				},
    				sndRef: this._useBGSSound
    			}
    		};
    
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// adjust background images on F5/F6 screen based on availability/status of equipment
    	this.$setupVariableScreens = function $setupVariableScreens() {
    		var ana = "_ana";
    		if (player.ship.equipmentStatus("EQ_ADVANCED_NAVIGATIONAL_ARRAY") != "EQUIPMENT_OK") ana = "_no_ana";
    
    		var lib = worldScripts.Lib_GUI;
    		var f6ovr = "f6-overlay.png";
    		if (player.ship.hasOwnProperty("chartHighlightMode") === true) {
    			switch (player.ship.chartHighlightMode) {
    				case "OOLRC_MODE_SUNCOLOR":
    					var lookup = this._f6Overlay.suncolor;
    					if (lookup) {
    						f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    					} else {
    						f6ovr = "f6-overlay-suncolor.png";
    					}
    					break;
    				case "OOLRC_MODE_TECHLEVEL":
    					var lookup = this._f6Overlay.techlevel;
    					if (lookup) {
    						f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    					} else {
    						f6ovr = "f6-overlay-techlevel.png";
    					}
    					break;
    				case "OOLRC_MODE_ECONOMY":
    					var lookup = this._f6Overlay.economy;
    					if (lookup) {
    						f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    					} else {
    						f6ovr = "f6-overlay-economy.png";
    					}
    					break;
    				case "OOLRC_MODE_GOVERNMENT":
    					var lookup = this._f6Overlay.government;
    					if (lookup) {
    						f6ovr = worldScripts[lookup.worldscript][lookup.functionname](this._ratio, this._font);
    					} else {
    						f6ovr = "f6-overlay-government.png";
    					}
    					break;					
    			}
    		}
    
    		var style = (this._amber === true ? "amber" : "xenon");
    
    		lib.$guis.XenonUI.GUI_SCREEN_SHORT_RANGE_CHART = {
    			pic: {
    				name: style + "_standard_f6" + ana + ".png",
    				height: 546
    			},
    			picBig: {
    				name: style + "_standard_f6" + ana + "_nohud.png",
    				height: 546
    			},
    			picFlight: {
    				name: style + "_inflight_f6" + ana + ".png",
    				height: 546
    			},
    			picRed: {
    				name: style + "_inflight_f6" + ana + "_redalert.png",
    				height: 546
    			},
    			ov: {
    				name: f6ovr,
    				height: 546
    			},
    			sndRef: this._useBGSSound
    		};
    		lib.$guis.XenonUI.GUI_SCREEN_LONG_RANGE_CHART = {
    			pic: {
    				name: style + "_standard_f6-2" + ana + ".png",
    				height: 546
    			},
    			picBig: {
    				name: style + "_standard_f6-2" + ana + "_nohud.png",
    				height: 546
    			},
    			picFlight: {
    				name: style + "_inflight_f6-2" + ana + ".png",
    				height: 546
    			},
    			picRed: {
    				name: style + "_inflight_f6-2" + ana + "_redalert.png",
    				height: 546
    			},
    			ov: {
    				name: f6ovr,
    				height: 546
    			},
    			sndRef: this._useBGSSound
    		};
    
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// adjust overlay images on general (non-mission) screens
    	this.$setupGeneralOverlays = function $setupGeneralOverlays() {
    
    		var lib = worldScripts.Lib_GUI.$guis.XenonUI;
    
    		if (this._disableOverlays) {
    			delete lib.GUI_SCREEN_GAMEOPTIONS["ov"];
    			delete lib.GUI_SCREEN_LOAD["ov"];
    			delete lib.GUI_SCREEN_SAVE["ov"];
    			delete lib.GUI_SCREEN_SAVE_OVERWRITE["ov"];
    			delete lib.GUI_SCREEN_EQUIP_SHIP["ov"];
    			delete lib.GUI_SCREEN_INTERFACES["ov"];
    			delete lib.GUI_SCREEN_KEYBOARD["ov"];
    			delete lib.GUI_SCREEN_MANIFEST["ov"];
    			delete lib.GUI_SCREEN_MARKET["ov"];
    			delete lib.GUI_SCREEN_MARKETINFO["ov"];
    			delete lib.GUI_SCREEN_OPTIONS["ov"];
    			if (this._hdbgActive === false) delete lib.GUI_SCREEN_REPORT["ov"];
    			//delete lib.GUI_SCREEN_STATUS["ov"];
    			delete lib.GUI_SCREEN_STICKMAPPER["ov"];
    		} else {
    			lib.GUI_SCREEN_GAMEOPTIONS["ov"] = {
    				name: "xui-settings.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_LOAD["ov"] = {
    				name: "xui-load.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_SAVE["ov"] = {
    				name: "xui-save.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_SAVE_OVERWRITE["ov"] = {
    				name: "xui-question.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_EQUIP_SHIP["ov"] = {
    				name: "xui-equipship.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_INTERFACES["ov"] = {
    				name: "xui-interfaces.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_KEYBOARD["ov"] = {
    				name: "xui-keyboard.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_MANIFEST["ov"] = {
    				name: "xui-clipboard.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_MARKET["ov"] = {
    				name: "xui-market.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_MARKETINFO["ov"] = {
    				name: "xui-tag.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_OPTIONS["ov"] = {
    				name: "xui-settings.png",
    				height: 546
    			};
    			if (this._hdbgActive === false) lib.GUI_SCREEN_REPORT["ov"] = {
    				name: "xui-report.png",
    				height: 546
    			};
    			lib.GUI_SCREEN_STICKMAPPER["ov"] = {
    				name: "xui-gamepad.png",
    				height: 546
    			};
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// alternate version for use with Lib_GUI
    	this.$missionScreenEnded = function $missionScreenEnded() {
    		var lib = worldScripts.Lib_GUI;
    		if (player.ship.hudAllowsBigGui != this._lastHUDCheck) {
    			if (global.setScreenBackgroundForKey) this.$setBackgroundDefaults(true);
    			this._lastHUDCheck = player.ship.hudAllowsBigGui;
    		}
    		if (this._guiActive != lib.$cur && (this._guiActive === "XenonUI" || lib.$cur === "XenonUI")) {
    			if (lib.$cur === "XenonUI") {
    				// if we've got it available (v1.85/86) then force the default screen background to be Xenon's
    				if (global.setScreenBackgroundForKey) this.$setBackgroundDefaults(true);
    				this.$updateGuiColorSettings();
    				for (var i = 0; i < this._disableMissionScreen.length; i++) {
    					if (!this._addedID[this._disableMissionScreen[i]] || this._addedID[this._disableMissionScreen[i]] === 2) {
    						if (!lib.$IDRules[this._disableMissionScreen[i]]) {
    							this._addedID[this._disableMissionScreen[i]] = 2;
    							this.$passConfig(this._disableMissionScreen[i]);
    							// we can only add now...
    							lib.$IDRules[this._disableMissionScreen[i]] = {
    								mpic: 0
    							};
    						}
    						//lib.$IDRules[this._disableMissionScreen[i]] = {
    						//	mpic: 0
    						//};
    					}
    				}
    				var keys = Object.keys(this._missionOverlay);
    				for (var i = 0; i < keys.length; i++) {
    					// update Lib_GUI with our settings for mission screens
    					if (!this._addedID[keys[i]] || this._addedID[keys[i]] === 2) {
    						if (!lib.$IDRules[keys[i]]) {
    							this._addedID[keys[i]] = 2;
    							this.$passConfig(keys[i]);
    							if (this._missionOverlay[keys[i]] != "") {
    								if (this._disableOverlays === true) {
    									lib.$IDRules[keys[i]] = {
    										pic: 1,
    										ov: 0
    									};
    								} else {
    									lib.$IDRules[keys[i]] = {
    										pic: 1,
    										ov: 1
    									};
    								}
    							} else {
    								lib.$IDRules[keys[i]] = {
    									pic: 1
    								};
    							}
    						}
    						/*if (this._missionOverlay[keys[i]] != "") {
    							if (this._disableOverlays === true) {
    								lib.$IDRules[keys[i]] = {
    									pic: 1,
    									ov: 0
    								};
    							} else {
    								lib.$IDRules[keys[i]] = {
    									pic: 1,
    									ov: 1
    								};
    							}
    						} else {
    							lib.$IDRules[keys[i]] = {
    								pic: 1
    							};
    						}*/
    					}
    				}
    			} else {
    				// if we've got it available (v1.85/86) then reset the default screen backgrounds to be what it was previously
    				if (global.setScreenBackgroundForKey) this.$setBackgroundDefaults(false);
    			}
    			this._guiActive = lib.$cur;
    		}
    		lib.guiScreenChanged()
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// activated when Library GUI is in use
    	// gets any unrecorded mission ScreenID's add add them to the list of rules to use Xenon
    	this.$guiScreenChanged = function $guiScreenChanged(to, from) {
    		if (guiScreen === "GUI_SCREEN_STATUS") {
    			// this bit should only be run once after load
    			if (this._guiActive === "") {
    				// force all the screen rego stuff to happen if xenon was set after loading
    				if (worldScripts.Lib_GUI.$cur === "XenonUI") {
    					this.missionScreenEnded();
    					this.$setBackgroundDefaults(true);
    				}
    				// make sure our local copy gets updated
    				this._guiActive = worldScripts.Lib_GUI.$cur;
    			}
    		}
    
    		if (guiScreen === "GUI_SCREEN_MISSION" && this._guiActive === "XenonUI" && this._activeMode === true) {
    			if (player.ship.hudHidden != this._lastHUDHiddenCheck) {
    				this.$setBackgroundDefaults(true);
    				this._lastHUDHiddenCheck = player.ship.hudHidden;
    			}
    
    			if (mission.screenID && mission.screenID != "" && this._disableMissionScreen.indexOf(mission.screenID) === -1) {
    				this.$addMissionOverlay(mission.screenID, null);
    				// make a note of any screen we add this way
    				if (this._backgroundOverride.indexOf(mission.screenID) === -1) this._backgroundOverride.push(mission.screenID);
    				// force an update
    				worldScripts.Lib_GUI.guiScreenChanged();
    			}
    			// we'll try to override LibGUI if a mission screen is displayed without a screenID
    			if (!mission.screenID) {
    				this.$previous_guiScreenChanged(to, from);
    			}
    		}
    
    		// force an update so the right overlay is used
    		if (to == "GUI_SCREEN_SHORT_RANGE_CHART" || to == "GUI_SCREEN_LONG_RANGE_CHART") {
    			this.chartHighlightModeChanged();
    		}
    
    		// these two screens need to be prodded a little in Library GUI to force the right background
    		// when Market Ads is in play
    		if ((to == "GUI_SCREEN_MARKET" || from == "GUI_SCREEN_MARKET") && this._marketAdsInstalled) {
    			this._fix = new Timer(this, function() {worldScripts.Lib_GUI.guiScreenChanged()}, 0.25, 0);
    		}
    		if (to == "GUI_SCREEN_SYSTEM_DATA") {
    			worldScripts.Lib_GUI.guiScreenChanged()
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// activated when Library GUI is in use
    	this.$equipmentAdded = function $equipmentAdded(equipmentKey) {
    		if (equipmentKey != "EQ_ADVANCED_NAVIGATIONAL_ARRAY") return;
    		this.$setupVariableScreens();
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// activated when Library GUI is in use
    	this.$equipmentRemoved = function $equipmentRemoved(equipmentKey) {
    		if (equipmentKey != "EQ_ADVANCED_NAVIGATIONAL_ARRAY") return;
    		this.$setupVariableScreens();
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// activated when Library GUI is in use
    	this.$equipmentDamaged = function $equipmentDamaged(equipmentKey) {
    		if (equipmentKey != "EQ_ADVANCED_NAVIGATIONAL_ARRAY") return;
    		this.$setupVariableScreens();
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// activated when Library GUI is in use
    	this.$equipmentRepaired = function $equipmentRepaired(equipmentKey) {
    		if (equipmentKey != "EQ_ADVANCED_NAVIGATIONAL_ARRAY") return;
    		this.$setupVariableScreens();
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// forces a background after the timer has expired
    	this.$addBackground = function $addBackground() {
    		this.guiScreenChanged("", "");
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// returns true if a HUD with allowBigGUI is enabled, otherwise false
    	this.$isBigGuiActive = function $isBigGuiActive() {
    		if (oolite.compareVersion("1.83") <= 0) {
    			return player.ship.hudAllowsBigGui;
    		} else {
    			var bigGuiHUD = ["XenonHUD.plist", "coluber_hud_ch01-dock.plist"]; // until there is a property we can check, I'll be listing HUD's that have the allow_big_gui property set here
    			if (bigGuiHUD.indexOf(player.ship.hud) >= 0) {
    				return true;
    			} else {
    				return false;
    			}
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// returns true if any of the visible equipment items are damaged
    	this.$playerHasDamagedEquipment = function $playerHasDamagedEquipment() {
    		var p = player.ship;
    		var eq = p.equipment;
    		for (var i = 0; i < eq.length; i++) {
    			var itm = eq[i];
    			if (itm.isVisible === true && p.equipmentStatus(itm.equipmentKey) === "EQUIPMENT_DAMAGED") return true;
    		}
    		return false;
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.$setBackgroundDefaults = function $setBackgroundDefaults(onOff) {
    		if (onOff === true) {
    			if (this._defaultsOn == false) {
    				this._defaultBG["long_range_chart_mission"] = getScreenBackgroundForKey("long_range_chart_mission");
    				this._defaultBG["short_range_chart_mission"] = getScreenBackgroundForKey("short_range_chart_mission");
    				this._defaultBG["custom_chart_mission"] = getScreenBackgroundForKey("custom_chart_mission");
    				this._defaultBG["long_range_chart"] = getScreenBackgroundForKey("long_range_chart");
    				this._defaultBG["short_range_chart"] = getScreenBackgroundForKey("short_range_chart");
    				this._defaultBG["keyboardsettings"] = getScreenBackgroundForKey("keyboardsettings");
    				this._defaultBG["load_save"] = getScreenBackgroundForKey("load_save");
    				this._defaultBG["mount_weapon"] = getScreenBackgroundForKey("mount_weapon");
    				this._defaultBG["newgame"] = getScreenBackgroundForKey("newgame");
    				this._defaultBG["settings"] = getScreenBackgroundForKey("settings");
    				this._defaultBG["shiplibrary"] = getScreenBackgroundForKey("shiplibrary");
    				this._defaultBG["paused_docked_overlay"] = getScreenBackgroundForKey("paused_docked_overlay");
    				this._defaultBG["paused_overlay"] = getScreenBackgroundForKey("paused_overlay");
    				this._defaultBG["oxz-manager"] = getScreenBackgroundForKey("oxz-manager");
    			}
    			this._defaultsOn = true;
    
    			var p = player.ship;
    			var nohud = "";
    			var ana = "_ana";
    			var style = (this._amber === true ? "amber" : "xenon");
    			if (this.$isBigGuiActive() === true) nohud = "_nohud";
    			if (p.equipmentStatus("EQ_ADVANCED_NAVIGATIONAL_ARRAY") != "EQUIPMENT_OK") ana = "_no_ana";
    
    			var imagename = style + "_standard_f0" + nohud + ".png";
    			setScreenBackgroundForKey("custom_chart_mission", {
    				name: imagename,
    				height: 546
    			});
    			setScreenBackgroundForKey("short_range_chart_mission", {
    				name: imagename,
    				height: 546
    			});
    			setScreenBackgroundForKey("long_range_chart_mission", {
    				name: imagename,
    				height: 546
    			});
    
    			imagename = style + "_standard_f6" + ana + nohud + ".png";
    			setScreenBackgroundForKey("short_range_chart", {
    				name: imagename,
    				height: 546
    			});
    			imagename = style + "_standard_f6-2" + ana + nohud + ".png";
    			setScreenBackgroundForKey("long_range_chart", {
    				name: imagename,
    				height: 546
    			});
    
    			setScreenBackgroundForKey("keyboardsettings", {
    				name: style + "_standard_nomenu_nohud.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("load_save", {
    				name: style + "_standard_nomenu.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("mount_weapon", {
    				name: style + "_standard_f3-1.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("newgame", {
    				name: style + "_standard_nomenu_nohud.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("settings", {
    				name: style + "_inflight_f2.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("shiplibrary", {
    				name: style + "_standard_f0_nohud.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("paused_docked_overlay", {
    				name: "pause_overlay.png",
    				height: 546
    			});
    			setScreenBackgroundForKey("paused_overlay", {
    				name: "pause_overlay.png",
    				height: 546
    			});
    			imagename = "xenon_oxzmgr.png";
    			setScreenBackgroundForKey("oxz-manager", {
    				name: imagename,
    				height: 546
    			});
    		} else {
    			var keys = Object.keys(this._defaultBG);
    			for (var i = 0; i < keys.length; i++) {
    				var bg = getScreenBackgroundForKey(keys[i]);
    				// are xenon's backgrounds still set?
    				if (bg.hasOwnProperty("name") === true && (bg.name.indexOf(style + "_standard") >= 0 || bg.name.indexOf("pause_overlay") >= 0)) {
    					// ok, we can reset things now
    					setScreenBackgroundForKey(keys[i], this._defaultBG[keys[i]]);
    				}
    			}
    			this._defaultsOn = false;
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.$updateGuiColorSettings = function $updateGuiColorSettings() {
    		if (global.setGuiColorSettingForKey) {
    			setGuiColorSettingForKey("screen_divider_color", (this._amber === false ? "0 74 127 200" : "127 74 0 200"));
    			setGuiColorSettingForKey("screen_title_color", (this._amber === false ? "0 148 255 200" : "255 148 0 200"));
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	this.$setBGSDefaultBackgrounds = function $setBGSDefaultBackgrounds() {
    		// until BGS has something similar
    		if (worldScripts.Lib_GUI.$cur == "BGS" && global.setGuiColorSettingForKey) {
    			setGuiColorSettingForKey("screen_title_color", "0.9 0.9 0.8");
    			setGuiColorSettingForKey("screen_divider_color", "0.0 0.0 0.0 0.0");
    
    			setScreenBackgroundForKey("paused_docked_overlay", "bgs_ov_paused.png");
    			setScreenBackgroundForKey("paused_overlay", "bgs_ov_paused.png");
    			setScreenBackgroundForKey("intro", "bgs_intro.png");
    			setScreenBackgroundForKey("keyboardsettings", "bgs_fullscr.png");
    			setScreenBackgroundForKey("load_save", "bgs_options.png");
    			setScreenBackgroundForKey("newgame", "bgs_intro.png");
    			setScreenBackgroundForKey("oxz-manager", "bgs_fullscr.png");
    			setScreenBackgroundForKey("settings", "bgs_options.png");
    			setScreenBackgroundForKey("shiplibrary", "bgs_fullscr.png");
    			setScreenBackgroundForKey("long_range_chart_mission", "lib_black.png");
    			setScreenBackgroundForKey("short_range_chart_mission", "lib_black.png");
    		}
    	}
    
    	//-------------------------------------------------------------------------------------------------------------
    	// used to allow XenonUI and XenonReduxUI to co-exist
    	this.$xenonCrossConfig = function $xenonCrossConfig(screenID) {
    		this._addedID[screenID] = 2;
    	}
    	this.$passConfig = function $passConfig(screenID) {
    		if (this._xr) this._xr.$xenonCrossConfig(screenID);
    	}
    
    	
    }).call(this);
    Scripts/xenonui_compatibility.js
    "use strict";
    this.name = "XenonUI_Compatibility";
    this.author = "phkb";
    this.copyright = "2021 phkb";
    this.description = "OXP Compatibility function overrides";
    this.license = "CC BY-NC-SA 3.0";
    
    this.startUp = function () {
        // make sothis tc compatible
        if (worldScripts.sothis_tc && worldScripts.sothis_tc.version == "1.0.3") {
            var stc = worldScripts.sothis_tc;
            stc.missionScreenOpportunity = this._sothis_missionScreenOpportunity;
        }
        // make Iron Raven compatible
        if (worldScripts["IR-main-script.js"] && worldScripts["IR-main-script.js"].version == "1.4.2.1") {
            worldScripts["IR-main-script.js"].questionScreens = this.questionScreens;
            worldScripts["IR-main-script.js"].shipDockedWithStation = this._ir_shipDockedWithStation;
            worldScripts["IR-main-script.js"].missionScreens = this.missionScreens;
            worldScripts["IR-main-script.js"].choiceEvaluation = this.choiceEvaluation;
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    // to make Sothis TC compatible
    this._sothis_missionScreenOpportunity = function () {
        if (!this.$showWelcome) return;
        var messText = expandDescription("[STC_welcome]");
        if (this.$new_cargoes)
            messText = messText + expandDescription("[STC_new_cargoes]");
        var tcbgpic = "OOmap_G" + (galaxyNumber + 1) + ".png";
        mission.runScreen({
            title: "Sothis Trade Center",
            message: messText,
            overlay: tcbgpic
        });
        this.$showWelcome = false;
    }
    
    //-------------------------------------------------------------------------------------------------------------
    // to make Iron Raven compatible
    this.questionScreens = function () {
        if (system.ID == 23) // Maenes
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "QuiCo Pharmaceuticals",
                    overlay: "IR_quico_logo.png",
                    messageKey: "IR_MAENES_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_MAENES_QUESTIONS"
            }
        }
    
        if (system.ID == 171) // Yokohama
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "Yokohama Exports",
                    overlay: "IR_yk_logo.png",
                    messageKey: "IR_YOKOHAMA_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_YOKOHAMA_QUESTIONS"
            }
        }
    
        if (system.ID == 232) //Janes
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "Janes's Shipyard Intelligence",
                    overlay: "IR_janes_logo.png",
                    messageKey: "IR_JANES_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_JANES_QUESTIONS"
            }
        }
    
        if (system.ID == 240) // Pirate Cove
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                if (!missionVariables.IR_alsto) {
                    this._runScreen({
                        title: " ",
                        messageKey: "IR_PIRATE_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                    missionVariables.IR_alsto = "MET"
                } else {
                    this._runScreen({
                        title: " ",
                        messageKey: "IR_PIRATE_intro_alt",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                }
            }
        }
    
        if (system.ID == 119) // PleasureWorld
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "PleasureWorld",
                    overlay: "IR_pw_logo.png",
                    messageKey: "IR_PW_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_PW_QUESTIONS"
            }
        }
    
        if (system.ID == 180) // NWE
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "Naval Weapons Establishment",
                    overlay: "IR_NWE_logo.png",
                    messageKey: "IR_NWE_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_NWE_QUESTIONS"
            }
        }
    
        if (system.ID == 219) // GSE
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "Galactic Stock Exchange",
                    overlay: "IR_GSE_logo.png",
                    messageKey: "IR_GSE_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
            }
        }
    
        if (system.ID == 31) // KORSHKOV
        {
            if (missionVariables.IR_status == "IR_IBANEZ_4") {
                this._runScreen({
                    title: "OKB Korshkov",
                    overlay: "IR_korshlogo.png",
                    messageKey: "IR_KORSHKOV_intro",
                    choicesKey: "IR_questions"
                }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_KORSHKOV_QUESTIONS"
            }
        }
    }
    
    this._ir_shipDockedWithStation = function (station) {
        this.addIRinterface()
    
        if (missionVariables.IR_status == "IR_epilogue" && clock.days > missionVariables.IR_epilogue_deadline) {
            this._runScreen({
                messageKey: "IR_final",
                choicesKey: "IR_continue"
            }, function (choice) {
                if (choice == 1) {
                    this._runScreen({
                        overlay: "IR_title.png",
                        messageKey: "IR_theend"
                    });
                    missionVariables.IR_status = "IR_completed"
                    mission.setInstructionsKey(null)
                    missionVariables.IR_epilogue_deadline = null
                    missionVariables.IR_shipment_quest = null
                    missionVariables.IR_SDF_quest = null
                    missionVariables.IR_SDF_question_no = null
                    missionVariables.IR_SDF_question_key = null
                    missionVariables.IR_SDF_question_string = null
                    missionVariables.IR_defences_quest = null
                    missionVariables.IR_defences_question_no = null
                    missionVariables.IR_defences_question_key = null
                    missionVariables.IR_defences_question_string = null
                    missionVariables.IR_finance_quest = null
                    missionVariables.IR_finance_question_no = null
                    missionVariables.IR_finance_question_key = null
                    missionVariables.IR_finance_question_string = null
                    missionVariables.IR_shipment_quest_method = null
                    missionVariables.IR_shipment_question_no = null
                    missionVariables.IR_shipment_question_key = null
                    missionVariables.IR_shipment_question_string = null
                    missionVariables.IR_GSE_loan = null
                    missionVariables.IR_wife_status = null
                    missionVariables.IR_alsto = null
                    missionVariables.IR_count = null
                    missionVariables.IR_defences_kill_count = null
                    missionVariables.IR_SDF_quest_location = null
                    missionVariables.IR_SDF_quest_location_name = null
                    missionVariables.IR_KORSHKOV_deadline = null
                    missionVariables.IR_asked_question = null
                    missionVariables.IR_question_settings = null
                    missionVariables.IR_screen_log = null
                    missionVariables.IR_screen_location = null
                }
            });
        }
        if (player.ship.docked && galaxyNumber == 7) this.missionScreens();
    }
    
    this.missionScreens = function () {
        if (guiScreen == "GUI_SCREEN_MISSION" || !player.ship.docked)
            return;
    
        if (player.ship.dockedStation.hasRole("IR-luft-core")) {
            if (missionVariables.IR_SDF_quest == "JACOB" || missionVariables.IR_SDF_quest == "LUFTSLOTTE") {
                this._runScreen({
                    title: "Luftslotte 6",
                    messageKey: "IR_SDF_quest_4"
                })
                missionVariables.IR_SDF_quest = "KRAIT"
            }
        }
    
        if (player.ship.dockedStation.isMainStation && missionVariables.IR_offer == null) {
            if (missionVariables.IR_status == null) {
                this._runScreen({
                    overlay: "IR_title.png",
                    choicesKey: "IR_continue"
                }, function (choice) {
                    if (choice == 1) {
                        this._runScreen({
                            messageKey: "IR_IBANEZ_1"
                        });
                        mission.setInstructionsKey("IR_IBANEZ_INFO")
                        missionVariables.IR_status = "IR_IBANEZ_1"
                    }
                });
            }
    
            if (missionVariables.IR_finance_quest == "REPROCESSED" && clock.days >= missionVariables.IR_KORSHKOV_deadline) //this is 20 days
            {
                this._runScreen({
                    title: "Jane's Shipyard Intelligence",
                    messageKey: "IR_finance_quest_4"
                });
                missionVariables.IR_finance_quest = "JANES_NEWS"
                missionVariables.IR_KORSHKOV_deadline = null
                player.incrementFinanceStatus()
            }
    
            if (missionVariables.IR_SDF_quest == "ADDRESS" && clock.days >= missionVariables.IR_SDF_deadline) {
                this._runScreen({
                    messageKey: "IR_SDF_quest_2"
                });
                missionVariables.IR_SDF_quest = "JACOB"
                player.incrementSDFStatus()
            }
    
            if (missionVariables.IR_SDF_quest == "POD_SCOOPED") {
                this._runScreen({
                    messageKey: "IR_SDF_quest_5"
                });
                player.ship.useSpecialCargo("WARNING: Radiation detected in cargo hold")
                missionVariables.IR_SDF_quest = "KORSHKOV"
                player.incrementSDFStatus()
            }
    
            if (missionVariables.IR_SDF_quest == "PHOTO" && clock.days >= missionVariables.IR_SDF_deadline) {
                this._runScreen({
                    messageKey: "IR_SDF_quest_8a",
                    overlay: "IR_kinnaird.png",
                    choicesKey: "IR_continue"
                }, function (choice) {
                    if (choice == 1)
                        this._runScreen({
                            messageKey: "IR_SDF_quest_8b",
                            overlay: "IR_match.png",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this._runScreen({
                                    messageKey: "IR_SDF_quest_8c"
                                });
                                missionVariables.IR_SDF_quest = "COMPLETED"
                                player.clearSDFStatus()
                                missionVariables.IR_SDF_status_no = null
                                missionVariables.IR_SDF_deadline = null
                                    ++missionVariables.IR_quest_count
                            }
                        });
                });
            }
    
            if (missionVariables.IR_finance_quest == "WAIT3" && clock.days >= missionVariables.IR_KORSHKOV_deadline) {
                this._runScreen({
                    title: " ",
                    overlay: "IR_bloomberg.png",
                    messageKey: "IR_finance_quest_10"
                });
                missionVariables.IR_KORSHKOV_deadline = null
                player.clearFinanceStatus()
                missionVariables.IR_finance_status_no = null
                missionVariables.IR_finance_quest = "COMPLETED"
                    ++missionVariables.IR_quest_count
            }
    
            if (missionVariables.IR_shipment_quest == "SUCCESS") {
                this._runScreen({
                    messageKey: "IR_shipment_success"
                });
                player.clearShipmentStatus()
                missionVariables.IR_shipment_status_no = null
                missionVariables.IR_shipment_quest = "COMPLETED"
                missionVariables.IR_YOKOHAMA_deadline = null
                    ++missionVariables.IR_quest_count
                missionVariables.IR_tipoff_deadline = clock.days + 10
            }
    
            if (missionVariables.IR_shipment_quest == "DISPATCHED") {
                this._runScreen({
                    messageKey: "IR_shipment_failure"
                });
                player.clearShipmentStatus()
                missionVariables.IR_shipment_status_no = null
                missionVariables.IR_shipment_quest = "FAILED"
                    ++missionVariables.IR_quest_count
                missionVariables.IR_YOKOHAMA_deadline = null
            }
    
            if (missionVariables.IR_shipment_quest == "COMPLETED") {
                if (clock.days >= missionVariables.IR_tipoff_deadline) {
                    this._runScreen({
                        messageKey: "IR_tipoff"
                    });
                    missionVariables.IR_tipoff_deadline = null
                    missionVariables.IR_shipment_quest = "TIPPEDOFF"
                }
            }
    
            if (missionVariables.IR_loan_deadline) {
                if (clock.days >= missionVariables.IR_loan_deadline) {
                    this._runScreen({
                        title: "First Galactic Bank",
                        messageKey: "IR_GSE_loan_warning"
                    });
                    mission.setInstructionsKey(null)
                    missionVariables.IR_loan_deadline = null
                    missionVariables.IR_load_remaining = null
                    player.credits -= 550000
                    missionVariables.IR_GSE_loan = "DEFAULTED"
                }
            }
    
            if (missionVariables.IR_defences_quest == "DEMO_6" && clock.days > missionVariables.IR_defences_quest_deadline) {
                this._runScreen({
                    messageKey: "IR_defences_quest_6"
                });
                ++missionVariables.IR_quest_count
                missionVariables.IR_defences_quest = "COMPLETED"
                missionVariables.IR_defences_quest_deadline = null
                missionVariables.IR_defences_status_no = null
                player.clearDefencesStatus()
            }
    
            if (missionVariables.IR_status == "IR_KINNAIRD_2") {
                this._runScreen({
                    messageKey: "IR_kinnaird_3alt"
                });
            }
    
            if (missionVariables.IR_status == "IR_LEXICON_1" && clock.days > missionVariables.IR_LEXICON_deadline) {
                this._runScreen({
                    messageKey: "IR_LEXICON_2"
                });
                missionVariables.IR_status = "IR_LEXICON_2"
                mission.setInstructionsKey("IR_LEXICON_brief_2")
                missionVariables.IR_LEXICON_deadline = null
            }
    
            if (missionVariables.IR_status == "IR_CHERKASOVA_1") // briefing with Cherkasova
            {
                this._runScreen({
                    messageKey: "IR_CHERKASOVA_1a",
                    overlay: "IR_KSR_logo.png",
                    choicesKey: "IR_continue"
                }, function (choice) {
                    if (choice == 1)
                        this._runScreen({
                            messageKey: "IR_CHERKASOVA_1b",
                            overlay: "IR_KSR_logo.png",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1)
                                this._runScreen({
                                    messageKey: "IR_CHERKASOVA_1c",
                                    overlay: "IR_KSR_logo.png",
                                    choicesKey: "IR_continue"
                                }, function (choice) {
                                    if (choice == 1)
                                        this._runScreen({
                                            messageKey: "IR_CHERKASOVA_1d",
                                            overlay: "IR_KSR_logo.png",
                                            choicesKey: "IR_cherkasova_choices"
                                        }, function (choice) {
                                            if (choice == 1) {
                                                this._runScreen({
                                                    messageKey: "IR_LOA_1",
                                                    overlay: "IR_KSR_logo.png"
                                                })
                                                mission.setInstructionsKey("IR_LOA_brief_1")
                                                missionVariables.IR_status = "IR_LOA_1"
                                                mission.setInstructionsKey("IR_LOA_brief_1")
                                                missionVariables.IR_cherkasova_deadline = null
                                            }
                                            if (choice == 2) {
                                                this._runScreen({
                                                    messageKey: "IR_sources_1",
                                                    overlay: "IR_KSR_logo.png"
                                                }) //screen fails to run
                                                mission.setInstructionsKey("IR_LEXICON_brief_1")
                                                missionVariables.IR_status = "IR_sources_1"
                                                missionVariables.IR_cherkasova_deadline = null
                                                mission.setInstructionsKey("IR_LEXICON_brief_1")
                                                missionVariables.IR_sources_deadline = clock.days + 15
                                            }
                                        });
                                });
                        });
                });
            }
    
            if (missionVariables.IR_status == "IR_sources_1" && clock.days > missionVariables.IR_sources_deadline) {
                this._runScreen({
                    messageKey: "IR_sources_2"
                });
                missionVariables.IR_status = "IR_sources_2"
                mission.setInstructionsKey("IR_waitforinfo_brief")
                missionVariables.IR_sources_deadline = clock.days + 7
            }
    
            if (missionVariables.IR_status == "IR_sources_2" && clock.days > missionVariables.IR_sources_deadline) {
                this._runScreen({
                    messageKey: "IR_sources_3"
                });
                missionVariables.IR_status = "IR_sources_3"
                missionVariables.IR_sources_deadline = null
                mission.setInstructionsKey("IR_sources_brief_1")
            }
    
            if (missionVariables.IR_status == "IR_LOA_4" && clock.days > missionVariables.IR_attack_deadline) {
                this._runScreen({
                    messageKey: "IR_LOA_5"
                });
                missionVariables.IR_status = "IR_LOA_5"
                missionVariables.IR_attack_deadline = null
                mission.setInstructionsKey("IR_LOA_brief_4")
            }
    
            if (missionVariables.IR_status == "IR_LOA_7" && clock.days > missionVariables.IR_epilogue_deadline) {
                this._runScreen({
                    messageKey: "IR_LOA_7"
                });
                missionVariables.IR_status = "IR_LOA_8"
                missionVariables.IR_epilogue_deadline = clock.days + 10
            }
    
            if (missionVariables.IR_status == "IR_LOA_8" && clock.days > missionVariables.IR_epilogue_deadline) {
                this._runScreen({
                    messageKey: "IR_LOA_8"
                });
                missionVariables.IR_status = "IR_LOA_9"
                missionVariables.IR_epilogue_deadline = clock.days + 7
            }
    
            if (missionVariables.IR_status == "IR_LOA_9" && clock.days > missionVariables.IR_epilogue_deadline) {
                this._runScreen({
                    messageKey: "IR_invite"
                });
                missionVariables.IR_status = "IR_invite"
                mission.setInstructionsKey("IR_invite_brief")
                missionVariables.IR_epilogue_deadline = null
            }
    
            if (missionVariables.IR_status == "IR_sources_6" && clock.days > missionVariables.IR_epilogue_deadline) {
                this._runScreen({
                    messageKey: "IR_sources_6"
                });
                missionVariables.IR_status = "IR_sources_7"
                missionVariables.IR_epilogue_deadline = clock.days + 15
            }
    
            if (missionVariables.IR_status == "IR_sources_7" && clock.days > missionVariables.IR_epilogue_deadline) {
                this._runScreen({
                    messageKey: "IR_invite"
                });
                missionVariables.IR_status = "IR_invite"
                mission.setInstructionsKey("IR_invite_brief")
                missionVariables.IR_epilogue_deadline = null
            }
    
            //Location Specific
            if (system.ID == 7) //Vegedius
            {
                if (missionVariables.IR_status == "IR_IBANEZ_1") {
                    this._runScreen({
                        title: "GalCop High Command",
                        messageKey: "IR_IBANEZ_2a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                title: "GalCop High Command",
                                messageKey: "IR_IBANEZ_2b",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1) {
                                    this._runScreen({
                                        title: "GalCop High Command",
                                        messageKey: "IR_IBANEZ_2c"
                                    });
                                    missionVariables.IR_status = "IR_IBANEZ_2"
                                    mission.setInstructionsKey("IR_RAAED_INFO")
                                }
                            });
                    });
                }
    
                if (missionVariables.IR_status == "IR_RAAED_1") //return to Ibanez
                {
                    this._runScreen({
                        title: "Galcop High Command",
                        messageKey: "IR_IBANEZ_3"
                    })
                    missionVariables.IR_status = "IR_IBANEZ_3"
                    mission.setInstructionsKey("IR_JANES_INFO")
                }
    
    
                if (missionVariables.IR_status == "IR_JANES_1") // return to Ibanez for big briefing
                {
                    this._runScreen({
                        title: "GalCop High Command",
                        messageKey: "IR_IBANEZ_4a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                title: "GalCop High Command",
                                messageKey: "IR_IBANEZ_4b",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1)
                                    this._runScreen({
                                        title: "GalCop High Command",
                                        messageKey: "IR_IBANEZ_4c",
                                        choicesKey: "IR_continue"
                                    }, function (choice) {
                                        if (choice == 1) {
                                            this._runScreen({
                                                title: "GalCop High Command",
                                                messageKey: "IR_IBANEZ_4d"
                                            });
                                            missionVariables.IR_status = "IR_IBANEZ_4"
                                            mission.setInstructionsKey(null)
                                            this.setupQuestions()
                                            this.setupStatus()
                                            missionVariables.IR_quest_count = 0
                                            this.addIRinterface();
                                        }
                                    });
                            });
                    });
                }
    
                if (missionVariables.IR_status == "IR_IBANEZ_4" && missionVariables.IR_quest_count == 4) {
                    missionVariables.IR_quest_count = null
    
                    if (missionVariables.IR_shipment_quest_method == "YOKOHAMA_AMBUSH") {
                        this._runScreen({
                            messageKey: "IR_IBANEZ_5a",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this._runScreen({
                                    overlay: "IR_title.png",
                                    messageKey: "IR_theend"
                                });
                                missionVariables.IR_status = "IR_completed"
                                mission.setInstructionsKey(null)
                                missionVariables.IR_epilogue_deadline = null
                                missionVariables.IR_shipment_quest = null
                                missionVariables.IR_SDF_quest = null
                                missionVariables.IR_defences_quest = null
                                missionVariables.IR_finance_quest = null
                                missionVariables.IR_shipment_quest_method = null
                            }
                        });
                    }
    
                    if (missionVariables.IR_shipment_quest == "FAILED") {
                        this._runScreen({
                            messageKey: "IR_IBANEZ_5b",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this._runScreen({
                                    overlay: "IR_title.png",
                                    messageKey: "IR_theend"
                                });
                                missionVariables.IR_status = "IR_completed"
                                mission.setInstructionsKey(null)
                                missionVariables.IR_epilogue_deadline = null
                                missionVariables.IR_shipment_quest = null
                                missionVariables.IR_SDF_quest = null
                                missionVariables.IR_defences_quest = null
                                missionVariables.IR_finance_quest = null
                                missionVariables.IR_shipment_quest_method = null
                            }
                        });
                    } else
                        this._runScreen({
                            title: "GalCop High Command",
                            messageKey: "IR_IBANEZ_5",
                            choicesKey: "IR_IBANEZ_choices"
                        }, function (choice) {
                            if (choice == "IR_IBANEZ_A_weiss") {
                                this._runScreen({
                                    title: "GalCop High Command",
                                    messageKey: "IR_weiss_1"
                                });
                                missionVariables.IR_status = "IR_WEISS_1"
                                mission.setInstructionsKey("IR_weiss_brief_1")
                            }
                            if (choice == "IR_IBANEZ_B_kinnaird") {
                                this._runScreen({
                                    title: "GalCop High Command",
                                    messageKey: "IR_kinnaird_1"
                                });
                                missionVariables.IR_status = "IR_KINNAIRD_1"
                                mission.setInstructionsKey("IR_kinnaird_brief_1")
                            }
                            if (choice == "IR_IBANEZ_C_moreinfo") {
                                this._runScreen({
                                    title: "GalCop High Command",
                                    messageKey: "IR_LEXICON_1"
                                });
                                missionVariables.IR_status = "IR_LEXICON_1"
                                mission.setInstructionsKey("IR_LEXICON_1")
                                missionVariables.IR_LEXICON_deadline = clock.days + 15
                            }
                        });
                }
    
                if (missionVariables.IR_status == "IR_WEISS_4" || missionVariables.IR_status == "IR_KINNAIRD_4") {
                    this._runScreen({
                        title: "Galcop High Command",
                        messageKey: "IR_IBANEZ_5_debrief"
                    })
                    missionVariables.IR_status = "IR_IBANEZ_5"
                    mission.setInstructionsKey("IR_waitforinfo_brief")
                    missionVariables.IR_cherkasova_deadline = clock.days + 20
                }
    
                if (missionVariables.IR_status == "IR_invite" && clock.days > missionVariables.IR_epilogue_deadline) {
                    this._runScreen({
                        messageKey: "IR_reward_a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_reward_b",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1)
                                    this._runScreen({
                                        messageKey: "IR_reward_c",
                                        choicesKey: "IR_continue",
                                        overlay: "IR_maenesmedal.png"
                                    }, function (choice) {
                                        if (choice == 1)
                                            this._runScreen({
                                                messageKey: "IR_reward_d",
                                                choicesKey: "IR_continue"
                                            }, function (choice) {
                                                if (choice == 1) {
                                                    this._runScreen({
                                                        messageKey: "IR_reward_e"
                                                    });
                                                    missionVariables.IR_status = "IR_epilogue"
                                                    missionVariables.IR_epilogue_deadline = clock.days + 5
                                                    player.credits += 50000
                                                    mission.setInstructionsKey(null)
                                                }
                                            });
                                    });
                            });
                    });
                }
            }
    
            if (system.ID == 230) // RAAED
            {
                if (missionVariables.IR_status == "IR_IBANEZ_2") {
                    this._runScreen({
                        messageKey: "IR_RAAED_1a",
                        overlay: "IR_forest.png",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                overlay: "IR_invoice.png",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1)
                                    this._runScreen({
                                        messageKey: "IR_RAAED_1c",
                                        overlay: "IR_forest.png",
                                        choicesKey: "IR_continue"
                                    }, function (choice) {
                                        if (choice == 1)
                                            this._runScreen({
                                                messageKey: "IR_RAAED_1d",
                                                choicesKey: "IR_continue",
                                                overlay: "IR_forest.png"
                                            }, function (choice) {
                                                if (choice == 1) {
                                                    this._runScreen({
                                                        messageKey: "IR_RAAED_1e",
                                                        overlay: "IR_forest.png"
                                                    });
                                                    missionVariables.IR_status = "IR_RAAED_1"
                                                    mission.setInstructionsKey("IR_IBANEZ_INFO")
                                                }
                                            });
                                    });
                            });
                    });
                }
            }
    
            if (system.ID == 232) // Janes
            {
                if (missionVariables.IR_status == "IR_IBANEZ_3") // quick visit to Janes
                {
                    this._runScreen({
                        messageKey: "IR_JANES_1a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_JANES_1b",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1) {
                                    this._runScreen({
                                        messageKey: "IR_JANES_1c"
                                    });
                                    missionVariables.IR_status = "IR_JANES_1"
                                    mission.setInstructionsKey("IR_IBANEZ_INFO")
                                }
                            });
                    });
                }
    
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "Janes's Shipyard Intelligence",
                        overlay: "IR_janes_logo.png",
                        messageKey: "IR_JANES_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_JANES_QUESTIONS"
                }
            }
    
            if (system.ID == 171) // Yokohama
            {
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "Yokohama Exports",
                        overlay: "IR_yk_logo.png",
                        messageKey: "IR_YOKOHAMA_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_YOKOHAMA_QUESTIONS"
                }
            }
    
            if (missionVariables.IR_convoy_exited == "TRUE" && missionVariables.IR_alsto == "HELP_ACCEPTED") {
                this._runScreen({
                    messageKey: "IR_shipment_contact_report"
                });
                player.incrementShipmentStatus()
                missionVariables.IR_alsto = "INFORMED"
                missionVariables.IR_convoy_exited = null
            }
    
            if (system.ID == 240) // Pirate Cove
            {
                if (missionVariables.IR_status == "IR_IBANEZ_4")
    
                {
                    if (!missionVariables.IR_alsto) {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_intro",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                        missionVariables.IR_alsto = "MET"
                    } else {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_intro_alt",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                    }
                }
    
                if (missionVariables.IR_status == "IR_LOA_1") {
                    if (missionVariables.IR_alsto)
                        missionVariables.IR_LOA_text = "known"
                    if (missionVariables.IR_alsto == "INFORMED")
                        missionVariables.IR_LOA_text = "helped"
                    if (!missionVariables.IR_alsto)
                        missionVariables.IR_LOA_text = "unknown"
    
                    this._runScreen({
                        messageKey: "IR_LOA_" + [missionVariables.IR_LOA_text] + "_2a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_LOA_" + [missionVariables.IR_LOA_text] + "_2b",
                                choicesKey: "IR_continue"
                            }, function (choice) {
                                if (choice == 1)
                                    this._runScreen({
                                        messageKey: "IR_LOA_2c",
                                        choicesKey: "IR_continue"
                                    }, function (choice) {
                                        if (choice == 1) {
                                            this._runScreen({
                                                messageKey: "IR_LOA_2d"
                                            })
                                            missionVariables.IR_status = "IR_LOA_2"
                                            mission.setInstructionsKey("IR_LOA_brief_2")
                                            missionVariables.IR_alsto = null
                                            missionVariables.IR_LOA_text = null
                                        }
                                    });
                            });
                    });
                }
            }
    
            if (system.ID == 119) // PleasureWorld
            {
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "PleasureWorld",
                        overlay: "IR_pw_logo.png",
                        messageKey: "IR_PW_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_PW_QUESTIONS"
                }
    
                if (missionVariables.IR_status == "IR_WEISS_3") {
                    this._runScreen({
                        title: "PleasureWord",
                        overlay: "IR_pw_logo.png",
                        messageKey: "IR_weiss_3a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                overlay: "IR_pw_logo.png",
                                messageKey: "IR_weiss_3b"
                            })
                        missionVariables.IR_status = "IR_WEISS_4"
                        mission.setInstructionsKey("IR_weiss_brief_3")
                    });
                }
    
                if (missionVariables.IR_status == "IR_KINNAIRD_3") {
                    this._runScreen({
                        title: "PleasureWord",
                        overlay: "IR_pw_logo.png",
                        messageKey: "IR_kinnaird_4a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_kinnaird_4b"
                            })
                        missionVariables.IR_status = "IR_KINNAIRD_4"
                        mission.setInstructionsKey("IR_kinnaird_brief_4")
                    });
                }
    
                if (missionVariables.IR_status == "IR_LEXICON_2") {
                    this._runScreen({
                        messageKey: "IR_LEXICON_3a",
                        overlay: "IR_nightclub.png",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_LEXICON_3b",
                                overlay: "IR_nightclub.png",
                                choicesKey: "IR_launch_choice"
                            }, function (choice) {
                                if (choice == 1) {
                                    missionVariables.IR_status = "IR_LEXICON_4"
                                    player.ship.launch()
                                }
                            });
                    });
                }
    
                if (missionVariables.IR_status == "IR_weiss_scooped") {
                    this._runScreen({
                        messageKey: "IR_LEXICON_4a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1)
                            this._runScreen({
                                messageKey: "IR_LEXICON_4b"
                            })
                        missionVariables.IR_status = "IR_IBANEZ_5"
                        mission.setInstructionsKey("IR_waitforinfo_brief")
                        missionVariables.IR_cherkasova_deadline = clock.days + 20
                    });
                }
            }
    
            if (system.ID == 180) // NWE
            {
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "Naval Weapons Establishment",
                        overlay: "IR_NWE_logo.png",
                        messageKey: "IR_NWE_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_NWE_QUESTIONS"
                }
    
                if (missionVariables.IR_defences_quest == "DEMO_2") {
                    this._runScreen({
                        title: "Naval Weapons Establishment",
                        overlay: "IR_NWE_logo.png",
                        messageKey: "IR_defences_quest_2a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                title: "Naval Weapons Establishment",
                                overlay: "IR_NWE_logo.png",
                                messageKey: "IR_defences_quest_2b"
                            });
                            missionVariables.IR_defences_quest_deadline = clock.days + 7
                            missionVariables.IR_defences_quest = "DEMO_3"
                            player.incrementDefencesStatus()
                        }
                    });
                }
    
                if (missionVariables.IR_defences_quest == "DEMO_3" && clock.days > missionVariables.IR_defences_quest_deadline) {
                    this._runScreen({
                        title: "Naval Weapons Establishment",
                        overlay: "IR_NWE_logo.png",
                        messageKey: "IR_defences_quest_3"
                    });
                    missionVariables.IR_defences_quest_deadline = null
                    missionVariables.IR_defences_quest = "DEMO_4"
                    player.incrementDefencesStatus()
                }
            }
    
            if (system.ID == 82) // Inorle
            {
                if (missionVariables.IR_SDF_quest == "JACOB") {
                    this._runScreen({
                        messageKey: "IR_SDF_quest_3"
                    })
                    missionVariables.IR_SDF_quest = "LUFTSLOTTE"
                }
            }
    
            if (system.ID == 219) // GSE
            {
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "Galactic Stock Exchange",
                        overlay: "IR_GSE_logo.png",
                        messageKey: "IR_GSE_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                }
    
    
                if (missionVariables.IR_finance_quest == "JANES_NEWS") {
                    this._runScreen({
                        title: "Galactic Stock Exchange",
                        overlay: "IR_GSE_logo.png",
                        messageKey: "IR_finance_quest_6a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                title: "Galactic Stock Exchange",
                                overlay: "IR_GSE_logo.png",
                                messageKey: "IR_finance_quest_6b"
                            });
                            player.incrementFinanceStatus()
                            missionVariables.IR_offer = null
                            missionVariables.IR_finance_quest = "WIFE"
                        }
                    });
                }
    
                if (missionVariables.IR_finance_quest == "WIFE_MET") {
                    this._runScreen({
                        title: "Galactic Stock Exchange",
                        overlay: "IR_GSE_logo.png",
                        messageKey: "IR_finance_quest_8",
                        choicesKey: "IR_wife_choices"
                    }, function (choice) {
                        if (choice == "IR_wife_yes") {
                            this._runScreen({
                                title: "Galactic Stock Exchange",
                                overlay: "IR_GSE_logo.png",
                                messageKey: "IR_finance_quest_9_confirm"
                            });
                            missionVariables.IR_wife_status = "AFFAIR_CONFIRMED"
                        }
    
                        if (choice == "IR_wife_no") {
                            this._runScreen({
                                title: "Galactic Stock Exchange",
                                overlay: "IR_GSE_logo.png",
                                messageKey: "IR_finance_quest_9_deny"
                            });
                            missionVariables.IR_wife_status = "AFFAIR_DENIED"
                        }
    
                        player.incrementFinanceStatus()
                        missionVariables.IR_finance_quest = "WAIT3"
                        missionVariables.IR_KORSHKOV_deadline = clock.days + 10
                        missionVariables.IR_offer = null
                    });
                }
            }
    
            if (system.ID == 31) // KORSHKOV
            {
                if (missionVariables.IR_finance_quest == "WAIT" && clock.days >= missionVariables.IR_KORSHKOV_deadline) {
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_finance_quest_1"
                    });
                    player.incrementFinanceStatus()
                    missionVariables.IR_finance_quest = "COLLECTION"
                    missionVariables.IR_KORSHKOV_deadline = null
                    return;
                }
    
                if (missionVariables.IR_finance_quest == "COLLECTION") {
                    this.checkManifest()
    
                    if (missionVariables.IR_manifestOK == "TRUE") {
                        this._runScreen({
                            title: "OKB Korshkov",
                            overlay: "IR_korshlogo.png",
                            messageKey: "IR_finance_quest_2"
                        });
                        player.incrementFinanceStatus()
                        missionVariables.IR_KORSHKOV_deadline = clock.days + 10
                        missionVariables.IR_finance_quest = "WAIT2"
                        player.ship.manifest.radioactives -= 10
                        player.ship.manifest.alloys = -5
                        player.ship.manifest.minerals -= 2
                        player.ship.manifest.alienItems -= 2
                        player.ship.manifest.platinum -= 1
                        missionVariables.IR_manifestOK = null
                        return;
                    }
    
                    if (missionVariables.IR_manifestOK != "TRUE")
                        this._runScreen({
                            title: "OKB Korshkov",
                            overlay: "IR_korshlogo.png",
                            messageKey: "IR_finance_quest_3alt"
                        });
                    else return;
                }
    
                if (missionVariables.IR_finance_quest == "WAIT2" && clock.days >= missionVariables.IR_KORSHKOV_deadline) {
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_finance_quest_3"
                    });
                    player.incrementFinanceStatus()
                    missionVariables.IR_KORSHKOV_deadline = null
                    missionVariables.IR_finance_quest = "IRRADIATE"
                    return;
                }
    
                if (missionVariables.IR_SDF_quest == "KORSHKOV") {
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_SDF_quest_6"
                    });
                    player.incrementSDFStatus()
                    missionVariables.IR_SDF_deadline = clock.days + 10
                    missionVariables.IR_SDF_quest = "ANALYSIS"
                    player.ship.removeAllCargo()
                    missionVariables.IR_cargoCount = null
                    return;
                }
    
                if (missionVariables.IR_SDF_quest == "ANALYSIS" && clock.days >= missionVariables.IR_SDF_deadline)
    
                {
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_SDF_quest_7a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                messageKey: "IR_SDF_quest_7b"
                            });
                            missionVariables.IR_SDF_quest = "DATA"
                            player.incrementSDFStatus()
                            this.incrementSDFQuestion()
                            missionVariables.IR_SDF_location = null
                            missionVariables.IR_SDF_location_name = null
                        }
                    });
                    return;
                }
    
                if (missionVariables.IR_status == "IR_IBANEZ_4") {
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_KORSHKOV_intro",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    missionVariables.IR_offer = "IR_KORSHKOV_QUESTIONS"
                    return;
                }
            }
    
            if (system.ID == 142) // Tibiri bar
            {
                if (missionVariables.IR_finance_quest == "WIFE_DOCKED") {
                    this._runScreen({
                        messageKey: "IR_finance_quest_7a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                messageKey: "IR_finance_quest_7b"
                            });
                            player.incrementFinanceStatus()
                            player.credits += 1000
                            missionVariables.IR_offer = null
                            missionVariables.IR_finance_quest = "WIFE_MET"
                        }
                    });
                }
                if (missionVariables.IR_finance_quest == "WIFE" || missionVariables.IR_finance_quest == "WIFE_IDENTIFIED")
                    this._runScreen({
                        messageKey: "IR_finance_quest_7alt"
                    });
            }
    
            if (system.ID == 23) // Maenes
            {
                if (missionVariables.IR_defences_question_no == 3 && !missionVariables.IR_defences_quest) {
                    if (!missionVariables.IR_Maenes_visit) {
                        this._runScreen({
                            title: "QuiCo Pharmaceuticals",
                            overlay: "IR_quico_logo.png",
                            messageKey: "IR_defences_quest_1_alt"
                        });
                        missionVariables.IR_defences_quest = "DEMO_1"
                    }
                    if (missionVariables.IR_Maenes_visit == "TRUE") {
                        this._runScreen({
                            title: "QuiCo Pharmaceuticals",
                            overlay: "IR_quico_logo.png",
                            messageKey: "IR_defences_quest_1"
                        });
                        missionVariables.IR_defences_quest = "DEMO_1"
                        missionVariables.IR_Maenes_visit = null
                    }
    
                }
                if (missionVariables.IR_defences_quest == "DEMO_4") {
                    this._runScreen({
                        title: "QuiCo Pharmaceuticals",
                        overlay: "IR_quico_logo.png",
                        messageKey: "IR_defences_quest_4"
                    });
                    missionVariables.IR_defences_quest = "DEMO_5"
                }
    
                if (missionVariables.IR_defences_quest == "SABOTAGED") {
                    this._runScreen({
                        title: "QuiCo Pharmaceuticals",
                        overlay: "IR_quico_logo.png",
                        messageKey: "IR_defences_quest_5a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                messageKey: "IR_defences_quest_5b"
                            });
                            player.incrementDefencesStatus()
                            missionVariables.IR_defences_quest = "DEMO_6"
                            missionVariables.IR_defences_quest_deadline = clock.days + 15
                        }
                    });
                }
    
                if (missionVariables.IR_status == "IR_sources_5") {
                    this._runScreen({
                        title: "QuiCo Pharmaceuticals",
                        overlay: "IR_quico_logo.png",
                        messageKey: "IR_sources_5a",
                        choicesKey: "IR_continue"
                    }, function (choice) {
                        if (choice == 1) {
                            this._runScreen({
                                messageKey: "IR_sources_5b"
                            });
                            mission.setInstructionsKey("IR_waitforinfo_brief")
                            missionVariables.IR_status = "IR_sources_6"
                            missionVariables.IR_epilogue_deadline = clock.days + 10
                        }
                    });
                }
    
                if (missionVariables.IR_status == "IR_LOA_6") {
                    this._runScreen({
                        title: "QuiCo Pharmaceuticals",
                        overlay: "IR_quico_logo.png",
                        messageKey: "IR_LOA_6"
                    });
                    mission.setInstructionsKey("IR_waitforinfo_brief")
                    missionVariables.IR_status = "IR_LOA_7"
                    missionVariables.IR_epilogue_deadline = clock.days + 10
                }
            }
    
            if (system.ID == 35 && missionVariables.IR_status == "IR_KINNAIRD_1") //Atanon
            {
                this._runScreen({
                    messageKey: "IR_kinnaird_2"
                });
                missionVariables.IR_status = "IR_KINNAIRD_2"
            }
    
            if (system.ID == 41 && missionVariables.IR_status == "IR_KINNAIRD_2") //Orlaroor
            {
                this._runScreen({
                    messageKey: "IR_kinnaird_3"
                });
                missionVariables.IR_status = "IR_KINNAIRD_3"
                mission.setInstructionsKey("IR_kinnaird_brief_3")
            }
    
            if (system.ID == 149 && missionVariables.IR_status == "IR_LOA_3") //Arenxeon
            {
                this._runScreen({
                    messageKey: "IR_LOA_4a",
                    choicesKey: "IR_continue"
                }, function (choice) {
                    if (choice == 1) {
                        this._runScreen({
                            messageKey: "IR_LOA_4b"
                        });
                        missionVariables.IR_status = "IR_LOA_4"
                        missionVariables.IR_attack_deadline = clock.days + 10
                        mission.setInstructionsKey("IR_waitforinfo_brief")
                    }
                });
            }
    
            if (system.ID == 63 && missionVariables.IR_status == "IR_sources_3") //Edsoan
            {
                this._runScreen({
                    messageKey: "IR_sources_4a",
                    choicesKey: "IR_continue"
                }, function (choice) {
                    if (choice == 1) {
                        this._runScreen({
                            messageKey: "IR_sources_4b"
                        });
                        missionVariables.IR_status = "IR_sources_4"
                        mission.setInstructionsKey("IR_sources_brief_2")
                    }
                });
            }
            //keep brackets	
        }
    }
    
    this.choiceEvaluation = function (choice) {
        switch (missionVariables.IR_offer) {
            case "IR_GSE_QUESTIONS": {
                if (choice == "IR_B_finance_question_key") {
                    if (missionVariables.IR_finance_question_no == 1) {
                        this._runScreen({
                            title: "Galactic Stock Exchange",
                            overlay: "IR_GSE_logo.png",
                            messageKey: "IR_GSE_finance_answer_1a",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this.incrementFinanceQuestion()
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_finance_answer_1b",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_finance_question_no > 1) {
                        missionVariables.IR_asked_question = missionVariables.IR_finance_question_string
                        this._runScreen({
                            title: "Galactic Stock Exchange",
                            overlay: "IR_GSE_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
                if (choice == "IR_A_shipment_question_key") {
                    if (missionVariables.IR_shipment_question_no == 2 && !missionVariables.IR_GSE_loan) {
                        this._runScreen({
                            title: "Galactic Stock Exchange",
                            overlay: "IR_GSE_logo.png",
                            messageKey: "IR_GSE_loan_offer",
                            choicesKey: "IR_loan_choices"
                        }, function (choice) {
                            if (choice == "IR_loan_yes") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_agreed"
                                });
                                missionVariables.IR_GSE_loan = "ACCEPTED"
                                player.credits += 500000
                                missionVariables.IR_loan_deadline = clock.days + 60
                                missionVariables.IR_loan_remaining = missionVariables.IR_loan_deadline - clock.days
                                mission.setInstructionsKey("IR_loan_amount")
                                missionVariables.IR_offer = null
                            }
                            if (choice == "IR_loan_no") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_rejected",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = null
                                missionVariables.IR_GSE_loan = "REJECTED"
                            }
                            if (choice == "IR_loan_defer") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_deferred",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                                missionVariables.IR_GSE_loan = "DEFERRED"
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_GSE_loan == "DEFERRED") {
                        this._runScreen({
                            title: "Galactic Stock Exchange",
                            overlay: "IR_GSE_logo.png",
                            messageKey: "IR_GSE_loan_repeat_offer",
                            choicesKey: "IR_loan_choices"
                        }, function (choice) {
                            if (choice == "IR_loan_yes") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_agreed"
                                });
                                missionVariables.IR_GSE_loan = "ACCEPTED"
                                player.credits += 500000
                                missionVariables.IR_loan_deadline = clock.days + 60
                                missionVariables.IR_loan_remaining = missionVariables.IR_loan_deadline - clock.days
                                mission.setInstructionsKey("IR_loan_amount")
                                missionVariables.IR_offer = null
                            }
                            if (choice == "IR_loan_no") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_rejected",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                                missionVariables.IR_GSE_loan = "REJECTED"
                            }
                            if (choice == "IR_loan_defer") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_loan_deferred",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                                missionVariables.IR_GSE_loan = "DEFERRED"
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_GSE_loan == "ACCEPTED") {
                        this._runScreen({
                            title: "Galactic Stock Exchange",
                            overlay: "IR_GSE_logo.png",
                            messageKey: "IR_GSE_loan_demand",
                            choicesKey: "IR_pay_choices"
                        }, function (choice) {
                            if (choice == "IR_pay_yes") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_pay_accepted",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_GSE_loan = "PAID"
                                player.credits -= 550000
                                missionVariables.IR_loan_deadline = null
                                missionVariables.IR_loan_remaining = null
                                mission.setInstructionsKey(null)
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                            }
                            if (choice == "IR_pay_no") {
                                this._runScreen({
                                    title: "Galactic Stock Exchange",
                                    overlay: "IR_GSE_logo.png",
                                    messageKey: "IR_GSE_pay_deferred",
                                    choicesKey: "IR_questions"
                                }, this.choiceEvaluation);
                                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                            }
                        });
                        break;
                    }
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: "Galactic Stock Exchange",
                        overlay: "IR_GSE_logo.png",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_GSE_QUESTIONS"
                break;
            }
    
            case "IR_KORSHKOV_QUESTIONS": {
                if (choice == "IR_B_finance_question_key") {
                    if (missionVariables.IR_finance_question_no == 2) {
                        this._runScreen({
                            title: "OKB Korshkov",
                            overlay: "IR_korshlogo.png",
                            messageKey: "IR_KORSHKOV_finance_answer_1a",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this.incrementFinanceQuestion()
                                this._runScreen({
                                    title: "OKB Korshkov",
                                    overlay: "IR_korshlogo.png",
                                    messageKey: "IR_KORSHKOV_finance_answer_1b"
                                });
                                missionVariables.IR_offer = "IR_KORSHKOV_QUESTIONS"
                                missionVariables.IR_KORSHKOV_deadline = clock.days + 5
                                player.incrementFinanceStatus()
                                missionVariables.IR_offer = null
                                missionVariables.IR_finance_quest = "WAIT"
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_finance_question_no > 2) {
                        missionVariables.IR_asked_question = missionVariables.IR_finance_question_string
                        this._runScreen({
                            title: "OKB Korshkov",
                            overlay: "IR_korshlogo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
    
                if (choice == "IR_E_exit_question_key") {
                    return;
                } else
                    this._runScreen({
                        title: "OKB Korshkov",
                        overlay: "IR_korshlogo.png",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_KORSHKOV_QUESTIONS"
                break;
            }
    
            case "IR_JANES_QUESTIONS": {
                if (choice == "IR_A_shipment_question_key") {
                    this._runScreen({
                        title: "Jane's Shipyard Intelligence",
                        overlay: "IR_janes_logo.png",
                        messageKey: "IR_no_more_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    break;
                }
    
                if (choice == "IR_C_SDF_question_key") {
                    if (missionVariables.IR_SDF_question_no == 1) {
                        this.incrementSDFQuestion()
                        this._runScreen({
                            title: "Jane's Shipyard Intelligence",
                            overlay: "IR_janes_logo.png",
                            messageKey: "IR_JANES_SDF_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
    
                    if (missionVariables.IR_SDF_question_no > 1) {
                        this._runScreen({
                            title: "Jane's Shipyard Intelligence",
                            overlay: "IR_janes_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
                if (choice == "IR_D_defences_question_key") {
                    this._runScreen({
                        title: "Jane's Shipyard Intelligence",
                        overlay: "IR_janes_logo.png",
                        messageKey: "IR_JANES_defences_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                    break;
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: "Jane's Shipyard Intelligence",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_JANES_QUESTIONS"
                break;
            }
    
            case "IR_PIRATE_QUESTIONS": {
                if (choice == "IR_A_shipment_question_key") {
                    if (missionVariables.IR_shipment_question_no == 2 && missionVariables.IR_shipment_quest == "SET") {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_shipment_answer",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1)
                                this._runScreen({
                                    title: " ",
                                    messageKey: "IR_PIRATE_shipment_offer",
                                    choicesKey: "IR_pirate_choices"
                                }, function (choice) {
                                    if (choice == "IR_pirate_yes") {
                                        this._runScreen({
                                            title: " ",
                                            messageKey: "IR_PIRATE_shipment_accepted"
                                        });
                                        missionVariables.IR_alsto = "HELP_ACCEPTED"
                                        player.credits -= 250000
                                        player.incrementShipmentStatus()
                                        missionVariables.IR_offer = null
                                    }
                                    if (choice == "IR_pirate_no") {
                                        this._runScreen({
                                            title: " ",
                                            messageKey: "IR_PIRATE_shipment_declined"
                                        });
                                        missionVariables.IR_offer = null
                                        missionVariables.IR_alsto = "HELP_DECLINED"
                                    }
                                });
                        });
                        break;
                    }
    
                    if (missionVariables.IR_shipment_question_no == 1) {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_negative_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                        break;
                    }
    
                    if (missionVariables.IR_shipment_question_no == 2 && missionVariables.IR_alsto == "HELP_ACCEPTED")
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_shipment_confirm_help"
                        });
    
    
                    if (missionVariables.IR_shipment_question_no == 2 && missionVariables.IR_alsto == "HELP_DECLINED") {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_shipment_deferred_help",
                            choicesKey: "IR_pirate_choices"
                        }, function (choice) {
                            if (choice == "IR_pirate_yes") {
                                this._runScreen({
                                    title: " ",
                                    messageKey: "IR_PIRATE_shipment_accepted"
                                });
                                missionVariables.IR_alsto = "HELP_ACCEPTED"
                                player.credits -= 250000
                                player.incrementShipmentStatus()
                                missionVariables.IR_offer = null
                            }
                            if (choice == "IR_pirate_no") {
                                this._runScreen({
                                    title: " ",
                                    messageKey: "IR_PIRATE_shipment_declined"
                                });
                                missionVariables.IR_offer = null
                                missionVariables.IR_alsto = "HELP_DECLINED"
                            }
    
                        });
    
                        if (missionVariables.IR_shipment_question_no == 2 && missionVariables.IR_shipment_quest != "SET") {
                            missionVariables.IR_asked_question = missionVariables.IR_shipment_question_string
                            this._runScreen({
                                title: " ",
                                messageKey: "IR_no_more_answer",
                                choicesKey: "IR_questions"
                            }, this.choiceEvaluation);
                            break;
                        }
                    }
                }
    
                if (choice == "IR_C_SDF_question_key") {
                    if (missionVariables.IR_SDF_question_no < 2)
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_SDF_answer_1",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
    
                    if (missionVariables.IR_SDF_question_no == 2)
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_PIRATE_SDF_answer_2",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
    
                    if (missionVariables.IR_SDF_question_no > 2) {
                        this._runScreen({
                            title: " ",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                    }
                    break;
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: " ",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_PIRATE_QUESTIONS"
                break;
            }
    
            case "IR_YOKOHAMA_QUESTIONS": {
                if (choice == "IR_A_shipment_question_key") {
                    if (missionVariables.IR_shipment_question_no == 1) {
                        this.incrementShipmentQuestion()
                        this._runScreen({
                            title: "Yokohama Exports",
                            overlay: "IR_yk_logo.png",
                            messageKey: "IR_YOKOHAMA_shipment_answer_1"
                        });
                        missionVariables.IR_YOKOHAMA_deadline = clock.days + 30
                        missionVariables.IR_shipment_quest = "SET"
                        missionVariables.IR_offer = null
                        player.incrementShipmentStatus()
                        break;
                    }
    
                    if (missionVariables.IR_shipment_question_no == 2 && clock.days < missionVariables.IR_YOKOHAMA_deadline) {
                        this._runScreen({
                            title: "Yokohama Exports",
                            overlay: "IR_yk_logo.png",
                            messageKey: "IR_YOKOHAMA_shipment_answer_2",
                            choicesKey: "IR_YOKOHAMA_choices"
                        }, function (choice) {
                            if (choice == "IR_YOKOHAMA_yes") {
                                if (player.credits >= 1000000) {
                                    this._runScreen({
                                        title: "Yokohama Exports",
                                        overlay: "IR_yk_logo.png",
                                        messageKey: "IR_YOKOHAMA_shipment_agreed"
                                    });
                                    missionVariables.IR_shipment_quest = "SUCCESS"
                                    missionVariables.IR_shipment_quest_method = "PURCHASED"
                                    missionVariables.IR_YOKOHAMA_deadline = null
                                        ++missionVariables.IR_quest_count
                                    this.incrementShipmentQuestion()
                                    player.clearShipmentStatus()
                                    missionVariables.IR_offer = null
                                    player.credits -= 1000000
                                } else {
                                    this._runScreen({
                                        title: "Yokohama Exports",
                                        overlay: "IR_yk_logo.png",
                                        messageKey: "IR_YOKOHAMA_shipment_nomoney"
                                    });
                                    missionVariables.IR_offer = null
                                }
                            }
    
                            if (choice == "IR_YOKOHAMA_no") {
                                this._runScreen({
                                    title: "Yokohama Exports",
                                    overlay: "IR_yk_logo.png",
                                    messageKey: "IR_YOKOHAMA_shipment_declined"
                                });
                                missionVariables.IR_shipment_quest = "ENROUTE"
                                this.incrementShipmentQuestion()
                                missionVariables.IR_offer = null
                                if (missionVariables.IR_alsto) {
                                    player.incrementShipmentStatus()
                                }
                            }
    
                            if (choice == "IR_YOKOHAMA_defer") {
                                this._runScreen({
                                    title: "Yokohama Exports",
                                    overlay: "IR_yk_logo.png",
                                    messageKey: "IR_YOKOHAMA_shipment_defer"
                                });
                                missionVariables.IR_offer = null
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_shipment_question_no == 2 && clock.days > missionVariables.IR_YOKOHAMA_deadline) {
                        this._runScreen({
                            title: "Yokohama Exports",
                            overlay: "IR_yk_logo.png",
                            messageKey: "IR_YOKOHAMA_shipment_toolate"
                        });
                        missionVariables.IR_shipment_quest = "DISPATCHED"
                        player.clearShipmentStatus()
                        missionVariables.IR_offer = null
                        break;
                    }
    
                    if (missionVariables.IR_shipment_question_no > 2) {
                        missionVariables.IR_asked_question = missionVariables.IR_shipment_question_string
                        this._runScreen({
                            title: "Yokohama Exports",
                            overlay: "IR_yk_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: "Yokohama Exports",
                        overlay: "IR_yk_logo.png",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_YOKOHAMA_QUESTIONS"
                break;
            }
    
            case "IR_PW_QUESTIONS": {
                if (choice == "IR_C_SDF_question_key") {
                    if (missionVariables.IR_SDF_question_no == 2) {
                        this._runScreen({
                            title: "PleasureWorld",
                            overlay: "IR_pw_logo.png",
                            messageKey: "IR_PW_SDF_answer_1",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this.incrementSDFQuestion()
                                this._runScreen({
                                    title: " ",
                                    messageKey: "IR_SDF_quest_1"
                                });
                                missionVariables.IR_SDF_quest = "ADDRESS"
                                missionVariables.IR_SDF_deadline = clock.days + 10
                            }
                        });
                        break;
                    }
    
                    if (missionVariables.IR_SDF_question_no == 3) {
                        this._runScreen({
                            title: "PleasureWorld",
                            overlay: "IR_pw_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
    
                    if (missionVariables.IR_SDF_question_no == 5) {
                        this._runScreen({
                            title: "PleasureWorld",
                            overlay: "IR_devries.png",
                            messageKey: "IR_PW_SDF_answer_2"
                        });
                        this.incrementSDFQuestion()
                        missionVariables.IR_SDF_quest = "PHOTO"
                        missionVariables.IR_SDF_deadline = clock.days + 35
                    } else {
                        this._runScreen({
                            title: "PleasureWorld",
                            overlay: "IR_pw_logo.png",
                            messageKey: "IR_negative_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                    }
                    break;
                }
    
                if (choice == "IR_E_exit_question_key") {
                    missionVariables.IR_offer = "IR_ASKED"
                    return;
                } else
                    this._runScreen({
                        title: "PleasureWorld",
                        overlay: "IR_pw_logo.png",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_PW_QUESTIONS"
                break;
            }
    
            case "IR_NWE_QUESTIONS": {
                if (choice == "IR_C_SDF_question_key") {
                    if (missionVariables.IR_SDF_question_no == 4) {
                        this._runScreen({
                            title: "Naval Weapons Establishment",
                            overlay: "IR_NWE_logo.png",
                            messageKey: "IR_NWE_SDF_answer_1a",
                            choicesKey: "IR_continue"
                        }, function (choice) {
                            if (choice == 1) {
                                this.incrementSDFQuestion()
                                this._runScreen({
                                    title: " ",
                                    overlay: "IR_NWE_logo.png",
                                    messageKey: "IR_NWE_SDF_answer_1b"
                                });
                            }
                            missionVariables.IR_offer = null
                        });
                    }
    
                    if (missionVariables.IR_SDF_question_no < 4 || missionVariables.IR_SDF_question_no > 4) {
                        this._runScreen({
                            title: "Naval Weapons Establishment",
                            overlay: "IR_NWE_logo.png",
                            messageKey: "IR_negative_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                    }
                    break;
                }
    
                if (choice == "IR_D_defences_question_key") {
                    if (missionVariables.IR_defences_question_no < 3) {
                        this._runScreen({
                            title: "Naval Weapons Establishment",
                            overlay: "IR_NWE_logo.png",
                            messageKey: "IR_NWE_defences_answer_1"
                        });
                        missionVariables.IR_defences_question_no = 3
                        missionVariables.IR_offer = null
                        player.incrementDefencesStatus()
                        break;
                    }
    
                    if (missionVariables.IR_defences_question_no == 3) {
                        this._runScreen({
                            title: "Naval Weapons Establishment",
                            overlay: "IR_NWE_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: "Naval Weapons Establishment",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_NWE_QUESTIONS"
                break;
            }
    
            case "IR_MAENES_QUESTIONS": {
                if (choice == "IR_D_defences_question_key") {
                    if (missionVariables.IR_defences_question_no == 1) {
                        this._runScreen({
                            title: "QuiCo Pharmaceuticals",
                            overlay: "IR_quico_logo.png",
                            messageKey: "IR_MAENES_defences_answer_1"
                        });
                        this.incrementDefencesQuestion()
                        missionVariables.IR_offer = null
                        missionVariables.IR_Maenes_visit = "TRUE"
                        break;
                    }
    
                    if (missionVariables.IR_defences_question_no >= 2) {
                        this._runScreen({
                            title: "QuiCo Pharmaceuticals",
                            overlay: "IR_quico_logo.png",
                            messageKey: "IR_no_more_answer",
                            choicesKey: "IR_questions"
                        }, this.choiceEvaluation);
                        break;
                    }
                }
    
                if (choice == "IR_E_exit_question_key")
                    return;
                else
                    this._runScreen({
                        title: "QuiCo Pharmaceuticals",
                        overlay: "IR_quico_logo.png",
                        messageKey: "IR_negative_answer",
                        choicesKey: "IR_questions"
                    }, this.choiceEvaluation);
                missionVariables.IR_offer = "IR_MAENES_QUESTIONS"
                break;
            }
        }
    }
    
    Scripts/xenonui_coremissionfixes.js
    "use strict";
    this.name        = "XenonUI_CoreMissionFixes";
    this.author      = "phkb";
    this.copyright   = "2016 phkb";
    this.description = "Updates routines in core missions for compatibility with XenonUI";
    this.license     = "CC BY-NC-SA 3.0";
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUpComplete = function() {
    	// apply fixes for nova missions
    	var wn = worldScripts["oolite-nova"];
    	if (wn) {
    		wn.missionScreenOpportunity = this.$nova_missionScreenOpportunity;
    	}
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$nova_missionScreenOpportunity = function() {
    	if (!player.ship.docked)
    	{
    		return;
    	}
    	
    	function choiceEvaluation(choice)
    	{
    		if (choice === "YES")
    		{
    			player.ship.useSpecialCargo(expandDescription("[oolite-nova-refugees]"));
    			mission.setInstructionsKey("oolite_nova_info");
    			missionVariables.nova = "NOVA_ESCAPE_HERO";
    			player.ship.launch();
    			this._blowUpAllStations();
    			system.sun.goNova(30);
    		}
    		else
    		{
    			// choice == "NO", or null when player launched without making a choice.
    			missionVariables.nova = "NOVA_ESCAPE_COWARD";
    			player.commsMessage(expandDescription("[oolite-nova-coward]"), 4.5);
    			system.sun.goNova(9);	// barely enough time to jump out of the system.
    		}
    		missionVariables.novacount = null;
    	}
    	
    	if (player.ship.dockedStation.isMainStation)
    	{
    		if (galaxyNumber === 3)
    		{
    			if (!missionVariables.nova && !missionVariables.novacount)
    			{
    				missionVariables.novacount = 0;
    			}
    			if (missionVariables.nova === "TWO_HRS_TO_ZERO")
    			{
    				mission.runScreen({
    					titleKey: "oolite_nova_title",
    					messageKey: "oolite_nova_brief",
    					overlay: {name:"solar.png", height:512},
    					choicesKey: "oolite_nova_yesno",
    					screenID: "oolite-nova-briefing"
    				},
    				choiceEvaluation);
    				
    				this.novaMissionTimer.stop();
    			}
    		}
    		if (galaxyNumber === 3 || galaxyNumber === 4)
    		{
    			if (missionVariables.nova === "NOVA_ESCAPED_SYSTEM")
    			{
    				player.ship.removeAllCargo();
    				mission.runScreen({
    					titleKey: "oolite_nova_title",
    					messageKey: "oolite_nova_hero",
    					overlay: {name:"solar.png", height:512},
    					screenID: "oolite-nova-hero"
    				});
    				player.ship.manifest["gem_stones"] += 100;
    				this._endTheMission();
    			}
    			else if (missionVariables.nova === "NOVA_ESCAPE_POD")
    			{
    				player.ship.removeAllCargo();  // can only be done while docked.
    				mission.runScreen(
    				{
    					titleKey: "oolite_nova_title",
    					messageKey: "oolite_nova_disappointed",
    					overlay: {name:"solar.png", height:512},
    					screenID: "oolite-nova-disappointed"
    				});
    				this._endTheMission();
    			}
    			else if (missionVariables.nova === "NOVA_ESCAPE_OTHER")
    			{
    				mission.runScreen({
    					titleKey: "oolite_nova_title",
    					messageKey: "oolite_nova_ignored",
    					overlay: {name:"solar.png", height:512},
    					screenID: "oolite-nova-ignored"
    				});
    				this._endTheMission();
    			}
    			else if (missionVariables.nova === "NOVA_ESCAPE_COWARD" && !system.sun.isGoingNova && !system.sun.hasGoneNova)
    			{
    				player.decreaseContractReputation();
    				player.decreasePassengerReputation();
    				mission.runScreen({
    					titleKey: "oolite_nova_title",
    					messageKey: "oolite_nova_disappointed",
    					overlay: {name:"solar.png", height:512},
    					screenID: "oolite-nova-coward"
    				});
    				this._endTheMission();
    			}
    		}
    	}
    	else if (missionVariables.nova === "TWO_HRS_TO_ZERO")
    	{
    		// this is the the nova system, but not the main station.
    		player.ship.launch();
    		player.commsMessage(expandDescription("[oolite-nova-visit-main]"));
    	}
    };
    
    
    Scripts/xenonui_heightfix.js
    "use strict";
    this.name = "XenonUI_HeightFix";
    this.author = "phkb";
    this.copyright = "2025 phkb";
    this.description = "Small tweak to ensure turning HUD on/off results in the right size UI";
    this.license = "CC BY-NC-SA 3.0";
    
    this._checking = false;
    
    //-------------------------------------------------------------------------------------------------------------
    this.missionScreenOpportunity = function() {
        if (this._checking) {
            if (!player.ship.hudHidden) {
                var x = worldScripts.XenonUI;
                var lib = worldScripts.Lib_GUI;
                if (lib && x._enableLibGUIInt && lib.$cur == "XenonUI") {
                    lib.guiScreenChanged();
                } else {
                    x.guiScreenChanged("", "");
                }
            }
            this._checking = false;
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.guiScreenChanged = function(to, from) {
        if (from == "GUI_SCREEN_MISSION") {
            if (player.ship.hudHidden) this._checking = true;
        }
    }