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

Expansion Taranis

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds the Taranis mission to the Lerelace system (28 light years from Lave) Adds the Taranis mission to the Lerelace system (28 light years from Lave)
Identifier oolite.oxp.RobertTodd.Taranis oolite.oxp.RobertTodd.Taranis
Title Taranis Taranis
Category Missions Missions
Author Robert Todd Robert Todd
Version 2.1 2.1
Tags Station Station
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL https://wiki.alioth.net/index.php/Taranis_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/d/dd/Taranis_2.1.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1709981366

Documentation

Also read http://wiki.alioth.net/index.php/Taranis

readme.txt

Taranis
-------

by Robert Todd (Roberto on Oolite Forums)


Overview
--------

Based in the Lerelace system (28 light years from Lave), shipbuilder Taranis Corp originally had its main offices on the planet's surface, but strong sales of the Outrider escort vessel enabled the firm to relocate to a new orbital HQ, while retaining a few facilities "planetside". The cost of the HQ is unknown, but is estimated at around half a billion credits, a collosal sum even by the standards of big business. Noted Ineran architect Philippe K Lizzard reportedly had a hand in its design.


Notable features
----------------

In addition to being the company's managerial and administrative centre, Taranis's HQ houses extensive R&D facilities and accommodation for its staff, many of whom rarely leave the premises. The most opulent interiors are to be found on the executive levels in the rotating central sphere; the outer ring uses artificial gravity, except in certain zero-G test areas. The ring has a diameter of over 4.6km, while "The Ball", as it is known, has a diameter of around 2.3km.

The HQ is extremely well defended, thanks largely to Taranis's military connections. Anyone attempting an assault would have to contend with military-grade shields far more powerful than those of even a Torus station, 41 turrets and a squadron of five Outriders, reportedly equipped with military lasers and enhanced shields.

Less suicidal visitors will be able to take advantage of tech-level-15 ship-outfitting facilities and a shop selling a range of luxury items bearing the Taranis logo.


Notes
-----

This OXP requires you to also have the new version (or no version, but not the old one) of the Outrider OXP (uploaded 14/8/2006).

This is my second OXP, and is far more ambitious than the first, but I've tested everything extensively, so I'm reasonably confident it's all working as it should :) I plan to implement a shipyard selling only Taranis ships when it's possible to do this.

My thanks to all those who have assisted me - especially Giles, Murgh and Arexack_Heretic (who helped me through my darkest hours with the AIs!). Thanks again to Murgh for the use of his Wolf Mark II as the mission ship.

23/8/2006: New version adding smoothing to the ring (as suggested by Arexack_Heretic) and a line about Taranis in the planet description (as suggested by LittleBear). If you prefer the model unsmoothed, you can change it by deleting the following lines in shipdata.plist (in the Config folder):
<key>smooth</key>
<true/>

24/8/2006: Renamed turret files so as not to affect other OXPs (as suggested by Ahruman).

12/4/2009: Version 1.1 Added anti mission clash code. Should now be compatible with simultaneously offers by other oxp's. (Eric)

01/10/2009: Version 1.2 Fixed wrong definition for Gold/Planinum weight at the Taranis station commodities.plist. Before it was mainly a cosmetic bug, but it can crash Oolite version 1.73. (maik)

19/5/2012: Version 1.3 Converted to JS. (Eric)

2/11/2023: Version 2.0 updated by phkb
- Converted XML plist files to OpenStep.
- Updated station textures and market script.
- Updated subentities to use new definitions.
- Updated Wolf Mark II to use Griff's models and textures.
- Updated station spawning code so that it is possible to save the game at the Taranis HQ.
- Added New Cargoes station functionality.
- Fixed issue with docking port, where you would seem to pass through the back of the docking port and view the large blue globe in the middle of the station before the docking animation started.

21/01/2024: Version 2.0.1
- Fixed version number in manifest file.

21/01/2024: Version 2.0.2
- Fixed missing ";" in shipdata.plist.

22/01/2024: Version 2.0.3
- Actually saved the file before building OXZ, to fix missing ";" in shipdata.plist.

26/01/2024: Version 2.0.4
- Swapped normals in Taranis station models to correct position (with thanks to Commander_x).
- Reverted to dock object so ILS will function with station.
- Tweaks to shipdata.plist.
- Removed unused files.

29/01/2024: Version 2.0.5
- Added a visual effect after spawn to mask the issue with the dock walls disappearing when docking.

22/02/2024: Version 2.1
- Added new planet texture with city lights.
- Updated planet description with fuller version from FPO.
- Ensured new planet texture is applied.

Lightning and Crown icons from www.flaticom.com
<a href="https://www.flaticon.com/free-icons/lightning" title="lightning icons">Lightning icons created by Triangle Squad - Flaticon</a>
<a href="https://www.flaticon.com/free-icons/crown" title="crown icons">Crown icons created by Stockio - Flaticon</a>

Equipment

This expansion declares no equipment.

Ships

Name
Taranis Corporation HQ
Taranis Corporation HQ - Ball
Ball Turret
Taranis Corporation HQ - Dock
Wolf Mark II (Taranis Corp)

Models

This expansion declares no models.

Scripts

Path
Scripts/taranis_market.js
"use strict";
this.name = "taranis_market";
this.author = "spara";
this.copyright = "2014 spara";
this.license = "CC BY-NC-SA 4.0";

