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

Expansion Dictators

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds a range of ships and stations to each dictatorship and offers new trading opportunities to players. Adds a range of ships and stations to each dictatorship and offers new trading opportunities to players.
Identifier oolite.oxp.Ramirez.Dictators oolite.oxp.Ramirez.Dictators
Title Dictators Dictators
Category Systems Systems
Author Ramirez, phkb, gsagostinho Ramirez, phkb, gsagostinho
Version 2.7 2.7
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
  • oolite.oxp.spara.ImperialAstrofactory:2.5
  • oolite.oxp.spara.ImperialAstrofactory:2.5
  • Optional Expansions
  • oolite.oxp.Ramirez.FeudalStates:1.16.2
  • oolite.oxp.Ramirez.FeudalStates:1.16.2
  • Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/Dictators_OXP n/a
    Download URL https://wiki.alioth.net/img_auth.php/e/e9/Dictators_2.7.oxz n/a
    License CC BY-NC-SA 3 CC BY-NC-SA 3
    File Size n/a
    Upload date 1716769557

    Documentation

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

    Readme.txt

    Oolite OXP
    Dictators v2.7
    Ramirez, Initial Release July 2011
    
    This OXP is a flavour expansion for the Dictatorship systems, adding various government-specific ships and stations.
    
    Freighter Cargo model from Cargo Wrecks Teaser by Arexack Heretic.
    
    V2.7
    - Removed duplicate and unnecessary models and textures.
    - Removed unnecessary shipdata entries.
    - Moved "Imperial Lictor" into the AstroFactory OXP.
    - Created new freighter cargo model.
    - Added specular maps to all ships.
    - Included spawning routines for AstroFarms.
    - Added "Logistics" freighters that carry food from AstroFarms.
    - Corrected some discrepancies in the police ships.
    - Added settings via Library Config to disable Dictatorship-specific police ships being spawned.
    - Added some ambience action near the witchpoint, and occasionally when docking at the main station in Dictatorship systems.
    
    V2.6
    - Added shiplibrary.plist, so Dictators ships will show up in the Ship Library. With thanks to Cholmondely.
    
    V2.5
    - Added some shipdata entries to provide compatibility with Resistance Commander OXP.
    
    V2.4
    - Added normal map to frieghter.
    - Small corrections to shipdata.plist.
    - Allowed for game to be saved at Astro Factories.
    
    V2.3
    - Corrected errors in shipdata.plist.
    - Small correction to the spawning conditions to prevent prisonships in industrial systems.
    
    V2.2, 31 July 2017 (by phkb and gsagostinho)
    - Updates to shipdata and scripts to better control spawning.
    
    V2.1, 21 July 2017 (by phkb and gsagostinho)
    - added new textures, normal and emission maps to all ships.
    - Moved AstroFactory spawn point to be slightly to the side of the main wp-planet lane.
    
    V2.0, 16 December 2016 (by phkb)
    - Updated scripts and config for current version of Oolite (1.82 and onwards)
    - Updated ship models to use Griff variants.
    - Added code to utilise Station Validator.
    - Made Spara's updated Astrofactory model a requirement for the OXP. The original model is kept for compatibility reasons.
    
    v1.5, 21 July 2011
    - Minor correction to fix inconsistency between script and shipdata regarding spawn conditions for AstroFactories
    
    v1.4, 19 June 2010
    - Updated ship population script for compatibility with Oolite v1.74
    
    v1.3, 31 May 2008
    - Fixed freighter and tanker AI to avoid conflict with station behaviour
    - Minor fixes to ship models
    
    v1.2, 9 February 2007
    - Added Imperial Freighter
    
    v1.1, 30 January 2007
    - Added Imperial Tanker
    - Modified script to prevent appearance of multiple AstroFactories on launch, and tweaked positioning of ships and stations
    
    v1.0, 22 January 2007
    Initial version including:
    - Revolutionary Guards and Junta Enforcers for the agricultural dictatorships
    - Imperial Quaestors, Censors and Lictors for the industrial dictatorships
    - Imperial AstroFarms, located within asteroid fields in the wealthier industrial dictatorships
      and marked as 'F' on the Advanced Space Compass
    - Detailed System Profiles courtesy of GalCop Intelligence
    
    As well as providing some hints on trading opportunities, the System Profiles also give an
    idea of things to come in future versions.
    
    Credits:
    Many thanks to Dr. Nil for the Commies OXP which inspired this expansion, and for additional advice and suggestions.
    Station model and textures by Ramirez, with some use of existing Oolite meshes and base textures.
    Ship models and textures by Griff:
        - Quaestor and Guard are variants of the Viper model from Oolite core.
        - Censor and Enforcer are variants of the Viper Interceptor model from Oolite core.
        - Lictor is a variant of the Viper Pursuit from Oolite core.
        - Prison Ship is a variant of the Anaconda from Oolite core.
        - Freighter and Tanker are "Griff Freighters" from Griff's stalled "Busy Ports" OXP (downloaded from here: https://app.box.com/s/j6zrjibym9).
    Borrowed some code from Blackmonks to create some "ambience" near the witchpoint.
    Config and script updates for 1.82ff compatibility by phkb.
    Sun image from http://simpleicon.com/sunny_3.html
    

    Equipment

    This expansion declares no equipment.

    Ships

    Name
    Imperial AstroFactory
    Freighter Coupling
    Freighter Coupling
    Imperial Censor
    censor_ambience
    Bulk Freighter
    Junta Enforcer
    enforcer_ambience
    factorydock
    Imperial Freighter
    Imperial Freighter
    Imperial Freighter
    Imperial Freighter
    Imperial Freighter
    Imperial Freighter
    Freighter Cargo Bay
    freighter_cargo_blue1
    freighter_cargo_blue2
    freighter_cargo_blue3
    freighter_cargo_blue4
    freighter_cargo_blue5
    freighter_cargo_blue6
    freighter_cargo_green1
    freighter_cargo_green2
    freighter_cargo_green3
    freighter_cargo_green4
    freighter_cargo_green5
    freighter_cargo_green6
    freighter_cargo_red1
    freighter_cargo_red2
    freighter_cargo_red3
    freighter_cargo_red4
    freighter_cargo_red5
    freighter_cargo_red6
    freighter_cargo_template
    Freighter Coupling
    Freighter Engines
    impfreighter
    imptanker
    AutoLoader
    loader_pod
    loader_withcargo
    Revolutionary Logistics
    Revolutionary Logistics
    Revolutionary Logistics
    Revolutionary Logistics
    Revolutionary Logistics
    Revolutionary Logistics
    Prison Ship
    Imperial Quaestor
    Revolutionary Guard
    Imperial Tanker
    Imperial Tanker
    Imperial Tanker
    Imperial Tanker
    Imperial Tanker
    Imperial Tanker

    Models

    This expansion declares no models.

    Scripts

    Path
    Scripts/ambienceAttacker.js
    "use strict";
    this.name = "ambienceAttacker";
    this.description = "script to trigger target pleas";
    
    this.shipAttackedOther = function (other) {
    	if (other.$dictatorsAmbience && Math.random() < 0.1) {
    		other.commsMessage("[ambienceReply]");
    	}
    }
    
    Scripts/astrofactory_market.js
    "use strict";
    this.name = "astrofactory_market";
    this.author = "spara";
    this.copyright = "2014 spara";
    this.license     = "CC BY-NC-SA 4.0";
    
    this.$originalDefs = {
          "food" : [0, 0, 19, -2, 0, 1, 1, 1, 0],
          "textiles" : [0, 0, 12, -1, -1, 5, 3, 3, 0],
          "radioactives" : [0, 0, 65, -3, -3, 2, 7, 7, 0],
          "slaves" : [0, 0, 100, -1, -1, 10, 3, 3, 0],
          "liquor_wines" : [0, 0, 93, -5, -5, 251, 15, 15, 0],
          "luxuries" : [0, 0, 196, 8, 8, 2, 3, 3, 0],
          "narcotics" : [0, 0, 235, 29, 29, 8, 90, 90, 0],
          "computers" : [0, 0, 134, 14, 14, 90, 2, 1, 0],
          "machinery" : [0, 0, 98, 6, 6, 100, 2, 1, 0],
          "alloys" : [0, 0, 90, 1, 1, 2, 31, 31, 0],
          "firearms" : [0, 0, 100, 13, 13, 0, 0, 0, 0],
          "furs" : [0, 0, 20, -9, -9, 0, -1, -1, 0],
          "minerals" : [0, 0, 42, -1, -1, 12, 3, 3, 0],
          "gold" : [0, 0, 107, -1, -1, 5, 20, 20, 1],
          "platinum" : [0, 0, 191, -2, -2, 5, 21, 21, 1],
          "gem_stones" : [0, 0, 55, -1, -1, 250, 15, 15, 2],
          "alien_items" : [0, 0, 10, 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/dictators.js
    "use strict";
    this.name        = "dictators.js";
    this.author      = "Ramirez";
    this.copyright   = "June 2010";
    this.description = "World script for populating dictatorship systems";
    this.version     = "1.2";
    
    this._shipSpawnOverride = false;
    this._settings = {
    	policeShipReplace: true,
    };
    
    this._config = {
    	Name: this.name,
    	Alias: "Dictators",
    	Display: "General settings",
    	Alive: "_config",
    	Bool: {
    		B0: { Name: "_settings.policeShipReplace", Def: true, Desc: "Police are replaced" },
    		Info: "0: Police ships will be replaced by Dictators equivalents."
    	},
    };
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUp = function() {
    	if (missionVariables.Dictators_Settings) {
    		this._settings = JSON.parse(missionVariables.Dictators_Settings);
    	}
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUpComplete = function() {
    	// register our settings, if Lib_Config is present
    	if (worldScripts.Lib_Config) {
    		var lib = worldScripts.Lib_Config;
    		lib._registerSet(this._config);
    	}
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.playerWillSaveGame = function() {
    	missionVariables.Dictators_Settings = JSON.stringify(this._settings);
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.shipWillDockWithStation = function(station) {
    	if (system.government == 3 && station.isMainStation) {
    		if (Math.random() < 0.1) {
    			player.addMessageToArrivalReport(expandDescription("[ambience_arrival]"));
    		}
    	}
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.systemWillPopulate = function() {
    	if (system.government === 3) {
    		var sv = worldScripts.station_validator;
    
    		// astrofactory spawning
    		if (system.economy < 3) {
    			if (system.countShipsWithRole("astrofactory") == 0 && (!sv || (sv.$deaths("dfl_astrofactory").length === 0 && sv.$deaths("dfl_astrofactory2").length === 0))) {
    				var posAF = Vector3D((system.scrambledPseudoRandomNumber(1245) * 0.30 - 0.15), (system.scrambledPseudoRandomNumber(3827) * 0.30 - 0.15), 0.3).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_astrofactory", {
    					location: "COORDINATES",
    					coordinates: posAF,
    					deterministic:true,
    					callback: function(pos) {
    						var rck = system.addShips("asteroid", 30, pos, 40E3);
    						var key = "dfl_astrofactory";
    						if (system.techLevel >= 10) key = "dfl_astrofactory2";
    						var af = system.addShips("[" + key + "]", 1, pos, 0);
    						if (!af || af.length === 0) log("dictators.populator", "OOPS! No astrofactory spawned");
    					}}
    				);
    
    				var posIT1 = Vector3D(0, 0, 0.8).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_imptanker1", {
    					location: "COORDINATES",
    					coordinates: posIT1,
    					callback: function(pos) {
    						var tnk = system.addShips("imptanker", 1, pos, 0);
    						if (!tnk || tnk.length === 0) log("dictators.populator", "OOPS! No imptanker spawned (1)");
    					}}
    				);
    
    				var posIT2 = Vector3D(0, 0, 0.4).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_imptanker2", {
    					location: "COORDINATES",
    					coordinates: posIT2,
    					callback: function(pos) {
    						var tnk = system.addShips("imptanker", 1, pos, 0);
    						if (!tnk || tnk.length === 0) log("dictators.populator", "OOPS! No imptanker spawned (2)");
    					}}
    				);
    
    				var posIF1 = Vector3D(0, 0, 0.3).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_impfreighter1", {
    					location: "COORDINATES",
    					coordinates: posIF1,
    					callback: function(pos) {
    						var frt = system.addShips("impfreighter", 1, pos, 0);
    						if (!frt || frt.length === 0) log("dictators.populator", "OOPS! No impfreighter spawned (1)");
    					}}
    				);
    
    				var posIF2 = Vector3D(0, 0, 0.7).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_impfreighter2", {
    					location: "COORDINATES",
    					coordinates: posIF2,
    					callback: function(pos) {
    						var frt = system.addShips("impfreighter", 1, pos, 0);
    						if (!frt || frt.length === 0) log("dictators.populator", "OOPS! No impfreighter spawned (2)");
    					}}
    				);
    			}
    		}
    		
    		// astrofarm spawning
    		if (system.economy > 4) {
    			if (system.countShipsWithRole("astrofarm") == 0 && (!sv || (sv.$deaths("dfl_astrofarm").length === 0 && sv.$deaths("dfl_astrofarm2").length === 0))) {
    				var posAFM = Vector3D((system.scrambledPseudoRandomNumber(2271) * 0.30 - 0.15), (system.scrambledPseudoRandomNumber(772) * 0.30 - 0.15), 0.3).fromCoordinateSystem("spu");
    				system.setPopulator("dictators_astrofarm", {
    					location: "COORDINATES",
    					coordinates: posAFM,
    					deterministic:true,
    					priority: 200,
    					callback: function(pos) {
    						var key = "dfl_astrofarm";
    						if (system.techLevel >= 6) key = "dfl_astrofarm2";
    						var af = system.addShips("[" + key + "]", 1, pos, 0);
    						if (!af || af.length === 0) 
    							log("dictators.populator", "OOPS! No astrofarm spawned");
    						else 
    							worldScripts["dictators.js"].turnStationToEntity(af[0], system.sun, -1.5, 0, 1); // get solar panel to face sun
    					}}
    				);
    
    				var posIM1 = Vector3D.interpolate(posAFM, system.mainStation.position, 0.8);
    				system.setPopulator("dictators_revlogistics1", {
    					location: "COORDINATES",
    					coordinates: posIM1,
    					priority: 400,
    					callback: function(pos) {
    						if (system.countShipsWithRole("astrofarm") == 0) return;
    						var mnc = system.addShips("revlogistics", 1, pos, 0);
    						if (!mnc || mnc.length === 0) log("dictators.populator", "OOPS! No revlogistics spawned (1)");
    					}}
    				);
    
    				var posIM2 = Vector3D.interpolate(posAFM, system.mainStation.position, 0.4);
    				system.setPopulator("dictators_revlogistics2", {
    					location: "COORDINATES",
    					coordinates: posIM2,
    					priority: 400,
    					callback: function(pos) {
    						if (system.countShipsWithRole("astrofarm") == 0) return;
    						var tnk = system.addShips("revlogistics", 1, pos, 0);
    						if (!tnk || tnk.length === 0) log("dictators.populator", "OOPS! No revlogistics spawned (2)");
    					}}
    				);
    			}
    		}
    
    		// prisonship spawning
    		if(system.economy >= 6) {
    			if(system.countShipsWithRole("prisonship") == 0) {
    				var posPS = Vector3D(0, 0, 0.8).fromCoordinateSystem("wpu");
    				system.setPopulator("dictators_prisonship", {
    					location: "COORDINATES",
    					coordinates: posPS,
    					callback: function(pos) {
    						var ps = system.addShips("prisonship", 1, pos, 0);
    						if (!ps || ps.length === 0) log("dictators.populator", "OOPS! No prisonship spawned");
    					}}
    				);
    			}
    		}
    
    		if (Math.random() > 0.09) {
    			// spawn some ambience near the witchpoint
    			system.setPopulator("dictators_ambience", {
    				callback: function(pos) {
    					var ambienceAttacker = "censor_ambience";
    					if (system.economy >= 4) ambienceAttacker = "enforcer_ambience";
    					//half the time, spawn ambience ships close to the witchpoint and move them a bit closer to the planet. a bit is a 0.75 * scanner range. it's a bit boring to all the time have them sitting next to the witchpoint. a bit too staged to my liking.
    					if (Math.random() < 0.5) {
    						var attk = system.addShips("[" + ambienceAttacker + "]", 1);
    						if (attk.length > 0) {
    							var attacker = attk[0];
    							attacker.position = attacker.position.add([0, 0, 19200]);
    							var target = system.addShips("trader", 1, attacker.position)[0];
    						}
    					}
    					else {
    						var attk = system.addShips("[" + ambienceAttacker + "]", 1);
    						if (attk.length > 0) {
    							var attacker = attk[0];
    							var target = system.addShips("trader", 1, attacker.position)[0];
    						}
    					}
    					if (target) {
    						target.$dictatorsAmbience = true;
    						target.fuel = 0;//no escape
    						target.script.shipDied = worldScripts["dictators.js"].$ambienceTargetShipDied;
    					}
    				}.bind(this),
    				location: "LANE_WP"
    			});
    		}
    	}
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.turnStationToEntity = function (station, entity, x, y, z) {
    	var targetVector = entity.position.subtract(station.position).direction();
    	station.orientation = targetVector.rotationTo([(!x ? 0 : x), (!y ? 0 : y), (!z ? 1 : z)]);
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.$ambienceTargetShipDied = function(whom, why) {
    	function $findAmbienceAttacker(entity) {
    		return entity.hasRole("dictatorsAmbience");;
    	}
    	var targets = system.filteredEntities(this, $findAmbienceAttacker, this.ship, 35600);
    	if (targets.length > 0) {
    		if (targets[0].hasRole("imperial")) {
    			targets[0].switchAI("imperialpoliceAI.plist");
    		}
    		if (targets[0].hasRole("junta")) {
    			targets[0].switchAI("juntapoliceAI.plist");
    		}
    	}
    }
    Scripts/dictators_conditions.js
    "use strict";
    this.name        = "Dictators_Conditions";
    this.author      = "phkb";
    this.copyright   = "2016 phkb";
    this.description = "Condition script for ships and equipment.";
    this.licence     = "CC BY-NC-SA 3.0";
    
    //-------------------------------------------------------------------------------------------------------------
    this.allowSpawnShip = function(shipKey) {
    	if (worldScripts["dictators.js"]._shipSpawnOverride === true) return true;
    	if (system.government !== 3) return false;
    	switch (shipKey) {
    		case "rev_guard":
    		case "enforcer":
    		case "enforcer_ambience":
    			if (worldScripts["dictators.js"]._settings.policeShipReplace == false) return false;
    			if (system.info.economy >= 4) return true;
    			break;
    		case "prison_ship":
    			if (system.info.economy >= 4) return true;
    			break;
    		case "quaestor":
    		case "censor":
    		case "censor_ambience":
    			if (worldScripts["dictators.js"]._settings.policeShipReplace == false) return false;
    			if (system.info.economy < 4) return true;
    			break;
    		case "astrofactory":
    		case "tanker_1":
    		case "tanker_2":
    		case "tanker_3":
    		case "tanker_4":
    		case "tanker_5":
    		case "tanker_6":
    		case "freighter_1":
    		case "freighter_2":
    		case "freighter_3":
    		case "freighter_4":
    		case "freighter_5":
    		case "freighter_6":
    		case "merchantman_1":
    		case "merchantman_2":
    		case "merchantman_3":
    		case "merchantman_4":
    		case "merchantman_5":
    		case "merchantman_6":
    			return true;
    	}
    	return false;
    }