Back to Index Page generated: Jul 7, 2025, 3:56:16 AM

Expansion SW Economy

Content

Warnings

  1. Required Expansions mismatch between OXP Manifest and Expansion Manager at character position 0071 (DIGIT ZERO vs LATIN SMALL LETTER N)
  2. No version in dependency reference to oolite.oxp.phkb.MarketScriptInterface:null
  3. Unknown key 'conflicts_oxps' at https://wiki.alioth.net/img_auth.php/e/ec/SW_Economy_3.10.oxz!manifest.plist

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.10 3.10
Tags economy economy
Required Oolite Version
Maximum Oolite Version
Required Expansions
  • oolite.oxp.phkb.MarketScriptInterface:0
  • oolite.oxp.phkb.MarketScriptInterface:
  • Optional Expansions
    Conflict Expansions
    Information URL https://wiki.alioth.net/index.php/SW_Economy n/a
    Download URL https://wiki.alioth.net/img_auth.php/e/ec/SW_Economy_3.10.oxz n/a
    License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
    File Size n/a
    Upload date 1748818264

    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
    
    phkb's Tweak
    ============
    The problem with changing market information in the shipExitedWitchspace function, is that any code that tries to read sample commodity information from another system will not have those changes applied. So, estimating the potential cost/benefit of a particular cargo run becomes impossible.
    
    This tweak moves the market changes to be inside the market definition, making all the changes visible for any system, at any time.
    
    At the same time, at the prompting of Cholmondely, some tweaks were made to the "harsh mining" systems (ie. systems with archaic tech and planet radii below 5425km). Rather than completely wiping out all agriculture-related commodities, instead we reduce the quantities available. The amount they are reduced by is tweakable via settings.
    
    Coupled with this, is a small boost to the amount of mining goods available at those systems, and a small discount on the prices of those goods. How much these are changed is configurable via settings.
    
    And to make access to those settings easier, an interface into Library Config was provided.
    
    --------------------------------------------------------------
    
    Version history:
    
    01.06.2025 - Version 3.10   (phkb) Moved all text into missiontext.plist for easier localisation.
    							Incorporated the XenonUI SW Economy Addon into this OXP, so a secondary download is not required.
    							Added ability to tweak price of medicine and oxygen on harsh mining worlds.
    11.03.2024 - Version 3.9.1	(phkb) Tweaked mining systems to fill their intended roll.
    							Fixed issues with displaying "(m)" for mining worlds on F6 screen.
    02.09.2023 - Version 3.9	(phkb) Switched to using MarketScriptInterface, and implementing changes at the commodity level, rather than using
    							the shipExitedWitchspace world event. The benefit is that other internal functions to calculate market prices
    							will now have all the logic applied.
    							Added the option to tweak the changes via Library config.
    							Further tweaks to mining worlds, boosting price of agricultural products. Also added an indicator to the chart
    							screen to indicate which systems are categorised as Mining.
    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, phkb";
    this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
    this.description = "Script for selecting market preset";
    this.version = "3.10";
    
    /*
        Tweaked by phkb
        All tweaks selectable/configurable via Library Config.
    */
    
    // controlling prices/quantity of goods in harsh mining worlds (tl < 4, radius < 54250)
    this._harshMining = {
        price_discount_factor: 3.0, // increase this value to make the price discount of mining goods greater
        quantity_increase_factor: 4.5, // increase this value to make the quantity boost of mining goods factor greater
        food_price_factor: 2.0, // increase this value to boost the price of food
        textiles_price_factor: 2.0, // increase this value to boost the price of textiles
        liquor_price_factor: 2.0, // increase this value to boost the price of liquor/wines
        furs_price_factor: 1.5, // increase this value to boost the price of furs
        medicine_price_factor: 2.0, // increase this value to boost the price of medicine
        oxygen_price_factor: 3.0, // increase this value to boost the price of oxygen
    };
    
    // Note: when changing settings that impact the current system, the change won't be seen until you jump out and back in again.
    this._sweConfig = {
        Name: this.name,
        Alias: expandMissionText("sweconomy_config_alias"),
        Display: expandMissionText("sweconomy_config_display"),
        Alive: "_sweConfig",
        SInt: {
            S0: { Name: "_harshMining.price_discount_factor", Def: 3.0, Float: 1, Min: 1.0, Max: 10.0, Desc: expandMissionText("sweconomy_mining_discount") },
            S1: { Name: "_harshMining.quantity_increase_factor", Def: 4.5, Float: 1, Min: 1.0, Max: 10.0, Desc: expandMissionText("sweconomy_mining_quantity") },
            S2: { Name: "_harshMining.food_price_factor", Def: 2.0, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_food") },
            S3: { Name: "_harshMining.textiles_price_factor", Def: 2.0, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_textiles") },
            S4: { Name: "_harshMining.liquor_price_factor", Def: 2.0, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_liquor") },
            S5: { Name: "_harshMining.furs_price_factor", Def: 1.5, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_furs") },
            S6: { Name: "_harshMining.medicine_price_factor", Def: 2.0, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_medicine") },
            S7: { Name: "_harshMining.oxygen_price_factor", Def: 3.0, Float: 1, Min: 0.1, Max: 5, Desc: expandMissionText("sweconomy_mining_oxygen") },
            Info: expandMissionText("sweconomy_sint_info")
        }
    };
    
    this._miningWorlds = [];
    this._labelsOn = false;
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUp = function () {
        if (missionVariables.SWEconomy_HarshMining) this._harshMining = JSON.parse(missionVariables.SWEconomy_HarshMining);
    
        if (this._harshMining.hasOwnProperty("food_price_factor") == false) {
            this._harshMining.food_price_factor = 2.0;
            this._harshMining.textiles_price_factor = 2.0;
            this._harshMining.liquor_price_factor = 2.0;
            this._harshMining.furs_price_factor = 1.5;
        }
        if (this._harshMining.hasOwnProperty("medicine_price_factor") == false) {
            this._harshMining.medicine_price_factor = 2.0;
            this._harshMining.oxygen_price_factor = 3.0;
        }
    
        if (worldScripts.Lib_Config) worldScripts.Lib_Config._registerSet(this._sweConfig);
    
        var msi = worldScripts.MarketScriptInterface_Main;
        msi.$addMarketInterface("tradegoods_general", "$updateGeneralCommodityDefinition", this.name);
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUpComplete = function () {
        this.playerEnteredNewGalaxy();
    
        var xui = worldScripts.XenonUI;
        if (!xui) return;
        xui.$setF6OverlayLookup("economy", this.name, "$returnF6EconomyOverlay");
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.playerWillSaveGame = function () {
        missionVariables.SWEconomy_HarshMining = JSON.stringify(this._harshMining);
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.playerEnteredNewGalaxy = function () {
        this._miningWorlds.length = 0;
        for (var i = 0; i <= 255; i++) {
            var sys = System.infoForSystem(galaxyNumber, i);
            if (sys.techlevel < 4 && sys.radius < 5425) {
                this._miningWorlds.push(i);
            }
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.guiScreenWillChange = function (to, from) {
        // try to turn the labels off before we get to these screens
        if (to == "GUI_SCREEN_STATUS" || to == "GUI_SCREEN_SYSTEM_DATA") {
            if (this._labelsOn) this.$hideMiningLabels();
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.guiScreenChanged = function (to, from) {
        if ((to == "GUI_SCREEN_LONG_RANGE_CHART" || to == "GUI_SCREEN_SHORT_RANGE_CHART") && this._labelsOn == false) {
            this.$showMiningLabels();
        }
        if (to != "GUI_SCREEN_LONG_RANGE_CHART" && to != "GUI_SCREEN_SHORT_RANGE_CHART" && this._labelsOn == true) {
            this.$hideMiningLabels();
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$showMiningLabels = function () {
        this._labelsOn = true;
        for (var i = 0; i < this._miningWorlds.length; i++) {
            var s = System.infoForSystem(galaxyNumber, this._miningWorlds[i]);
            s.name = s.name + expandMissionText("sweconomy_mark_mining");
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$hideMiningLabels = function () {
        for (var i = 0; i < this._miningWorlds.length; i++) {
            var s = System.infoForSystem(galaxyNumber, this._miningWorlds[i]);
            s.name = null; // reset to default
        }
        this._labelsOn = false;
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$updateGeneralCommodityDefinition = function (goodDefinition, station, systemID) {
        // does this system have any commodities that need adjusting?
    
        // only do this when the station parameter is null ie. system level
        // otherwise we would rerun the functions twice for the main station
        if (systemID && systemID != -1 && station == null) {
            var sys = System.infoForSystem(galaxyNumber, systemID);
            var industry_adjust = (25000 + sys.productivity) / 50000; // production of industrial goods vs GNP scaling
            var agro_adjust = (10000 + sys.productivity) / 25000; // production of agro goods vs GNP scaling
    
            if ((sys.techlevel + 2 * sys.government) > 12) { // illegal goods prohibited in (tech OR social) advanced worlds
                switch (goodDefinition.key) {
                    case "firearms":
                    case "slaves":
                    case "narcotics":
                        goodDefinition.quantity = 0;
                        break;
                }
            }
    
            if (sys.economy > 4) { // items unavailable in agrarian worlds
                switch (goodDefinition.key) {
                    case "computers":
                    case "machinery":
                    case "alloys":
                        goodDefinition.quantity = 0;
                        break;
                }
            }
    
            if (sys.economy < 3) { // items unavailable in industrial worlds
                switch (goodDefinition.key) {
                    case "food":
                    case "textiles":
                    case "liquor_wines":
                    case "furs":
                        goodDefinition.quantity = 0;
                        break;
                }
            }
    
            if (sys.techlevel < 4 && sys.radius < 5425) { // too harsh conditions to produce much by archaic methods
                switch (goodDefinition.key) {
                    case "food":
                    case "textiles":
                    case "liquor_wines":
                    case "furs":
                    case "medicine":
                    case "oxygen":
                        // reduce quantity
                        goodDefinition.quantity = 0; //parseInt(goodDefinition.quantity / this._harshMining.agri_quantity_reductor);
                        // increase prices
                        var factor = 1.0;
                        if (goodDefinition.key == "food") factor = this._harshMining.food_price_factor;
                        if (goodDefinition.key == "textiles") factor = this._harshMining.textiles_price_factor;
                        if (goodDefinition.key == "liquor_wines") factor = this._harshMining.liquor_price_factor;
                        if (goodDefinition.key == "furs") factor = this._harshMining.furs_price_factor;
                        if (goodDefinition.key == "medicine") factor = this._harshMining.medicine_price_factor;
                        if (goodDefinition.key == "oxygen") factor = this._harshMining.oxygen_price_factor;
                        // adjust this factor based on the underlying economy for the system
                        // eco 6 generally have slightly higher prices, so we don't want to increase those prices
                        // as much as we do for eco 7
                        factor = factor * (sys.economy / 7);
                        goodDefinition.price *= factor;
                        break;
                }
                if (goodDefinition.classes.indexOf("oolite-mining") >= 0) {
                    // bump mining goods by factors relating to TL/radius/productivity
                    // productivity plays the biggest role
                    //log(this.name, "pre: " + goodDefinition.key + " price = " + goodDefinition.price + ", amt = " + goodDefinition.quantity);
                    var prod_factor = (((sys.productivity / 4500) * 4 + (sys.techlevel / 3) + (sys.radius / 4500)) / 100) * this._harshMining.quantity_increase_factor;
                    var price_factor = (((sys.productivity / 4500) * 3 + (sys.techlevel / 3) + (sys.radius / 4500)) / 100) * this._harshMining.price_discount_factor;
                    //log(this.name, "prod = " + sys.productivity + ", tl = " + sys.techlevel + ", radius = " + sys.radius);
                    //log(this.name, "prod_factor = " + prod_factor + ", price_factor = " + price_factor);
                    var amt = goodDefinition.quantity;
                    goodDefinition.quantity = parseInt(amt + amt * prod_factor);
                    var price = goodDefinition.price;
                    goodDefinition.price = parseInt(price - price * price_factor);
                    //log(this.name, "post: " + goodDefinition.key + " price = " + goodDefinition.price + ", amt = " + goodDefinition.quantity);
                }
            }
    
            if ((sys.economy > 2) && (sys.techlevel > 3)) { // items available only in archaic tech OR industrial worlds    
                switch (goodDefinition.key) {
                    case "minerals":
                    case "radioactives":
                        goodDefinition.quantity = 0;
                        break;
                }
            }
    
            if (sys.techlevel < 7) { // items unavailable below median tech limit
                switch (goodDefinition.key) {
                    case "computers":
                    case "medicine":
                    case "luxuries":
                        goodDefinition.quantity = 0;
                        break;
                }
            } else {
                if (goodDefinition.key == "computers") goodDefinition.quantity = Math.floor(goodDefinition.quantity * industry_adjust);
                if (goodDefinition.key == "medicine") goodDefinition.quantity = Math.floor(goodDefinition.quantity * agro_adjust);
                if (goodDefinition.key == "luxuries") goodDefinition.quantity = Math.floor(goodDefinition.quantity * industry_adjust);
            }
    
            if (sys.techlevel < 4) { // items unavailable in archaic tech worlds
                switch (goodDefinition.key) {
                    case "machinery":
                    case "alloys":
                    case "oxygen":
                        goodDefinition.quantity = 0;
                }
            } else {
                switch (goodDefinition.key) {
                    case "machinery":
                    case "alloys":
                    case "oxygen":
                        goodDefinition.quantity = Math.floor(goodDefinition.quantity * industry_adjust);
                }
            }
    
            // low tech production, but needs some investments 
            switch (goodDefinition.key) {
                case "liquor_wines":
                case "furs":
                    goodDefinition.quantity = Math.floor(goodDefinition.quantity * agro_adjust);
                    break;
            }
        }
    
        return goodDefinition;
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$returnF6EconomyOverlay = function(ratio, font) {
        return "f6-overlay-sw-economy_" + ratio + "_" + font + ".png";
    }