Back to Index Page generated: Dec 1, 2024, 3:15:25 AM

Expansion SW Economy

Content

Warnings

  1. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description New rebalanced set of market rules is implemented. Three new trade items declared: fresh water, oxygen and medicine. New rebalanced set of market rules is implemented. Three new trade items declared: fresh water, oxygen and medicine.
Identifier oolite.oxp.stranger.SW_Economy oolite.oxp.stranger.SW_Economy
Title SW Economy SW Economy
Category Mechanics Mechanics
Author stranger stranger
Version 3.8.0 3.8.0
Tags economy economy
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/4/44/SW_Economy.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1610873286

Documentation

Also read http://wiki.alioth.net/index.php/SW%20Economy

ReadMe & License.txt

SW Economy by Stranger

This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license.
You are free to use and distribute this OXP on non-commercial basis. 
Rebundling of this OXP within another distribution is permitted as long as it is unchanged.
Any mods/derivatives of this OXP must be distributed under another names.
The license information (either as this file or merged into a larger one) must be included in the OXP.

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

This OXZ was originally part of bundled OXP, containing six main packages:

� SW Economy
� SW Equipment
� SW Shipdata
� SW Population
� SW Resident Filter
� (e)Xternal OXP tweaks

Since version 3.8 these OXPs are separated and presented as individual packages in OXZ format.

*****

First, this OXP changes canonic descriptor of system economy (text string Poor Agricultural, for example, used only to display on F7 system info screen, Oolite uses for market calculations numeric value system.economy = 7).
New economic classification implemented:

Poor Agricultural	->	Extreme Agricultural
Average Agricultural	->	Strong Agricultural
Rich Agricultural	->	Common Agricultural
Mainly Agricultural	->	Mainly Agricultural
Mainly Industrial	->	Mainly Industrial
Poor Industrial		->	Common Industrial
Average Industrial	->	Strong Industrial
Rich Industrial		->	Extreme Industrial

It also describes three new trade items: fresh water, oxygen and medicine.
New rebalanced set of market rules is implemented. Most items has the same economic values with rebalanced properties, but price for some items (food, textile, slaves) readjusted.
Quantity of luxuries and narcotics is redefined in kg, not tons.

SW Economy set system market with system-specific filters:

	� Computers, machinery and alloys are not available in agrarian systems
	� Food, textiles, wines and furs are not available in industrial systems
	� Food, textiles, wines and furs are not available in agricultural systems with archaic TL AND main planet radius below 5425 km
	� Computers, medicine and luxuries available only in systems above median tech level, quantity is limited
	� Machinery, alloys and oxygen available only in systems above low tech level
	� Minerals and radioactive available only in low-tech OR industrial systems
	� Machinery is more profitable in comparison with default market
	� Textiles are more profitable in comparison with default market
	� Quantity of some items depends of system gross productivity
	� Illegal items available only in low-tech unstable systems
	� and some more readjustments

Modified spara's In-System Market Restore script included to provide saving of market with additional items (fresh water, oxygen and medicine). Modifications includes adding extra items and changing item order in commodity array.

SW Economy set also new market definitions for secondary ports, overriding market definitions in external packages:

Anarchies
	� Salvage Gang
	� Hackers Outpost
	� Renegade Station
Commies
	� Astrogulag Penal Colony
	� CZGF
	� SLAPU
Dictators
	� Astrofactory
Galactic Navy
	� Navy Station
Deep Space Dredgers
	� Dredgers

These original OXPs has scripts, emulating obsolete market definition using commodities.plist (was replaced with trade-goods.plist since Oolite 1.82). These scripts can override SW Economy market definitions for secondary ports, but in worst case you'll just have emulated old markets. Not conflicting with SW Economy model, just unbalanced with my altered prices.

Known issues

New economic rules will activates only AFTER first hyperjump to new system. Starting as new pilot on Lave you'll have F8 screen with old goods list and with old price/quantity settings. This is intentionally decision. There are possible multiple events like departing from station(s) or docking with station(s) staying in system, but only one event of entering this system. So it is safe to set market for system at arrival once to avoid recurring loops. New market state will be stored in your first save in new system.

After installing this OXP you'll can't get new market rules until you'll leave your current system, so playing custom scenario using ship, not equipped with hyperdrive (such Bushmaster in Advanced miner scenario), you'll have vanilla market. Lave is not suitable system for mining business and it is wise to leave Lave ASAP taking advice to use wormhole of friendly trader ship. After arriving to new system you'll have new economy. But if you'll install this OXP after entering new system, having ship without hyperdrive you'll get stuck in vanilla market until you'll find way to leave this system.

Starting new pilot is good idea in any case, but I think it is not obligatory. Hope it is safe to try new rules having existent saves, but I recommend to backup your current save.

