Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri Jul 21, 2017 4:37 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Jul 15, 2016 1:28 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1575
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
I think I've worked this out, but it would be good to get someone else to test it.

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:
"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();
}
When I run this code, open the screen from the F4 interfaces list, and then go to the F6 chart, it will be locked.
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!

_________________
My OXP's


Top
   
PostPosted: Fri Jul 15, 2016 6:21 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 4876
Confirmed if the player ship is not equipped with an Advanced Nav Array. You can simply reproduce it by going to any parcel or contract screen, which displays a chart, then got back to F5 and then F6. Try repeating your process but this time make sure to have an ANA installed and see if this makes it work.

One other thing I noticed while testing this is, when in the F6 screen in search planet mode (awaiting text input), using the zoom in / out controls will make the F6 screen title disappear until the chart is clicked or search mode is exited.


Top
   
PostPosted: Fri Jul 15, 2016 7:38 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1575
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
The code I posted should demonstrate the issue with the ANA installed.

_________________
My OXP's


Top
   
PostPosted: Fri Jul 15, 2016 7:49 am 
Offline
Commodore
Commodore
User avatar

Joined: Thu Nov 07, 2013 10:21 pm
Posts: 281
That's proper horlicksed, isn't it?

I think it's something to do with the backgroundSpecial variable not being changed back to GUI_BACKGROUND_SPECIAL_SHORT after the mission screen. I'll investigate further when I'm not at work.


Top
   
PostPosted: Fri Jul 15, 2016 12:47 pm 
Offline
Commodore
Commodore
User avatar

Joined: Thu Nov 07, 2013 10:21 pm
Posts: 281
Both the non-zooming and the disappearing chart title should be fixed in tonight's build.


Top
   
PostPosted: Sun Jul 17, 2016 7:41 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1575
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Thanks kanthoney and a_c, confirmed it all works fine now!

_________________
My OXP's


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited