Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion Interstellar Help

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Introduces some interaction with fellow commanders in interstellar space, who might come to the player's rescue if they're stranded, or the player could be asked for help from other stranded ships. Introduces some interaction with fellow commanders in interstellar space, who might come to the player's rescue if they're stranded, or the player could be asked for help from other stranded ships.
Identifier oolite.oxp.Commander_McLane.Interstellar_Help oolite.oxp.Commander_McLane.Interstellar_Help
Title Interstellar Help Interstellar Help
Category Activities Activities
Author Commander McLane Commander McLane
Version 2.3 2.3
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Interstellar_help_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/d/d9/Interstellar_Help.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1626941524

Documentation

Also read http://wiki.alioth.net/index.php/Interstellar%20Help

readMe.txt

Interstellar Help v 2.2
by "Commander McLane"

an Expansion Pack for Oolite by Giles Williams

based on "Elite" by Ian Bell and David Braben

Introduction
------------
Interstellar space is a treacherous territory, and misjumps are dangerous. It's not only what you may meet out there, it's the sheer fact that you may get stranded in the vast voids of interstellar space forever. Initiating a witchjump and creating the tunnel through witchspace consumes fuel. So if -- for whatever reason -- the tunnel collapses halfway on your journey to the next planet, you are thrown out somewhere in the middle of nowhere, in the vast realms of ghastly, pale green half-light, your fuel tanks nearly depleted, possibly with not enough fuel left to create another tunnel to the closest system.

Many pilots have just vanished without a trace in the boundless void. Some ships have said to be found drifting into the outer zones of an adjacent system -- but only decades after their life support systems ran out of energy.

So the family of space-farers gets even closer together in the uncanny zone of interstellar space, where everybody is far away from home, and everybody may find himself at the mercy of fellow captains, or be lost in space forever. One for all, and all for one -- although for anybody in the dire straits of need for fuel help comes with a price.

Overview
--------
This OXP introduces some interaction with fellow commanders in interstellar space. You may meet another trader who got stuck in interstellar space who sends distress calls and asks for your help. He is willing to pay a good price for some fuel from your tanks, or for a ride in your wake. If you are in the mood to help him, just answer his call by flying towards him. You will have to get closer than 1000 meters in order to make clear that you are there for him.

He then will either be wanting to buy some fuel from you, or request to follow through your wormhole, after you have jumped to your destination. If you agree to sell him some of your fuel reserves, you just have to get very close to him. So close that he can scoop any of the fuel you are venting from your tanks. The process starts automatically, monitored by your ship's computer, as soon as you have approached him closely enough. If you want to end the transaction you just have to turn your nose away from his scoops. If you do not do so, he will take all the fuel you have until his tanks are completely filled. The usual price for a fuel transfer so far away from the next supplier is ten times what you would pay at a main station.

If he asks you for a witchspace ride, all you have to do is to jump to your current destination. After you have jumped to any system within your reach, he will follow you through your wormhole (note that he will not jump out at the exact same location as you; wormhole ends are a tiny little bit fuzzy, which means that ships leaving the same wormhole will all be somewhere in the vicinity of the witchpoint, but not at the exact same place). You will have earned the eternal gratitude of a fellow trader, and a financial reward, which will always be enough to cover your fuel costs for the jump.

But what if you are stuck in interstellar space yourself? Do not despair, that's where your Electronic Thumb comes in handy. The Electronic Thumb is a short squat black rod, smooth and matte with a couple of flat switches and dials at one end. Just activate it any time during flight to flag down passing spacecraft to either buy fuel from them or hitch a ride in their wormhole. Note that the Electronic Thumb only works if you need it, that is in interstellar space. If you're in a system it does nothing.

After you have activated it, just wait a little for a ship approaching you with the offer to help you. Again you have to close in to him in order to accept the offer. Depending on his mood he may offer you to buy some of his fuel reserves, or to take a ride through his wormhole. This time it is you, of course, who has to pay the price.

Again, if you agreed on a fuel transaction, you have to get close enough to scoop the fuel he is going to vent from his tanks, and again your ship's computer takes care of monitoring the transaction. You can end the transfer anytime, by pointing your ship's nose (and therefore your fuel scoops) away from your donor. The transaction will also end if you run out of money. And your benefactor will not sell all his fuel -- he is going to need some for his own journey, after all.

If the offer is to take a ride in his wormhole, he will initiate his jump and invite you to follow him. In that case you are supposed to pay him on the other side. Oh, in order to allow him to initiate the jump sequence it may be necessary that you get out of his way first.

In any case it would be considered very rude to shoot at your benefactor or try to extract his fuel otherwise. The attempt won't be successful.

Minimum Requirements
--------------------
Interstellar_help.oxp requires at least Oolite 1.75.1.

Download Location
-----------------
This OXP is available for download via the http://wiki.alioth.net/index.php/Interstellar_help_OXP

Installation
------------
Move or copy the file interstellar_help.oxp from this folder to the AddOns folder inside the Oolite main folder. Restart Oolite.

Acknowledgements
Thanks to Simon B who kicked me to just sit down and realize this old idea of mine. And thanks to all the Oolite coders who are continuously working to make OXPs like this possible.

License
-------
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 3.0. For more information see the ReadMe of Oolite or http://creativecommons.org/licenses/by-nc-sa/3.0/

Practically this means that you may rip it apart and use whatever seems useful to you, as long as you credit the original author. It would be nice (although by no means necessary) to give me a note, if you intend to use parts of it.

History
-------
version 2.3 (July 1st, 2021)
- Prevented Javascript error condition if player ship has been destroyed.

version 2.2 (April 10th, 2018)
- Added "use strict" to all scripts.
- Converted XML plists to Openstep format.
- Converted RTF readme file to plain text.
- Added manifest file for OXZ publication.

version 2.1 (March 2nd, 2011)
- made the OXP Oolite 1.75-compliant
- moved all self-defined functions in their own namespace
- utilized the new possibility of a ship actually following you in your wormhole
- introduced the Electronic Thumb, utilizing the new possibility of player-activated equipment
- requires at least Oolite 1.75.1

version 2.0 (January 27th, 2009)
- small AI improvements
- added the selling-fuel mechanism as an alternative to the wormhole mechanism
- added the possibility for the player to be at the receiving end, and get out of an otherwise 'Press Space Commander'-situation.

version 1.1 (December 29th, 2008)
- spawning the trader with a different method, so that it looks as if he was already around when you jump in
- tiny changes to this readMe

version 1.0 (November 15th, 2008)
- fully functional version
- requires Oolite 1.72

Possible further developments
-----------------------------
- further improve the AI of the NPCs, especially include handling of attacks

Equipment

Name Visible Cost [deci-credits] Tech-Level
Electronic Thumb yes 9850 7+

Ships

Name
interstellar-help-ship-1
interstellar-help-ship-10
interstellar-help-ship-11
interstellar-help-ship-12
interstellar-help-ship-13
interstellar-help-ship-14
interstellar-help-ship-15
interstellar-help-ship-2
interstellar-help-ship-3
interstellar-help-ship-4
interstellar-help-ship-5
interstellar-help-ship-6
interstellar-help-ship-7
interstellar-help-ship-8
interstellar-help-ship-9
interstellar-helper-1
interstellar-helper-2
interstellar-helper-3
interstellar-helper-4
interstellar-helper-5
interstellar-helper-6
interstellar-helper-7

Models

This expansion declares no models.

Scripts

Path
Config/script.js
/*

interstellar_help.js

Adds a ship that asks for your help in interstellar space.


Oolite
Copyright © 2004-2011 Giles C Williams and contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.


interstellar_help.oxp
Copyright © 2008-2011 "Commander McLane"

This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.

To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.

*/

"use strict";
this.name           = "interstellar_help";
this.author         = "Commander McLane";
this.copyright      = "© 2011 Commander McLane";
this.license		= "CC-by-nc-sa 3.0";

this.shipWillEnterWitchspace = function(cause)
{
	if(system.isInterstellarSpace && this.interstellarHelp)
    {
        this.fuelUsed = system.info.distanceToSystem(System.infoForSystem(galaxyNumber, player.ship.targetSystem));
        missionVariables.interstellar_help_pay = (Math.round(this.fuelUsed * 2) * 10) + 50;
    }
	// next line is part of the substitution for playerJumpFailed
	if(system.isInterstellarSpace && this.playerCanJumpTimer.isRunning)
        this.playerCanJumpTimer.stop();
}

this.shipWillExitWitchspace = function()
{
	if(system.isInterstellarSpace && !this.interstellarHelp && Math.random() < 0.3) system.addShips("interstellar_help_trader", 1, [0, 0, 0], 15000);
}

this.playerJumpFailed = function(reason)
{
    if(system.isInterstellarSpace && reason == "insufficient fuel" && Math.random > 0.75 && system.countShipsWithRole("interstellar_helper") == 0)
	{
		system.addShips("interstellar_helper", 1, player.ship.position.add(Vector3D.randomDirection(27000)));
	}
}

/* the code below here is only a substitute as long as 'playerJumpFailed' doesn't work */

this.shipExitedWitchspace = function()
{
	if(system.isInterstellarSpace)
	{
		if(!this.playerCanJumpTimer) this.playerCanJumpTimer = new Timer(this, this.$checkPlayerFuel, 45, 45);
		else this.playerCanJumpTimer.start();
	}
}

this.$checkPlayerFuel = function()
{
	if(player.ship.fuel < 1 && system.countShipsWithRole("interstellar_helper") == 0)
		system.addShips("interstellar_helper", 1, player.ship.position.add(Vector3D.randomDirection(27000)));
}
Scripts/interstellar-electronic-thumb.js
/*

interstellar-electronic-thumb.js

Enables the player to call for help if left without fuel in interstellar space.


Oolite
Copyright © 2004-2011 Giles C Williams and contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.


interstellar_help.oxp
Copyright © 2008-2011 "Commander McLane"

This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.

To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.

*/

"use strict";
this.name           = "interstellar-electronic-thumb";
this.author         = "Commander McLane";
this.copyright      = "© 2011 Commander McLane";
this.license		= "CC-by-nc-sa 3.0";

this.activated = function()
{
    if(!system.isInterstellarSpace)
    {
        player.consoleMessage("Please don't press this button again.");
        player.consoleMessage("The Electronic Thumb doesn't work inside a system.");
        return;
    }
    if(player.ship.isCloaked)
    {
        player.consoleMessage("Electronic Thumb off-line.");
        player.consoleMessage("Reason: Ship is cloaked. Please decloak first.");
    }
    else
    {
        player.consoleMessage("Electronic Thumb activated.");
        player.consoleMessage("Let's see if you could flag down a ship to your rescue.");
        if(system.countShipsWithPrimaryRole("interstellar_helper") == 0)
            system.addShips("interstellar_helper", 1, player.ship.position.add(Vector3D.randomDirection(27000)));
    }
}
Scripts/interstellar-help-ship.js
/*

interstellar-help-ship.js

Script for the ship that asks for your help in interstellar space.


Oolite
Copyright © 2004-2011 Giles C Williams and contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.


interstellar_help.oxp
Copyright © 2008-2011 "Commander McLane"

This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.

To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.

*/

"use strict";
this.name           = "interstellar-help-ship";
this.author         = "Commander McLane";
this.copyright      = "© 2011 Commander McLane";
this.license		= "CC-by-nc-sa 3.0";

this.shipSpawned = function()
{
    if(system.isInterstellarSpace)
    {
        this.ship.AIState = "WAIT_A_LITTLE";
    }
    else
    {
        this.ship.primaryRole = "trader";
        this.ship.switchAI("route1traderAI.plist");
    }
}

this.shipExitedWormhole = function()
{
    if(system.isInterstellarSpace)
    {	
        delete worldScripts.interstellar_help.interstellarHelp;
        delete worldScripts.interstellar_help.fuelUsed;
        delete missionVariables.interstellar_help_pay;
        this.ship.AIState = "COMPLAIN";
        return;
    }
    else
    {
        this.ship.primaryRole = "trader";
        this.ship.AIState = "DESTINATION_REACHED";
        return;
    }
}

this.$waitForPlayer = function()
{
	if (!player.ship || !player.ship.isValid) return;
	if(this.ship.position.distanceTo(player.ship.position) < 1000 && !player.ship.isCloaked)
	{
		this.ship.target = player.ship;
		this.ship.reactToAIMessage("TARGET_FOUND");
	}
}

this.$checkJumpCapability = function()
{
	if(this.ship.hasHyperspaceMotor)
		this.ship.reactToAIMessage("BUYING");
	else
		this.ship.reactToAIMessage("ROLL_1");
}

this.$checkDistanceToPlayer = function()
{
	if(this.ship.position.distanceTo(player.ship) < 250 && player.ship.heading.angleTo(this.ship.position.subtract(player.ship.position).direction()) < 0.15)
	{
		this.ship.AIState = "REFUELING";
		this.fuelTransferred = 0;
		this.payment = 0;
		if(!this.refuelTimer)
			this.refuelTimer = new Timer(this, this.$refuelFromPlayerShip, 1, 1);
		else
			this.refuelTimer.start();
	}
}

this.$refuelFromPlayerShip = function()
{
	if(player.ship.heading.angleTo(this.ship.position.subtract(player.ship.position).direction()) < 0.15)
	{
		player.ship.fuel -= 0.2;
		this.ship.fuel += 0.2;
		player.credits += 4;
		this.fuelTransferred += 0.2;
		this.payment += 4;
		player.consoleMessage("Fuel transferred: " + Math.round(this.fuelTransferred * 10) / 10 + " LY. Payment: " + this.payment + expandDescription("[interstellar_help_cr]"), 1);
		if(player.ship.fuel < 0.2)
		{
			this.refuelTimer.stop();
			this.ship.reactToAIMessage("NO_MORE_FUEL");
		}
		if(this.ship.fuel >= 7)
		{
			this.refuelTimer.stop();
			this.ship.reactToAIMessage("FULL");
		}
	}
	else
	{
		this.refuelTimer.stop();
		this.ship.reactToAIMessage("TRANSACTION_COMPLETE");
	}
}

this.$startWormholing = function()
{
	worldScripts.interstellar_help.interstellarHelp = "FOLLOWING";
}

this.$payReward = function()
{
	player.credits += missionVariables.interstellar_help_pay;
	delete worldScripts.interstellar_help.interstellarHelp;
    delete worldScripts.interstellar_help.fuelUsed;
	delete missionVariables.interstellar_help_pay;
	this.ship.primaryRole = "trader";
}


this.shipTargetCloaked = function()
{
	if(!this.ship.target.isPlayer) return;
    var currentAIState = this.ship.AIState;
	switch(currentAIState)
	{
	case "BUYING":
        this.ship.commsMessage("Hey, friend, why have you disappeared?");
        this.ship.target = null;
		this.ship.AIState = "WAIT_A_LITTLE";
		break;
    
	case "WAIT_FOR_APPROACH":
        this.ship.commsMessage("Hey, friend, why have you disappeared?");
        this.ship.target = null;
		this.ship.AIState = "WAIT_A_LITTLE";
		break;
    
    case "REFUELING":
        this.refuelTimer.stop();
        this.ship.commsMessage("Hey, friend, why have you disappeared? We weren't finished yet.");
        this.ship.target = null;
		this.ship.AIState = "PREPARE_JUMP";
    }
}	

