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

Expansion Tionisla Reporter

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Have you always wanted to explore the universe beyond its boundaries? Then this mission has something for you. The head of the Tionisla Chronicle will send you out to fetch material for an article that will make headlines. And you are the author of it. Have you always wanted to explore the universe beyond its boundaries? Then this mission has something for you. The head of the Tionisla Chronicle will send you out to fetch material for an article that will make headlines. And you are the author of it.
Identifier oolite.oxp.EricWalch.TionislaReporter oolite.oxp.EricWalch.TionislaReporter
Title Tionisla Reporter Tionisla Reporter
Category Missions Missions
Author Eric Walsh, phkb Eric Walsh, phkb
Version 1.3.9 1.3.9
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Tionisla_Reporter n/a
Download URL https://wiki.alioth.net/img_auth.php/c/c8/Tionisla_Reporter.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1626941945

Documentation

Also read http://wiki.alioth.net/index.php/Tionisla%20Reporter

readme.txt

Tionisla Reporter
version 1.3 by Eric Walch

Minimum version requirement Oolite 1.82

== Overview ==
This oxp adds a simple mission for a starting commander. As the name already suggest, the mission starts at Tionisla, where the Tionisla Chronicle is located.

== Story ==
Have you always wanted to explore the universe beyond its boundaries? Then this mission has something for you. The head of the Tionisla Chronicle will send you out to fetch material for an article that will make headlines. And you are the author of it.

== Disclamer ==
This mission was mainly written to use some of the new 1.75 features. At the same time it means the commander will see stuff that was not possible in older missions. One of the things is the camera that can make a screenshot. This is a function that actually saves a picture in the screenshot folder. However, it was decided that the actual saving a picture will not be possible in the final release version of Oolite 1.77 and newer, only in the test versions. For the mission itself it is not important if the actual picture is there.

== Difficulty ==
This is an easy mission that does not add additional pirates and does not lead you through pirate systems. It also starts near the Lave system, so it should be very suitable for a starting commander.

== Installation ==
Drop this oxp in your "AddOns" folder.
For de-installation just remove the oxp from the AddOns folder. Leaving the OXP in your Addons folder will mean you can re-visit mission locations and find things still exist. Removing the OXP will remove all mission locations.

== Licence ==
This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

Planet image from http://planetpixelemporium.com/pluto.html and is copyright (c) by James Hastings-Trew.
Station model courtesy of dertien.

Version History
1.3.9	Resolved conflict with Interstellar Tweaks.
1.3.8	Camera is now portable between ships.
1.3.7	Corrected error in shipdata.plist.
1.3.6	Corrected the manifest identifier.
1.3.5	Removed the "hasOwnProperty" methods against missionVariables, as results were unpredictable.
1.3.4	Status of misjump hint will persist across saves.
		Fixed bugs that prevented the planet and station from being created.
		Planet will now be created regardless of status of station.
		Increased number of defence ships assigned to the station.
1.3.3	Made the turrets a bit more obvious.
1.3.2	Fixed spelling mistakes in missiontext.plist.
1.3.1	Added check for station destruction.
		Small graphical change to station for more uniqueness.
		Minor code adjustments.
1.3.0	Updated station model to be a variant of dertien's Octahedron station.
		Updated planet texture to a higher resolution.
		Updated station market script.
		Updated equipment.plist to use condition script.
		Updated planetinfo.plist so that the mission destination can be reached from either direction.
		Updated planetinfo.plist by removing deprecated scripting methods, replaced with Javascript versions.
		Fixed incorrect commodity references in script files.
		Mission locations will persist after the mission is complete, in order to maintain game-world consistency.
		Minor updates to mission text, fixing a couple of gramatical errors and adding a bit more flavour-text.
1.2.0	Fixed a problem with a certain device that should not be openly for sale.
		Now uses the new mission destination marker when used with Oolite 1.77
1.1.0	Changed code to make sure any Oolite version after 1.76 will not break the chart with mission destinations.
		Fixed a bug that broke the mission in Oolite 1.76.1
1.0.1	Added a check for a mission function in a future deployment version of Oolite.
1.0.0 	First release

Equipment

Name Visible Cost [deci-credits] Tech-Level
Tionisla photo camera yes 1 2+

Ships

Name
ErehwonBuoy
Erehwon Station
ErehwonTurret
Erehwon Station

Models

This expansion declares no models.

Scripts

Path
Scripts/erehwonCamera.js
"use strict";
this.name           = "erehwonCamera";
this.author         = "Eric Walch";
this.copyright		= "2010 Eric Walch";
this.description	= "Ship photocamera equipment activation script. Based on example code by another_commander";
this.licence		= "CC-by-NC-SA 3.0";

this.activated = function() {
	var self = this.ship;
    var target = self.target;
    var photoName = "wasted_photo_nr_" + (11 - missionVariables.erehwonPictureCount);
    var station = system.shipsWithPrimaryRole("erehwonStation");
    if (station) target = station[0];

	player.consoleMessage("Photo shot.");

	if (target && target.displayName == "Erehwon Station") {
        var range = target.position.distanceTo(self.position) - target.collisionRadius;
        var minDistance = target.collisionRadius * 3; // screen filling
        var maxDistance = target.collisionRadius * 10; // 1/5 of screen filling
        var inRange =  (range < maxDistance && range > minDistance);
        var deviation; // deviation in meter.

        switch (self.viewDirection) {
            case "VIEW_FORWARD": deviation = self.vectorForward.angleTo(target.position.subtract(self.position)) * range; break;
            case "VIEW_AFT": deviation = self.vectorForward.angleTo(self.position.subtract(target.position)) * range;break;
            case "VIEW_PORT": deviation = self.vectorRight.angleTo(self.position.subtract(target.position)) * range;break;
            case "VIEW_STARBOARD": deviation = self.vectorRight.angleTo(target.position.subtract(self.position)) * range;break;
            default : deviation = 2 * target.collisionRadius; // can't target when not viewing from inside ship.
        }

        var centered = (deviation < target.collisionRadius);
        if (inRange && centered) {
            missionVariables.erehwonFotoShot = "YES";
            player.consoleMessage("Good photo for an article!!");
            photoName = "Erehwon_station";
            if (missionVariables.erehwonGotStory == "YES") {
                if (missionVariables.erehwonReconnaissance != "SUCCESS") {
                    worldScripts["Tionisla Reporter"].$unmarkSystem(144);
                    worldScripts["Tionisla Reporter"].$markSystem(124);
                }
                missionVariables.erehwonReconnaissance = "SUCCESS";
                mission.setInstructionsKey("erehwonReconnaissance_missioninfo2", "Tionisla Reporter");
            }
        }
        else {
            if (!inRange) {
                if (range >= maxDistance)
					player.consoleMessage("Useless photo, to far away!!")
                else
					player.consoleMessage("Useless photo, to close!!");
            }
            else {
                player.consoleMessage("Useless photo, off-centre!!");
            }
        }

	}
    if (global.takeSnapShot != undefined) takeSnapShot(photoName); // This function will only work in testversions, never in an official release.
    if (--missionVariables.erehwonPictureCount < 1) {
        self.removeEquipment("EQ_EREHWON_PHOTOCAMERA");
        player.consoleMessage("Film is full");
    }
}
Scripts/erehwonMarket.js
"use strict";
this.name      = "erehwon_market";
this.author    = "spara";
this.copyright = "2014 spara";
this.license   = "CC BY-NC-SA 4.0";

