The scenario is: if a mission screen is loaded with the "backgroundSpecial" property set to "SHORT_RANGE_CHART", and then the player switches to another screen that isn't a mission screen (eg, the F5 Manifest screen), when the player then goes to the F6 galactic chart screen, the chart will be locked in that page up/down don't zoom in or out.
As soon as another mission screen is opened, though, the chart will be freed up.
I've put together some sample code to demonstrate the error:
Code: Select all
"use strict";
this.name = "ShortRangeChart_Testing";
this.author = "phkb";
this.copyright = "2016 phkb";
this.description = "Test code for the Short Range Chart special background";
this.licence = "CC BY-NC-SA 4.0";
this._sysID = -1;
this._screenOpen = false;
//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function() {
// pick a random destination within 7 LY
var sys = System.infoForSystem(galaxyNumber, system.ID).systemsInRange(7);
this._sysID = sys[1].systemID;
// initialise the interface screen
this.$initInterface(player.ship.dockedStation);
}
//-------------------------------------------------------------------------------------------------------------
this.guiScreenChanged = function(to, from) {
var p = player.ship;
// monitor when the player leaves the screen to reset their destination
if (from === "GUI_SCREEN_MISSION" && this._screenOpen) {
this._screenOpen = false;
if (this._suspendedDestination) p.targetSystem = this._suspendedDestination;
this._suspendedDestination = null;
}
p = null;
}
//-------------------------------------------------------------------------------------------------------------
this.$initInterface = function(station) {
station.setInterface(this.name,{
title:"Testing ShortRangeChart",
category:"Station Interfaces",
summary:"Testing what happens when using the ShortRangeChart special background.",
callback:this.$showPage.bind(this)
});
}
//-------------------------------------------------------------------------------------------------------------
this.$showPage = function() {
var p = player.ship;
var curChoices = {};
this._screenOpen = true;
// hold the player's destination
this._suspendedDestination = p.targetSystem;
// override it for the display
p.targetSystem = this._sysID;
var bg = "SHORT_RANGE_CHART";
curChoices["96_SETCOURSE~" + this._sysID] = "Set course for " + System.systemNameForID(this._sysID);
curChoices["99_EXIT"] = "Exit";
var def = "99_EXIT";
var opts = {
screenID: "src_testing",
title: "Short Range Chart Testing",
backgroundSpecial: bg,
allowInterrupt: true,
exitScreen: "GUI_SCREEN_INTERFACES",
choices: curChoices,
initialChoicesKey: def,
message: ""
};
mission.runScreen(opts, this.$screenHandler, this);
p = null;
opts = null;
curChoices = null;
}
//-------------------------------------------------------------------------------------------------------------
// handles player selections on the BB screen
this.$screenHandler = function(choice) {
if (this._suspendedDestination) player.ship.targetSystem = this._suspendedDestination;
this._suspendedDestination = null;
if (!choice) return;
if (choice.indexOf("96_SETCOURSE") >= 0) {
var dest = parseInt(choice.substring(choice.indexOf("~") + 1));
if (dest >= 0 && dest <= 255) {
player.ship.targetSystem = dest;
player.consoleMessage("Course set for " + System.systemNameForID(dest));
}
}
if (choice != "99_EXIT") this.$showPage();
}
If I come back to the F4 interfaces list and open any other mission screen, when I go to the F6 chart it will be unlocked.
Please let me know if any of this is unclear!