this.$originalDefs = {
	"food": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"textiles": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"radioactives": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"slaves": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"liquor_wines": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"luxuries": [0, 0, 196, 8, 8, 73, 3, 3, 0],
	"narcotics": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"computers": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"machinery": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"alloys": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"firearms": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"furs": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"minerals": [0, 0, 0, 0, 0, 0, 0, 0, 0],
	"gold": [0, 0, 0, 0, 0, 0, 0, 0, 1],
	"platinum": [0, 0, 0, 0, 0, 0, 0, 0, 1],
	"gem_stones": [0, 0, 0, 0, 0, 0, 0, 0, 2],
	"alien_items": [0, 0, 0, 0, 0, 0, 0, 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/taranis_newcargoes.js
"use strict";
this.author = "cim";
this.copyright = "© 2011-2014 cim.";
this.license = "CC-BY-SA 3.0";
this.name = "CargoTypeExtension-Station-Taranis";
this.description = "Taranis market definition";

this.startUp = function() {
	if (!worldScripts.CargoTypeExtension) {
		for(prop in this){
			if(prop!=='name' && prop!=='version' && prop !== "oolite_manifest_identifier") {
				delete this[prop];
			}
		}
	return;
	}
	else {
		worldScripts["CargoTypeExtension"].registerOXPStation(this.name, "taranis");
	}
}

/* Station API */


this.randomCargoChance = function (good) {
	var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
	if (generic == "luxuries") {
		return 0.75;
	}
	return 0;
}

this.randomCargoAmount = function (good) {
	return 3;
}

this.exportCargoAmount = function (good) {
	var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
	if (generic == "luxuries") {
		return 1;
	}
	return 0;
}

this.exportCargoPrice = function (good) {
	return 0.9 + (Math.random() * 0.2);
}

this.randomImportChance = function (good) {
	return 0;
}

this.systemImportChance = function (good) {
	var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
	if (generic == "alloys" || generic == "radioactives" || generic == "minerals") {
		return 1;
	} else {
		return 0;
	}
}

this.importCargoPrice = function (good) {
	return 0.9 + (Math.random() * 0.2);
}

// they have police patrol ships, so they probably obey Galcop rules here
this.importPermitCheck = function () {
	return true;
}

this.exportPermitCheck = function () {
	return true;
}

this.stationGossip = function () {
	return false;
}
Scripts/taranis_one.js
"use strict";
this.name = "taranis_one";
this.author = "Robert Todd (Roberto on Oolite Forums)";
this.copyright = "© 2006 Creative Commons: attribution, non-commercial, sharealike.";
this.description = "worldScript for the taranis mission";

//-------------------------------------------------------------------------------------------------------------
this.startUp = function () {
    if (missionVariables.taranis_one == "TAR1_COMPLETE" || missionVariables.taranis_one == "TAR1_FAILED") {
        this.$cleanUp();
    }
	if (worldScripts["Famous Planets Overhaul"]) {
		// we want to keep our texture for the planet
		var fpo = worldScripts["Famous Planets Overhaul"];
		var idx = fpo.planetList[0].indexOf(141);
		fpo.planetList.splice(idx, 1);
	}
};

//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function() {
    // make sure our texture wins any races to be the last texture installed
    var info = System.infoForSystem(0, 141);
    info.texture = "lerelace_diffuse.png";
}

//-------------------------------------------------------------------------------------------------------------
this.turnStationToEntity = function (station, entity) {
	var targetVector = entity.position.subtract(station.position).direction();
	station.orientation = targetVector.rotationTo([0, 0, 1]);
}

//-------------------------------------------------------------------------------------------------------------
this.systemWillPopulate = function() {
	if (galaxyNumber === 0 && system.ID === 141) {
		var stationPos = Vector3D(157000, 37000, 28000).fromCoordinateSystem("pwm");
		system.setPopulator("taranis_station", {
			callback: function (pos) {
                if (system.countShipsWithRole("taranis") == 0) {
				    var stn = system.addShips("taranis", 1, pos, 0)[0];
				    worldScripts["taranis_one"].turnStationToEntity(stn, system.mainPlanet);
                    // add a ve to mask the issue of the walls of the dock disappearing when you enter
                    var ve = system.addVisualEffect("taranis-dock-ve", stn.position.add(stn.vectorForward.multiply(2339)));
                    ve.scale(1.01);
                    ve.orientation = stn.orientation;
                }
			},
			location: "COORDINATES",
			coordinates: stationPos,
			deterministic: true
		});
	}
}

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

//-------------------------------------------------------------------------------------------------------------
this.missionOffers = function () {
    if (player.ship.dockedStation.isMainStation) {
        if (missionVariables.taranis_one == "TAR1_ACTIVE" && missionVariables.taranis_one_startdate + 2 < clock.days) {
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_incoming",
                music: "taranis_comms.ogg",
                choicesKey: "taranis_one_incoming2_justyes"
            }, this.choiceEvaluation
            );
        }
        if (missionVariables.taranis_one == "TAR1_DESTROYED") {
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_incoming",
                music: "taranis_comms.ogg",
                choicesKey: "taranis_one_incoming_justyes"
            }, this.choiceEvaluation
            );
        }
    } else if (system.ID == 141 && player.ship.dockedStation.name == "Taranis Corporation HQ") {
        if (!missionVariables.taranis_one && player.score > 127 && player.bounty < 5) {
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_preamble",
                choicesKey: "taranis_one_preamble_justyes",
                music: "swifts_theme.ogg"
            }, this.choiceEvaluation
            );
        }
    }
};


