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

Expansion Bigships

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Additional populator for adding big ships to systems Additional populator for adding big ships to systems
Identifier oolite.oxp.Thargoid.Bigships oolite.oxp.Thargoid.Bigships
Title Bigships Bigships
Category Mechanics Mechanics
Author Thargoid and Eric Walch Thargoid and Eric Walch
Version 1.4 1.4
Tags ships ships
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL https://wiki.alioth.net/index.php/BigShips_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/6/61/BigShips_1.4.oxz n/a
License Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file
File Size n/a
Upload date 1700567159

Documentation

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

BigShips v1.3 Readme & License.txt

BigTrader v1.3 by Thargoid and Eric Walch

This OXP by itself does not add any new ships to the game. What it does do is enable the role "bigTrader", which can be used by other creators of ship OXPs whose vessels should act with a trader-type role but are too large to launch from and dock through a standard station docking slit.

Included in the OXP is a populator script which selectively adds ships with the bigTrader role to the system, plus an AI bigTrader_route1BigTraderAI.plist which is available for use in place of the normal route1TraderAI.plist for the ships. The second AI bigShips_traderInterceptAI.plist is a sub-AI for it.

It is envisaged that the OXP of the large ships should include the zip file of this OXP (only 5KB in size) and instructions that it too should be installed on the users system if they do not already have it in place.

The main reason for using this generic populator instead of a custom one is to avoid overpopulation of a system. When every oxp with bigTraders would use its own addition script, it would mean that if you have 10 of such oxp's installed, you would also see 10 times as much of those ships in the system. With this generic populator you just get more variation when adding more oxp's with such big traders.

For programmers only:
To check in JS if the populator is loaded, use if(worldScripts["bigShips_populator"]) , which will be true if it is present. This way your script knows if the player has installed the oxp. If not, you can act upon it. e.g. by giving a warning or do the population by yourself.

--------------------------------------------------------------

License:

This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with the following clauses:

* Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP, the usage must be distinct from that within this OXP. Unique identifiers such as (but not limited to) unique shipdata.plist entity keys, mission variables, script names (this.name), equipment identity strings (EQ_), description list arrays and entity roles must not be re-used without prior agreement. Basically if it's unique or would identify or overwrite anything in the original OXP, then you may not re-use it (for obvious compatibility reasons).
* rebundling of this OXP within another distribution is permitted as long as it is unchanged. It is preferred that it is bundled whole as its zip file.
* The license information must be included in the OXP.
* Even though it is not compulsory, if you are re-using any sizable or recognisable piece of this OXP, please let me know :)

--------------------------------------------------------------

Versions:

1.0.0 - Original release.
1.0.1 - Added docking acceptance function to AI, for big traders with docking ports.
1.0.2 - Amended script to stop spawning in systems going or gone nova.
1.3   - Switched to using new populator routines. Added role-categories.plist file to replace pirate-victim-roles.plist.
        Added Library Config option to control the maximum number of traders spawned.
1.4   - Fixed issue with not saving max number of traders setting.

Equipment

This expansion declares no equipment.

Ships

Name
bigShips_anaconda

Models

This expansion declares no models.

Scripts

Path
Scripts/bigShips_populator.js
"use strict";
this.name = "bigShips_populator";
this.author = "Thargoid & Eric Walch";
this.copyright = "Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license.";
this.description = "Populator for generic big ships facilitator OXP.";
this.version = "1.3";

this._maxBigTraders = 2;
this._debug = true;
/*
	The main reason for using this generic populator instead of a custom one is to avoid overpopulation of a system. 
	When every oxp with bigTraders would use its own addition script, it would mean that if you have 10 of such oxp's 
	installed, you would also see 10 times as much of those ships in the system. With this generic populator you just 
	get more variation when adding more oxp's with such big traders.

	For programmers only:
	To check in JS if the populator is loaded, use if(worldScripts["bigShips_populator"]) , which will be true if it 
	is present. This way your script knows if the player has installed the oxp. If not, you can act upon it. e.g. by 
	giving a warning or do the population by yourself. 
*/

// configuration settings for use in Lib_Config
this._bigShipsConfig = {Name:this.name, Alias:"Big Ships Populator", Display:"Config", Alive:"_bigShipsConfig",
	Bool: {
		B0: {Name:"_debug", Def:false, Desc: "Debug messages"},
		Info:"0 - Turn debug messages on/off"},
    SInt: {
        S0:{Name:"_maxBigTraders", Def:2, Min:0, Max:5, Desc:"Max big traders"},
        Info:"0 - Maximum number of big trader ships to spawn"},
};

//-------------------------------------------------------------------------------------------------------------
this.startUp = function() {
	// register our settings, if Lib_Config is present
    if (worldScripts.Lib_Config) worldScripts.Lib_Config._registerSet(this._bigShipsConfig);
	if (missionVariables.BigShips_MaxTraders) this._maxBigTraders = parseInt(missionVariables.BigShips_MaxTraders);
}

//-------------------------------------------------------------------------------------------------------------
this.playerWillSaveGame = function() {
	missionVariables.BigShips_MaxTraders = this._maxBigTraders;
}

//-------------------------------------------------------------------------------------------------------------
this.systemWillPopulate = function () {
	if (!system.isInterstellarSpace && !system.sun.isGoingNova && !system.sun.hasGoneNova) {
		var productivity = system.productivity;
		var radius = system.mainPlanet.radius;
		var bigTraderCount = 0
		for (var loopCount = 0; loopCount < 5; loopCount++) {
			// 56320 is maximum possible value of productivity.
			if (productivity > ((Math.random() * 56320) + (bigTraderCount * 5000)) && radius > Math.random() * 70E3) {
				//system.legacy_addShipsWithinRadius("bigTrader", 1, "pwu", [0, 0, (Math.random() * 0.7) + 0.2], radius*0.5);
				system.setPopulator("bigTrader-" + loopCount, {
					location: "COORDINATES",
					coordinates: Vector3D(0, 0, (Math.random() * 0.7) + 0.2).fromCoordinateSystem("pwu"),
					callback: function (pos) {
						var bt = system.addShips("bigTrader", 1, pos, radius * 0.5);
					}
				});
				++bigTraderCount
				if (bigTraderCount >= this._maxBigTraders) break;
			}
		}
		if(this._debug) log(this.name, bigTraderCount + " big trader(s) added to the " + system.name + " system.");
	}
}