this.$originalDefs = {
      "food": [0, 0, 19, -2, 0, 0, 1, 0, 0],
      "textiles": [0, 0, 20, -1, 0, 0, 3, 0, 0],
      "radioactives": [0, 0, 42, -3, -3, 1, 7, 3, 0],
      "slaves": [0, 0, 40, -5, 0, 0, 31, 0, 0],
      "liquor_wines": [0, 0, 105, -5, 0, 0, 15, 0, 0],
      "luxuries": [0, 0, 236, 8, 0, 0, 3, 0, 0],
      "narcotics": [0, 0, 235, 29, 0, 0, 120, 0, 0],
      "computers": [0, 0, 51, 14, 0, 0, 3, 0, 0],
      "machinery": [0, 0, 117, 6, 0, 0, 7, 0, 0],
      "alloys": [0, 0, 78, 1, 0, 0, 31, 0, 0],
      "firearms": [0, 0, 32, 13, 0, 0, 7, 0, 0],
      "furs": [0, 0, 36, -9, 0, 0, 63, 0, 0],
      "minerals": [0, 0, 16, -1, -1, 85, 3, 3, 0],
	  "gold": [0, 0, 73 , -1, -1, 5, 7, 3, 1],
	  "platinum": [0, 0, 145, -2, -2, 6, 31, 7, 1],
	  "gem_stones": [0, 0, 25, -1, -1, 250, 15, 15, 2],
      "alien_items": [0, 0, 22, 15, 0, 0, 7, 0, 0]

};

this.updateLocalCommodityDefinition = function(goodDefinition) {
	var commodity = goodDefinition.key;
	var oldDefs = this.$originalDefs[commodity];
	//old style definition found for the good. calculate it the old way
	if (oldDefs) {
		var market_base_price = oldDefs[2];
		var market_eco_adjust_price = oldDefs[3];
		var market_eco_adjust_quantity = oldDefs[4];
		var market_base_quantity = oldDefs[5];
		var market_mask_price = oldDefs[6];
		var market_mask_quantity = oldDefs[7];
		var market_rnd = Math.floor(Math.random() * 256);

		var economy = system.economy;

		var price = (market_base_price + (market_rnd & market_mask_price) + (economy * market_eco_adjust_price)) & 255;
		price *= 0.4;

		var quantity = (market_base_quantity + (market_rnd & market_mask_quantity) - (economy * market_eco_adjust_quantity)) & 255;
		if (quantity > 127) quantity = 0;
		quantity &= 63;

		goodDefinition.price = price * 10;
		goodDefinition.quantity = quantity;
	}
	//no definition found. nullify the goods.
	else {
		goodDefinition.price = 0;
		goodDefinition.quantity = 0;
	}
	return goodDefinition;
}
Scripts/erehwonMission.js
"use strict";
this.name        = "Tionisla Reporter";
this.author      = "Eric Walch";
this.copyright   = "2011-2012 Eric Walch";
this.description = "worldScript for the erehwon mission";
this.licence     = "CC-by-NC-SA 3.0";

// Code adjusted by phkb to make Ewehwon appear in the same location any time the player misjumps between USLE and BIORLE
this._restoreIST = false;

//-------------------------------------------------------------------------------------------------------------
this.startUp = function (){
    //this.misjumpInfo = "";
    if (!missionVariables.erehwonReconnaissance) {
        missionVariables.erehwonReconnaissance = "START";
        missionVariables.erehwonFotoShot = "NO";
        missionVariables.erehwonGotStory = "NO";
        missionVariables.erehwomMisJumpInfo = "";
    } else if (missionVariables.erehwonReconnaissance == "FINISHED") {
        this.cleanUp();
    }
}

//-------------------------------------------------------------------------------------------------------------
this.missionScreenOpportunity = function (){
    if (!player.ship.docked || galaxyNumber != 0) return;
    this.missionOffers();
}

