Config/script.js |
"use strict";
this.name = "display_reputation";
this.version = "1.5";
// Other scripts can limit the text set, by toggling the Booleans
// below at any time during or after StartUpComplete, e.g.
// worldScripts.display_reputation.parcel = false;
// Use some caution: if these remain false after StartUp it implies their
// controlling scripts are absent and displaying the reputation is meaningless.
this.passenger = false;
this.parcel = false;
this.contract = false;
this.explorer = false;
this.reputation = [expandMissionText("display_reputation_title_word")];
this.startUp = function () {
if (worldScripts["oolite-contracts-cargo"]) {
this.contract = true;
}
if (worldScripts["oolite-contracts-parcels"]) {
this.parcel = true;
}
if (worldScripts["oolite-contracts-passengers"]) {
this.passenger = true;
}
if (worldScripts["Explorers Club"]) {
this.explorer = true;
}
delete this.startUp;
}
this.shipExitedWitchspace = this.missionScreenOpportunity = function () {
this._setReputations();
}
this._setReputations = function () {
if (this.passenger) {
if (player.passengerReputation >= 0) {
this.reputation.push(expandMissionText("display_reputation_passenger_" + player.passengerReputation));
} else {
this.reputation.push(expandMissionText("display_reputation_passenger_minus"));
}
}
if (this.contract) {
if (player.contractReputation >= 0) {
this.reputation.push(expandMissionText("display_reputation_contract_" + player.contractReputation));
} else {
this.reputation.push(expandMissionText("display_reputation_contract_minus"));
}
}
if (this.parcel) {
if (player.parcelReputation >= 0) {
this.reputation.push(expandMissionText("display_reputation_parcel_" + player.parcelReputation));
} else {
this.reputation.push(expandMissionText("display_reputation_parcel_minus"));
}
}
if (this.explorer) {
this.reputation.push(worldScripts['Explorers Club']._playerRank());
}
mission.setInstructions(this.reputation);
this.reputation.length = 1;
} |