this.shipDied = function()
{
	if(worldScripts.interstellar_help.interstellarHelp)
	{
		delete worldScripts.interstellar_help.interstellarHelp;
		delete missionVariables.interstellar_help_pay;
	}
}	
Scripts/interstellar-helper.js
/*

interstellar-helper.js

Script for the ship that asks for your help in interstellar space.


Oolite
Copyright © 2004-2011 Giles C Williams and contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.


interstellar_help.oxp
Copyright © 2008-2011 "Commander McLane"

This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.

To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.

*/

"use strict";
this.name = "interstellar-helper";
this.author = "Commander McLane";
this.copyright = "© 2011 Commander McLane";
this.license = "CC-by-nc-sa 3.0";

this.$playerInScannerRange = function () {
	if (this.ship.position.distanceTo(player.ship) < 24000) {
		this.ship.reactToAIMessage("APPROACHING_PLAYER");
	}
}

this.$checkPlayerApproached = function () {
	if (this.ship.position.distanceTo(player.ship) < 7000) {
		this.ship.reactToAIMessage("PLAYER_APPROACHED");
	}
}

this.$checkForFuelScoops = function () {
	if (player.ship.equipmentStatus("EQ_FUEL_SCOOPS") != "EQUIPMENT_OK") {
		this.ship.AIState = "WORMHOLE";
	}
}

this.$startWaiting = function () {
	this.waitTimer = new Timer(this, this.$stopWaiting, 30);
}

this.$stopWaiting = function () {
	this.ship.commsMessage("Sorry commander, I ain't got time forever. Have to continue my journey. So long!");
	this.ship.AIState = "GOOD_BYE";
	this.ship.primaryRole = "trader";
	delete this.waitTimer;
}

this.$checkDistanceToPlayer = function () {
	if (this.ship.position.distanceTo(player.ship) < 250 && player.ship.heading.angleTo(this.ship.position.subtract(player.ship.position).direction()) < 0.15) {
		this.waitTimer.stop();
		delete this.waitTimer;
		this.ship.AIState = "REFUELING";
		this.fuelTransferred = 0;
		this.payment = 0;
		if (!this.refuelTimer)
			this.refuelTimer = new Timer(this, this.$refuelPlayerShip, 1, 1);
		else
			this.refuelTimer.start();
	}
}

this.$refuelPlayerShip = function () {
	if (player.ship.heading.angleTo(this.ship.position.subtract(player.ship.position).direction()) < 0.15) {
		player.ship.fuel += 0.2;
		this.ship.fuel -= 0.2;
		player.credits -= 4;
		this.fuelTransferred += 0.2;
		this.payment += 4;
		player.consoleMessage("Fuel transferred: " + Math.round(this.fuelTransferred * 10) / 10 + " LY. Price: " + this.payment + expandDescription("[interstellar_help_cr]"), 1);
		if (this.ship.fuel < 3.4) {
			this.refuelTimer.stop();
			this.ship.reactToAIMessage("NO_MORE_FUEL");
			this.ship.primaryRole = "trader";
		}
		if (player.ship.fuel >= 7) {
			this.refuelTimer.stop();
			this.ship.reactToAIMessage("FULL");
			this.ship.primaryRole = "trader";
		}
		if (player.credits < 4) {
			this.refuelTimer.stop();
			this.ship.reactToAIMessage("NO_MORE_MONEY");
			this.ship.primaryRole = "trader";
		}
	} else {
		this.refuelTimer.stop();
		this.ship.reactToAIMessage("TRANSACTION_COMPLETE");
		this.ship.primaryRole = "trader";
	}
}

this.shipSpawned = this.$setTargetToPlayer = function () {
	this.ship.target = player.ship;
}

this.shipDied = function () {
	this.ship.fuel = 0;
}