//-------------------------------------------------------------------------------------------------------------
this.missionOffers = function (){
    if (player.ship.dockedStation.isMainStation) {
        if (system.ID == 124) {
            if (missionVariables.erehwonReconnaissance == "START") {
                mission.runScreen({
					screenID:"tionisla_reporter",
                    title: "Tionisla Chronicle",
                    messageKey: "erehwonReconnaissance_briefing",
                    choicesKey: "erehwonReconnaissance_choice"
                    }, this.choiceEvaluation
                );
            }
            if (missionVariables.erehwonReconnaissance == "SUCCESS") {
                mission.runScreen({
					screenID:"tionisla_reporter",
                    title: "Tionisla Chronicle",
                    messageKey: "erehwonReconnaissance_debriefing",
                    model: "erehwonStation"
                    }
                );
                mission.displayModel.orientation = [0.75, 0, -0.6, 0];
                delete missionVariables.erehwonGotStory;
                delete missionVariables.erehwonFotoShot;
                delete missionVariables.erehwonPictureCount;
                //delete missionVariables.showErehwon;
                delete missionVariables.erehwomMisJumpInfo;
                missionVariables.erehwonReconnaissance = "EPILOGUE";
                missionVariables.erehwonEpilogue = 1;
                missionVariables.erehwonActiontime = clock.days + 30;
                player.ship.removeEquipment("EQ_EREHWON_PHOTOCAMERA");
                mission.setInstructionsKey(null);
                this.$unmarkSystem(124);
                player.credits += 500;
            }
            if (missionVariables.erehwonReconnaissance == "ACCEPTED" &&
                    missionVariables.erehwonPictureCount == 0 &&  missionVariables.erehwonFotoShot == "NO") {
                mission.runScreen({
					screenID:"tionisla_reporter",
                    title: "Tionisla Chronicle",
                    messageKey: "erehwonReconnaissance_failure",
                    choicesKey: "erehwonReconnaissance_choice2"
                    }, this.choiceEvaluation
                );
            }
            if (missionVariables.erehwonReconnaissance == "ACCEPTED" &&
                    player.ship.equipmentStatus("EQ_EREHWON_PHOTOCAMERA") == "EQUIPMENT_DAMAGED") {
                mission.runScreen({
					screenID:"tionisla_reporter",
                    title: "Tionisla Chronicle",
                    messageKey: "erehwonReconnaissance_damaged",
                    choicesKey: "erehwonReconnaissance_choice2"
                    }, this.choiceEvaluation
                );
            }
        }
        /*if (system.ID == 144 && missionVariables.erehwomMisJumpInfo !== "") {
            missionVariables.erehwomMisJumpInfo = "BIORLE";
        }
        if (system.ID == 48 && missionVariables.erehwomMisJumpInfo == "BIORLE") {
            missionVariables.erehwomMisJumpInfo = "USLE";
        }*/
        if (system.ID == 144 && missionVariables.erehwomMisJumpInfo !== "GIVEN") {
            mission.runScreen({
                title: "Tionisla Chronicle",
                messageKey: "erehwonReconnaissance_biorle"
            });
            missionVariables.erehwomMisJumpInfo = "GIVEN";
        }
        if (missionVariables.erehwonReconnaissance == "DECLINED" && missionVariables.erehwonActiontime > clock.days) {
            mission.runScreen({
				screenID:"tionisla_reporter",
                title: "Tionisla Chronicle",
                messageKey: "erehwonReconnaissance_declined"
            });
            missionVariables.erehwonReconnaissance = "FINISHED";
            missionVariables.erehwonTimerStart = null;
            this.cleanUp();
        }
        if (missionVariables.erehwonReconnaissance == "EPILOGUE" && clock.days > missionVariables.erehwonActiontime) {
            if (!missionVariables.erehwonDestroyed || missionVariables.erehwonDestroyed === false) {
                // credits for the idea and next 6 messages go to SandJ
                var erehwonEpilogue = missionVariables.erehwonEpilogue++;
                missionVariables.erehwonActiontime = clock.days + 30; // set new time
                mission.runScreen({
    				screenID:"tionisla_reporter",
                    title: "Tionisla Chronicle",
                    messageKey: "erehwonReconnaissance_epilogue_" + erehwonEpilogue
                });
                switch(erehwonEpilogue) {
                    case 1:
                        player.credits += 50;
                        break;
                    case 2:
                        player.ship.fuel = 7;
                        break;
                    case 3:
                        var narcotics = player.ship.cargoSpaceAvailable;
                        if (narcotics > 35) narcotics = 35; // add a limit
                        manifest.narcotics += narcotics;
                        break;
                    case 4:
                        player.credits += 75;
                        break;
                    case 5:
                        player.credits += 50;
                        missionVariables.erehwonActiontime += 100; // wait a bit longer for the last one
                        break;
                    case 6:
                        manifest.gem_stones += 100;
                    default:
                        // we ran out of messages. Clean up now.
                        missionVariables.erehwonActiontime = null;
                        missionVariables.erehwonEpilogue = null;
                        missionVariables.erehwonReconnaissance = "FINISHED";
                        this.cleanUp();
                        break;
                }
            }
        }
    } else if (player.ship.dockedStation.displayName == "Erehwon Station") {
        if (missionVariables.erehwonGotStory && missionVariables.erehwonGotStory == "NO") {
            missionVariables.erehwonGotStory = "YES";
            mission.runScreen({
                screenID:"tionisla_reporter",
                title: "Tionisla Chronicle",
                messageKey: "erehwonReconnaissance_story"
            });
        }
        if (missionVariables.erehwonFotoShot && missionVariables.erehwonFotoShot == "YES") {
            if (missionVariables.erehwonReconnaissance != "SUCCESS")
            {
                this.$unmarkSystem(144);
                this.$markSystem(124);
            }
            missionVariables.erehwonReconnaissance = "SUCCESS";
            mission.setInstructionsKey("erehwonReconnaissance_missioninfo2");
        }
    }
}