If you'll decide to uninstall this OXP it is good to sell all extra goods (fresh water, oxygen and medicine) first. Extra goods will remain in system market, generating error message in log, but this issue will be fixed after entering new system.

Be careful with luxuries and narcotics! Having 50 kg of luxuries on 10-ton Cobra Mk I is safe, but deinstalling this OXP you'll convert this 50 kg to 50 tons and lose extra 40 tons of these items!

As I already mentioned scripts for secondary ports in original OXPs defines goods quantities using vanilla rules, so I'll be grateful to you for feedback.

Changed economy descriptions will not affect any Oolite scripts. Text string Extreme Agricultural, for example, used only to display on F7 system info screen, Oolite uses for market calculations numeric value system.economy = 7.

Enjoy!

Credits:
In-System Market Restore (author spara)
Anarchies (authors Commander McLane, Killer Wolf, Arexack Heretic, Eric Walch, spara, Norby, phkb and Griff)
Commies (authors Amaranth, Dr. Nil, Eric Walch, Norby, phkb)
Dictators (authors Ramirez, gsagostinho, phkb, Griff)
Galactic Navy (author Nemoricus)
Deep Space Dredger (authors Sabre, Eric Walch, Little Bear, Captain Berf)
Seven - detecting error in trade-goods.plist

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

Version history:

16.01.2021 - Version 3.8	Bundled OXP Stranger's Set reassembled in OXZ format as separate packs.
09.07.2020 - Version 3.7	Minimal planet radius for food, textiles, wines and furs production increased from 5200 to 5425 km.
12.02.2019 - Version 3.6	Fixed error in trade-goods.plist, description of firearms. Thanks, Seven!
18.08.2018 - Version 3.5	Food, textiles, wines and furs are not available in agricultural systems with main planet radius below 5200 km.
31.03.2018 - Version 3.4	Pulse laser is excluded from legal census to provide compatibility to Hard Eject OXP.
08.11.2017 - Version 3.3	Forward/aft shield ratio reverted to original 1:1 value.
06.11.2017 - Version 3.2	Improved economic rules.
				Fixed conflict with secondary markets.
				Description of secondary markets is transferred from obsolete eXternal Market Tweaks onto SW Economy package.
19.08.2017 - Version 3.1	Some readjusted player's ship specs resets to standard again.
				SW Shipdata is added as separate module.
				Injector speed factor and fuel burn rate readjusting for player and NPS ships transferred from Hard Way to Stranger Set bundle OXP.
06.07.2016 - Version 3.0	Modified In-System Market Restore script integrated into SW Economy package.
12.01.2016 - Version 2.9	Ship hull class hidden on F5 screen.
23.12.2015 - Version 2.8	Orbital Shuttle and Transporter max cargo load decreased to more realistic value.
23.10.2015 - Version 2.7	Equipment availability realised via script. Obsolete condition definitions removed.
				Script shipclassequip.js refined. Problem with ships without hyperspace capability fixed.
18.09.2015 - Version 2.6	Dredger market really fixed :-)
16.09.2015 - Version 2.5	Laser upgrade and missile re-arm available on main station only. 
15.09.2015 - Version 2.4	Fixed compatibility issue with Ore Processor 2.2.1 OXZ.
				Large Cargo Bay price reduced from 5000 to 2500 Cr.
11.09.2015 - Version 2.3	Fixed error in dredger market definition.
08.09.2015 - Version 2.2	Added brief descriptions of goods.
				Trumble opinion readjusted.
13.08.2015 - Version 2.1	Luxuries measured in kg, not tons.
				Escape Capsule cost reduced to 1000 Cr.
				Minor changes in market script.
10.08.2015 - Version 2.0	Equipment.plist moved from SW Economy to new SW Equipment OXP.
				Ship classes implemented based on hull size. Some equipment can't be installed on any ship.
				Some player's ship specs depends on hull size, max speed and energy recharge rate.
				Ship readjustments transferred to SW Equipment. SW TCS removed from bundle.
01.08.2015 - Version 1.9	Rebalanced core ship specs (test version). 
04.07.2015 - Version 1.8	External markets adjustments (more realistic profit from metals in case of dredgers for example).
27.06.2015 - Version 1.7	Market filter now covers more items.
19.06.2015 - Version 1.6	Bundle package completely reassembled.
				Markets completely redefined and converted onto Oolite 1.82 format.
				Yaw damper removed from shipdata-overrides.plist (it is realized via script in Warp Drive OXP!).
16.09.2014 - Version 1.5	Equipment.plist and shipdata-overrides.plist refined.
				Asp Mk II max roll speed increased.
