If you dock with a station in interstellar space, it generates this error:
Code: Select all
10:22:30.602 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RandomStationNames 0.92): TypeError: system.sun is null
10:22:30.602 [script.javaScript.exception.unexpectedType]: ../AddOns/Ambience.oxp/GalacticAlmanac.oxp/Scripts/randomstationnames.js, line 8440.
This is the code:
Code: Select all
//Code to add the Galactic Almanac to the F4 Screen when docked this any ship, station or hermit in the game or landed on any planet or moon (if PlanetFall is installed)..
this.shipDockedWithStation = function (station) {
if (system.isInterstellarSpace) this.noalmanac();
if (system.sun.isGoingNova) this.noalmanac2();
if (system.sun.hasGoneNova) this.noalmanac3();
if (!system.sun) this.noalmanac4();
if (missionVariables.random_station_names_planetengine === "Yes" || missionVariables.random_station_names_spawnmoons === "Yes") {
if (missionVariables.random_station_names_stranger_populated_system !== "Yes") this.noalmanac5();
}
if (missionVariables.random_station_names_planetengine !== "Yes" && missionVariables.random_station_names_spawnmoons !== "Yes") this.almanacinterface();
if (missionVariables.random_station_names_planetengine === "Yes" || missionVariables.random_station_names_spawnmoons === "Yes") {
if (missionVariables.random_station_names_stranger_populated_system === "Yes") this.almanacinterface();
}
// Closing Bracket for whole function.
};
If you are in interstellar space, then there will be no sun. So, the 3 IF statements after the opening one are going to fail.
You have a check for
if (!system.sun)
. However that should precede the two previous IF statements that assume there is a sun of some sort in the system.If *think* what you need to do is exit the function as soon as one of the conditions is true:
Code: Select all
//Code to add the Galactic Almanac to the F4 Screen when docked this any ship, station or hermit in the game or landed on any planet or moon (if PlanetFall is installed)..
this.shipDockedWithStation = function (station) {
if (system.isInterstellarSpace) {this.noalmanac(); return;}
if (!system.sun) {this.noalmanac4(); return;} // need to do this check before the next two
if (system.sun.isGoingNova) {this.noalmanac2(); return;}
if (system.sun.hasGoneNova) {this.noalmanac3(); return;}
if (missionVariables.random_station_names_planetengine !== "Yes" && missionVariables.random_station_names_spawnmoons !== "Yes") {this.almanacinterface(); return;}
if (missionVariables.random_station_names_planetengine === "Yes" || missionVariables.random_station_names_spawnmoons === "Yes") {
if (missionVariables.random_station_names_stranger_populated_system === "Yes") {
this.almanacinterface();
} else {
this.noalmanac5();
}
}
// Closing Bracket for whole function.
};
I'd question whether you need to do a separate check for whether there is a system.sun entity (the second IF statement). The only place that doesn't get a sun is interstellar space, and you're already checking for that. Even in a system that has gone nova, no stations will spawn, so you would never be able to dock with anything, and so this code would never fire.