Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion MFDRestoreAfterLoad

Content

Warnings

  1. http://wiki.alioth.net/index.php/MFDRestoreAfterLoad -> 404 Not Found
  2. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Restore MFD configuration after game loading. Restore MFD configuration after game loading.
Identifier oolite.oxp.SMax.MFDRestoreAfterLoad oolite.oxp.SMax.MFDRestoreAfterLoad
Title MFDRestoreAfterLoad MFDRestoreAfterLoad
Category HUDs HUDs
Author SMax SMax
Version 0.1 0.1
Tags MFD, HUDS MFD, HUDS
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/d/d0/MFDRestoreAfterLoad_0.1.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1610873477

Documentation

readme.txt

MFD Restore After Load
By S Max

Restore MFD configuration after game loading.

License
=======
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/

Version History
===============
0.1
- Initial release

Equipment

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

Ships

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

Models

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

Scripts

Path
Config/script.js
this.name           = "MFDRestoreAfterLoad";
this.author         = "SMax";
this.copyright      = "2015 SMax";
this.licence        = "CC-BY-NC-SA 4.0";
this.description    = "Restore MFD configuration after game loading.";
this.version        = "0.1 alpha 1";

"use strict";

this.startUpComplete = function() {
	var config = JSON.parse(missionVariables.MFDRestoreAfterLoad_Data);

	if (config && config.length > 0) {
		var p = player.ship;	
		for (var i = 0; i < config.length; i++) {
			try {
				if (config[i]) {
					p.setMultiFunctionDisplay(i, config[i]);
				}
			}
			catch (err) {
				log(this.name, "ERROR: Unable to set MFD " + (i + 1) + " to " + config[i]);
			}
		}
	}
}

this.playerWillSaveGame = function() {
	var p = player.ship;
	var config = [];

	if (p) {
		for (var i = 0; i < p.multiFunctionDisplayList.length; i++) {
			config.push(p.multiFunctionDisplayList[i]);
		}
	}
	
	missionVariables.MFDRestoreAfterLoad_Data = JSON.stringify(config);
}