05.09.2014 - Version 1.4	Price for standard and ECM-hardened missiles readjusted to improve compatibility with Missile Tweak OXP.
18.06.2014 - Version 1.3	Old readjusted ship roles and most readjusted ship specs (based on Switeck's Shipping OXP) removed from shipdata-overrides plist
				to accommodate new ship role system in Oolite 1.79.
03.06.2014 - Version 1.2	Price for Large Cargo Bay increased to 5000 Cr.
12.03.2014 - version 1.1	Fixed bug in market_tweak.js - interstellar space test.
19.11.2013 - version 1.0	Minor changes in shipdata-overrides.plist. Speeds of NPCs Cobra Mk I and Viper readjusted.
				Stranger's Tweak OXP incorporated into bundled Stranger's World package.
15.11.2013 - version 0.9	Slavery is prohibited in all ports of advanced worlds (planet ports also!).
09.07.2013 - version 0.8	Minor change in market_tweak.js. Availability of illegal goods on market depends on (tech level + government) value
				(more advanced political system has more strong market regulations).
08.06.2013 - version 0.7	Yaw damper is added to shipdata-overrides.plist (Only for Oolite basic ships!)
14.05.2013 - version 0.6	Syntax errors in shipdata-overrides.plist are corrected.
				Cobra Mk I HUD set to "hud.plist" instead "hud-small.plist" for compatibility with Gravity Well OXP.
21.03.2013 - version 0.5	Tech level availability for ECM-hardened missiles reduced from 12 to 10.
				Bug in Cobra Mk III and Python max_cargo is fixed.
22.01.2013 - Version 0.4	Added legal census for equipment availability.
				Fuel cost reduced from 10 Cr/LY to 5 Cr/LY.
15.01.2013 - Version 0.3	Script optimization.
12.01.2013 - Version 0.2	Script rewritten for Oolite 1.77
22.12.2012 - Version 0.1	Public release - compatible with Oolite 1.76.

Equipment

This expansion declares no equipment. This may be related to warnings.

Ships

This expansion declares no ships. This may be related to warnings.

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/market_restore.js
"use strict";
this.name           = "in_system_market_restore";
this.author         = "spara & Stranger";
this.copyright      = "2013 Mika Spåra, 2015 Stranger";
this.description    = "Remember and restore non main station prices and quantities. Modified by Stranger to adopt extra trade items.";
this.version        = "1.2.1";
this.licence    	= "CC BY-NC-SA 3.0";

//1.1 save every market on save and restore when spawning. now it's fully compatible with market inquirer.

this.startUp = function() {
	if (missionVariables.marketRestorePrimaryRoles) {
		this.$primaryRoles = JSON.parse(missionVariables.marketRestorePrimaryRoles);
		this.$markets = JSON.parse(missionVariables.marketRestoreMarkets);
	}
	else {
		this.$primaryRoles = new Array();
		this.$markets = new Array();
		delete this.shipSpawned;
	}
}

//restore market when station is spawned
this.shipSpawned = function(ship) {
	if (ship.isStation) {
		var index = this.$primaryRoles.indexOf(ship.primaryRole);
		if (index !== -1) {
			var commodities  = ["food","textiles","liquor_wines","furs","medicine","luxuries","alloys","machinery","computers","water","oxygen","minerals","radioactives","gold","platinum","gem_stones","alien_items","slaves","narcotics","firearms"];		
			var market = this.$markets.splice(index, 1)[0];
			var i, commodity;
			for (i = 0; i < market.length; i++) {
				commodity = commodities[i];
				ship.setMarketQuantity(commodity, market[i][0]);
				ship.setMarketPrice(commodity, market[i][1]);
			}
			this.$primaryRoles.splice(index, 1);
		}		
	}
}

//wipe everything when leaving system
this.shipWillEnterWitchSpace = function() {
	this.$primaryRoles = new Array();
	this.$markets = new Array();
	delete this.shipSpawned;
}

//save primaryRoles and markets (prices and quantities) of all stationary stations
this.playerWillSaveGame = function() {
	function stations(entity) {return (entity.isStation && !entity.isMainStation && !entity.maxSpeed)};
	var i, j, station, commodity;
	var stationMarket = new Array();
	var primaryRoles = this.$primaryRoles.concat();
	var markets = this.$markets.concat();
	var commodities  = ["food","textiles","liquor_wines","furs","medicine","luxuries","alloys","machinery","computers","water","oxygen","minerals","radioactives","gold","platinum","gem_stones","alien_items","slaves","narcotics","firearms"];	
	var oxpStations = system.filteredEntities(this, stations, player.ship);
	for (i = 0; i < oxpStations.length; i++) {
		station = oxpStations[i];
		primaryRoles.push(station.primaryRole);
		stationMarket = new Array();
		for (j = 0; j < commodities.length; j++) {
			commodity = commodities[j];
			stationMarket.push([station.market[commodity].quantity, station.market[commodity].price]);
		}
		markets.push(stationMarket);
	}
	if (primaryRoles.length > 0) {
		missionVariables.marketRestorePrimaryRoles = JSON.stringify(primaryRoles);
		missionVariables.marketRestoreMarkets = JSON.stringify(markets);
	}
	else {
		delete missionVariables.marketRestorePrimaryRoles;
		delete missionVariables.marketRestoreMarkets;
	}
}
Scripts/market_tweak.js
"use strict";
this.name				= "market_tweak.js";
this.author				= "Stranger";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for selecting market preset";
this.version				= "3.7";

this.startUp = function()
{
	//log(this.name, "this OXP initialising!");
}

this.shipExitedWitchspace = function()                      // Welcome to system!

    {
    if (system.isInterstellarSpace) return;                 // oops... we have a problem with navigation

    var industry_adjust = (25000 + system.productivity) / 50000; // production of industrial goods vs GNP scaling
    var agro_adjust = (10000 + system.productivity) / 25000; // production of agro goods vs GNP scaling
    var goods_store;

	if((system.techLevel + 2 * system.government) > 12)     // illegal goods prohibited in (tech OR social) advanced worlds
        {
        system.mainStation.setMarketQuantity("slaves", 0);
        system.mainStation.setMarketQuantity("narcotics", 0);
        system.mainStation.setMarketQuantity("firearms", 0); 
        }
        
	if(system.economy > 4)                                  // items unavailable in agrarian worlds    
        {
        system.mainStation.setMarketQuantity("computers", 0);
        system.mainStation.setMarketQuantity("machinery", 0);
        system.mainStation.setMarketQuantity("alloys", 0);        
        }

	if(system.economy < 3)  // items unavailable in industrial worlds
        {
        system.mainStation.setMarketQuantity("food", 0);
        system.mainStation.setMarketQuantity("textiles", 0);               
        system.mainStation.setMarketQuantity("liquor_wines", 0);
        system.mainStation.setMarketQuantity("furs", 0);
        }

    if(system.techLevel < 4 && system.mainPlanet.radius < 54250)    // too harsh conditions to produce by archaic methods
        {
        system.mainStation.setMarketQuantity("food", 0);
        system.mainStation.setMarketQuantity("textiles", 0);               
        system.mainStation.setMarketQuantity("liquor_wines", 0);
        system.mainStation.setMarketQuantity("furs", 0);        
        }

	if((system.economy > 2) && (system.techLevel > 3))      // items available only in archaic tech OR industrial worlds    
        {
        system.mainStation.setMarketQuantity("minerals", 0);
        system.mainStation.setMarketQuantity("radioactives", 0);        
        }

    if(system.techLevel < 7)                               // items unavailable below median tech limit
        {
        system.mainStation.setMarketQuantity("computers", 0);
        system.mainStation.setMarketQuantity("medicine", 0);
        system.mainStation.setMarketQuantity("luxuries", 0);                
        }
    else
        {
        goods_store = Math.floor(system.mainStation.market.computers.quantity * industry_adjust);
        system.mainStation.setMarketQuantity("computers", goods_store);
        goods_store = Math.floor(system.mainStation.market.medicine.quantity * agro_adjust);
        system.mainStation.setMarketQuantity("medicine", goods_store);
        goods_store = Math.floor(system.mainStation.market.luxuries.quantity * industry_adjust);
        system.mainStation.setMarketQuantity("luxuries", goods_store);
        }
 
    if(system.techLevel < 4)                                // items unavailable in archaic tech worlds
        {
        system.mainStation.setMarketQuantity("machinery", 0);
        system.mainStation.setMarketQuantity("alloys", 0);
        system.mainStation.setMarketQuantity("oxygen", 0);
        }        
    else
        {
        goods_store = Math.floor(system.mainStation.market.machinery.quantity * industry_adjust);
        system.mainStation.setMarketQuantity("machinery", goods_store);        
        goods_store = Math.floor(system.mainStation.market.alloys.quantity * industry_adjust);
        system.mainStation.setMarketQuantity("alloys", goods_store);
        goods_store = Math.floor(system.mainStation.market.oxygen.quantity * industry_adjust);
        system.mainStation.setMarketQuantity("oxygen", goods_store);
        }
                                                        // low tech production, but needs some investments 
    goods_store = Math.floor(system.mainStation.market.liquor_wines.quantity * agro_adjust);
    system.mainStation.setMarketQuantity("liquor_wines", goods_store);
    goods_store = Math.floor(system.mainStation.market.furs.quantity * agro_adjust);
    system.mainStation.setMarketQuantity("furs", goods_store);   

    }