//-------------------------------------------------------------------------------------------------------------
this.choiceEvaluation = function (choice) {
    switch (choice) {
        case "OFFER_ACCEPTED":
            missionVariables.erehwonReconnaissance = "ACCEPTED";
            player.ship.awardEquipment("EQ_EREHWON_PHOTOCAMERA");
            missionVariables.erehwonPictureCount = 10;
            mission.setInstructionsKey("erehwonReconnaissance_missioninfo1");
            this.$markSystem(144);
            mission.runScreen({
				screenID:"tionisla_reporter",
                title: "Tionisla Chronicle",
                messageKey: "erehwonReconnaissance_accepted"
                }
            );
            break;

        case "OFFER_DECLINED":
            missionVariables.erehwonReconnaissance = "DECLINED";
            missionVariables.erehwonActiontime = clock.days + 30;
            break;
    }
}

//-------------------------------------------------------------------------------------------------------------
this.shipWillEnterWitchspace = function (cause) {
	missionVariables.showErehwon = "NO"; // avoid adding planet on multiple misjumps.
    if (!system.isInterstellarSpace && galaxyNumber === 0) {
		if (cause === "standard jump" && (system.ID === 48 || system.ID === 144)) {
            missionVariables.showErehwon = "YES";
			if (missionVariables.erehwomMisJumpInfo == "GIVEN" && (system.ID == 48 || system.ID == 144) && cause === "standard jump") {
				if ((player.ship.targetSystem == 48 || player.ship.targetSystem == 144) && Math.random() < 0.2) {
					player.ship.scriptedMisjump = true;
				}
			}
		}
    }
}

//-------------------------------------------------------------------------------------------------------------
this.shipExitedWitchspace = function () {
    if (this._restoreIST === true) {
        worldScripts["IST_masterScript"].shipWillExitWitchspace = worldScripts["IST_masterScript"].$hold_shipWillExitWitchspace;
        delete worldScripts["IST_masterScript"].$hold_shipWillExitWitchspace;
        this._restoreIST = false;
    }
}

