this.playerBoughtNewShip = this.playerReplacedShip = function _sc_playerReplacedShip(ship) {...}
Are those functions, above, running twice when the player buys a new ship? Would it be sufficient to just have the playerReplacedShip (or, am I thinking of adding and buying equipment)?
"Must keep this response efficient to preserve remaining context."
Note: In a future release of Oolite, playerBoughtNewShip will no longer be fired when the ship is replaced using player.replaceShip(). Instead, the playerReplacedShip event should be used. At the moment, both events (playerBoughtNewShip and playerReplacedShip) will fire
That suggests it is currently possible for both playerBoughtNewShip and playerReplacedShip to fire for the same event ?
this.startUpComplete = function () {
// Load settings from missionVariables if they exist
if (missionVariables.vASC_settings) {
this._settings = JSON.parse(missionVariables.vASC_settings);
}
// Call to apply interface
if (player.ship.docked) {
this.shipDockedWithStation(player.ship.dockedStation);
}
delete this.startUpComplete;
}
But when I changed it to this, it stopped working:
this.startUp = function () {
delete this.startUp;
// Load settings from missionVariables if they exist
if (missionVariables.vASC_settings) {
this._settings = JSON.parse(missionVariables.vASC_settings);
}
// Call to apply interface
if (player.ship.docked) {
this.shipDockedWithStation(player.ship.dockedStation);
}
}
Is it because I moved the delete line to the top?
Is it because I am docked at a (mainStation) Rock Hermit, not the usual location? (I seem to have accidentally destroyed the Coriolis.)
Is it because player.ship.docked === false during startUp and becomes true sometime between startUp and startUpComplete ?
Other unconsidered consideration?
"Must keep this response efficient to preserve remaining context."