//-------------------------------------------------------------------------------------------------------------
this.choiceEvaluation = function (choice) {
    switch (choice) {
        case "1":
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_intro1",
                choicesKey: "taranis_one_cont1_justyes",
                music: "swifts_theme.ogg"
            }, this.choiceEvaluation
            );
            break;
        case "2":
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_intro2",
                choicesKey: "taranis_one_cont2_justyes",
                music: "swifts_theme.ogg"
            }, this.choiceEvaluation
            );
            break;
        case "3":
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_decision",
                choicesKey: "taranis_one_offer_yesno",
                music: "swifts_theme.ogg"
            }, this.choiceEvaluation
            );
            break;
        case "4":
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_accepted",
                choicesKey: "taranis_one_cont3_justyes",
                music: "swifts_theme.ogg"
            }, this.choiceEvaluation
            );
            break;
        case "5":
            missionVariables.taranis_one = "TAR1_PASSED";
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_declined"
            });
            break;
        case "6":
            missionVariables.taranis_one_startdate = clock.days;
            missionVariables.taranis_one = "TAR1_ACTIVE";
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_briefing",
                music: "swifts_theme.ogg"
            });
            mission.markSystem({ system: 111, name: "taranis" });
            player.credits += 2000;
            this.updateTimeLeft();
            break;
        case "7":
            missionVariables.taranis_one = "TAR1_COMPLETE";
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_success",
                music: "swifts_theme.ogg"
            });
            mission.setInstructionsKey(null);
            mission.unmarkSystem({ system: 111, name: "taranis" });
            player.credits += 2000;
            delete missionVariables.taranis_one_startdate;
            delete missionVariables.taranis_one_daysremaining;
            this.$cleanUp();
            break;
        case "8":
            missionVariables.taranis_one = "TAR1_FAILED";
            mission.runScreen({
                title: "Taranis one",
                screenID: "taranis",
                messageKey: "taranis_one_failure",
                music: "swifts_theme.ogg"
            });
            mission.setInstructionsKey(null);
            mission.unmarkSystem({ system: 111, name: "taranis" });
            // repay the advance fee for the mission.
            if (player.credits > 2000) player.credits -= 2000; else player.credits = 0;
            delete missionVariables.taranis_one_startdate;
            delete missionVariables.taranis_one_daysremaining;
            this.$cleanUp();
            break;

        default:
            break;
    }
};

//-------------------------------------------------------------------------------------------------------------
this.shipLaunchedFromStation = function () {
    if (missionVariables.taranis_one == "TAR1_ACTIVE") {
        this.updateTimeLeft();
    }
};

//-------------------------------------------------------------------------------------------------------------
this.shipExitedWitchspace = function () {
    if (missionVariables.taranis_one == "TAR1_ACTIVE" && !this.messagesTimer) {
        this.messagesTimer = new Timer(this, this.waitForAdjusting, 0, 2); // clock might not be valid yet.
    }
    if (missionVariables.taranis_one == "TAR1_PASSED" && Math.random() < 0.05) {
        missionVariables.taranis_one = null; // restart mission offers
    }
};

//-------------------------------------------------------------------------------------------------------------
this.waitForAdjusting = function () {
    if (clock.isAdjusting) return;
    var timePast = this.updateTimeLeft();
    if (system.ID == 111 && timePast < 3) {
        system.addShips("taranis-wolf", 1, Vector3D(127112, 20303, 662546).fromCoordinateSystem("pwm"), 0);
    }
    this.messagesTimer.stop();
    delete this.messagesTimer;
}

//-------------------------------------------------------------------------------------------------------------
this.updateTimeLeft = function () {
    var timePast = clock.days - missionVariables.taranis_one_startdate;
    switch (timePast) {
        case 0:
            missionVariables.taranis_one_daysremaining = "three days";
            break;
        case 1:
            missionVariables.taranis_one_daysremaining = "two days";
            break;
        case 2:
            missionVariables.taranis_one_daysremaining = "one day";
            break;
        default:
            // Mission ended not in time.
            mission.setInstructionsKey("mission_taranis_one_desc2");
            mission.unmarkSystem({ system: 111, name: "taranis" });
            break;
    }
    if (timePast < 3) mission.setInstructionsKey("mission_taranis_one_desc1");

    return timePast;
};

//-------------------------------------------------------------------------------------------------------------
this.$cleanUp = function () {
    delete this.missionScreenOpportunity;
    delete this.shipLaunchedFromStation;
    delete this.shipExitedWitchspace;
};
Scripts/taranis_wolfmk2.js
"use strict";
this.name = "taranis_wolfmk2";
this.author = "Robert Todd (Roberto on Oolite Forums)";
this.copyright = "© 2006 Creative Commons: attribution, non-commercial, sharealike.";
this.description = "shipScript taranis mission";

this.shipDied = function () {
    missionVariables.taranis_one = "TAR1_DESTROYED";
    mission.setInstructionsKey(null, "taranis_one");
    mission.unmarkSystem({ system: 111, name: "taranis" });
}