//-------------------------------------------------------------------------------------------------------------
this.$markSystem = function (ID) {
    if (0 < oolite.compareVersion("1.77")) {
        mission.markSystem(ID);
    } else {
        mission.markSystem({
            system: ID,
            name: "Tionisla Reporter",
            markerColor: "magentaColor",
            markerShape: "MARKER_DIAMOND"
        });
    }
}

//-------------------------------------------------------------------------------------------------------------
this.$unmarkSystem = function (ID) {
    if (0 < oolite.compareVersion("1.77")) {
        mission.unmarkSystem(ID);
    } else {
        var ok = mission.unmarkSystem({system: ID, name: "Tionisla Reporter"});
        if (!ok) mission.unmarkSystem(ID); // must have had a legacy marker. Clear that also.
    }
}

//-------------------------------------------------------------------------------------------------------------
this.cleanUp = function () {
    delete this.missionScreenOpportunity;
    //delete this.shipWillEnterWitchspace;
}

//-------------------------------------------------------------------------------------------------------------
this.$erehwon_systemWillPopulate = function() {
    if (this.$populatorRun) return;
    // turn off IST, just in case
    if (worldScripts["IST_masterScript"]) {
        worldScripts["IST_masterScript"].$hold_shipWillExitWitchspace = worldScripts["IST_masterScript"].shipWillExitWitchspace;
        delete worldScripts["IST_masterScript"].shipWillExitWitchspace;
        this._restoreIST = true;
    }

	system.setPopulator("oolite-interstellar-thargoids", {
        priority: 10,
        location: "WITCHPOINT",
        groupCount: 2 + Math.floor(Math.random() * 4),
        callback: function(pos) {system.addShips("thargoid", 1, pos, 0);}
	});
	this.$populatorRun = true;

	if (missionVariables.showErehwon === "YES") {
        system.addPlanet("Planet_Erehwon");
        // only add the station if it hasn't been destroyed
        if (!missionVariables.erehwonDestroyed || missionVariables.erehwonDestroyed === false) {
            system.addShips("erehwonStation", 1, Vector3D(-50000, 4000, 413000).fromCoordinateSystem("abs"), 1);
        }
	}
}
Scripts/erehwonStation.js
"use strict";
this.name        = "ErehwonStation";
this.author      = "eric walch";
this.copyright   = "2008 Eric Walch";
this.description = "station at Erehwon Planet. About 3 LY west of Biorle in galaxy 1";
this.licence     = "CC-by-NC-SA 3.0";

// Just add a default buoy. Advanced compass itself is not working in interstellar space
this.shipSpawned = function () {
    var planet = system.planets[0];
    if (planet) {
        var targetVector = planet.position.subtract(this.ship.position).direction();
        this.ship.orientation = targetVector.rotationTo(new Vector3D(0,0,1));
        system.addShips("erehwon-buoy", 1, this.ship.position.add(this.ship.heading.multiply(10E3)), 1);
    }
	if (worldScripts.StationDockControl) {
		worldScripts.StationDockControl._trafficNone.push("ErehwonStation");
		worldScripts.StationDockControl._shuttleTrafficNone.push("ErehwonStation");
	}
    delete this.shipSpawned;
}

this.stationLaunchedShip = function (ship) {
    if (ship && ship.AI == "route2sunskimAI.plist") {
        // no sunskimming possible from this station.
        ship.fuel = 7;
        ship.switchAI("exitingTraderAI.plist");
    }
}

this.shipDied = function(whom, why) {
    missionVariables.erehwonDestroyed = true;
}
Scripts/reporterConditions.js
"use strict";
this.name        = "TionislaReporter_Conditions";
this.author      = "phkb";
this.copyright   = "2016 phkb";
this.description = "Condition script for equipment.";
this.licence     = "CC BY-NC-SA 3.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	if (context === "scripted") return true;
	return false;
}