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

Expansion Feudal PlanetFall Customisations

Content

Warnings

  1. http://wiki.alioth.net/index.php/Feudal%20PlanetFall%20Customisations -> 404 Not Found
  2. Low hanging fuit: Information URL exists...
  3. Required Expansions mismatch between OXP Manifest and Expansion Manager at character position 0168 (DIGIT ZERO vs LATIN SMALL LETTER N)
  4. No version in dependency reference to oolite.oxp.Ramirez.FeudalStates:null

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Creates custom PlanetFall configurations for select Feudal Systems Creates custom PlanetFall configurations for select Feudal Systems
Identifier oolite.oxp.phkb.FeudalPlanetFall oolite.oxp.phkb.FeudalPlanetFall
Title Feudal PlanetFall Customisations Feudal PlanetFall Customisations
Category Dockables Dockables
Author phkb phkb
Version 1.2 1.2
Tags dockables, system dockables, system
Required Oolite Version
Maximum Oolite Version
Required Expansions
  • oolite.oxp.Thargoid.Planetfall:2.0
  • oolite.oxp.Ramirez.FeudalStates:0
  • oolite.oxp.Thargoid.Planetfall:2.0
  • oolite.oxp.Ramirez.FeudalStates:
  • Optional Expansions
    Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/Planetfall2_OXP n/a
    Download URL https://wiki.alioth.net/img_auth.php/d/dd/Feudal_PlanetFall2_1.2.oxz n/a
    License CC-BY-SA-NC 4.0 CC-BY-SA-NC 4.0
    File Size n/a
    Upload date 1716997498

    Documentation

    Equipment

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

    Ships

    Name
    Cathedral

    Models

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

    Scripts

    Path
    Config/script.js
    "use strict";
    this.name = "Feudal_PlanetFall2";
    this.author = "phkb";
    this.copyright = "CC-BY-SA-NC 4.0";
    this.description = "Allows for full customisations of Feudal systems";
    
    this.debug = true;
    this.rsnInUse = false;
    this.nameStore = null;
    
    //-------------------------------------------------------------------------------------------------------------
    this.startUp = function () {
        var pf = worldScripts.PlanetFall2;
        pf._locationOverrides["0 96"] = {
            main: [
                {
                    roles: ["planetFall2_mainSurface_FSRoyalCourt", "capitalCity", "planetFall2_mainSurface_FSCathedral", "capitalCity"],
                    names: ["Sir Ffoliot Cary Port, Lesser Walsingham (Royal Court)", "Lesser Walsingham (Capital City)", "Greater Walsingham (Cathedral)", "Lancaster (City)"],
                }
            ],
        };
    
        pf._landingImages["feudalCourt"] = [
            { name: "feudalCourt_1.png", height: 568 }, { name: "feudalCourt_2.png", height: 568 }, { name: "feudalCourt_3.png", height: 568 },
            { name: "feudalCourt_4.png", height: 568 }, { name: "feudalCourt_5.png", height: 568 }, { name: "feudalCourt_6.png", height: 568 },
            { name: "feudalCourt_7.png", height: 568 }, { name: "feudalCourt_8.png", height: 568 }, { name: "feudalCourt_9.png", height: 568 },
            { name: "feudalCourt_10.png", height: 568 }, { name: "feudalCourt_11.png", height: 568 }, { name: "feudalCourt_12.png", height: 568 },
            { name: "feudalCourt_13.png", height: 568 }, { name: "feudalCourt_14.png", height: 568 }, { name: "feudalCourt_15.png", height: 568 }
        ];
        pf._landingImages["feudalCathedral"] = [
            { name: "feudalCathedral_1.png", height: 568 }, { name: "feudalCathedral_2.png", height: 568 }, { name: "feudalCathedral_3.png", height: 568 }, 
            { name: "feudalCathedral_4.png", height: 568 }, { name: "feudalCathedral_5.png", height: 568 }
        ];
    
        if (worldScripts["feudal-planetfall.js"]) {
            pf.$addPrepopulationFunction("feudal-planetfall.js", "extraPopulation");
            if (this.debug) log(this.name, "Monkey-patching shipWillEnterWitchspace, shipWillLaunchFromStation, and shipWillExitWitchspace functions of Feudal states PlanetFall script");
            var f = worldScripts["feudal-planetfall.js"];
            delete f.shipWillLaunchFromStation;
            delete f.shipWillExitWitchspace;
            f.extraPopulation = this.feudalstates_extraPopulation;
            f.shipWillEnterWitchspace = this.feudalstates_shipWillEnterWitchspace;
        }
    
        this._phraseGen = worldScripts.GNN_PhraseGen;
        // link into the PF name store
        var ns = worldScripts.PlanetFall2_Names;
        // make sure the nameStore dictionary has been populated
        if (Object.keys(ns.nameStore).length == 0) {
            // if the number of keys in the nameStore object is zero, it means the startUp function in PlanetFall2_Names 
            // hasn't been run yet (this one has been run first).// so run it now, and delete it so it doesn't get run twice.
            ns.startUp();
            delete ns.startUp;
        }
        this.nameStore = ns.nameStore;
    
    	if (worldScripts.RandomStationNames) this.rsnInUse = true;
    	// override the rsn flag if we've specifically turned it off.
    	if (worldScripts.PlanetFall2._config.useGANames == false) this.rsnInUse = false;
    }
    
    //-------------------------------------------------------------------------------------------------------------
    this.feudalstates_extraPopulation = function () {
        if (system.government == 1 && worldScripts.PlanetFall2) {
            if ((galaxyNumber == 0 && system.techLevel >= 7) || (galaxyNumber == 1 && system.techLevel >= 5) || (galaxyNumber == 2 && system.techLevel >= 7) || (galaxyNumber == 4 && system.techLevel >= 7) || (galaxyNumber == 5 && system.techLevel >= 8)) {
                var pf = worldScripts.PlanetFall2;
                var key = galaxyNumber + " " + system.ID;
                // if we have a full custom setup, don't use the override method
                if (pf._locationOverrides[key]) return;
                worldScripts.PlanetFall2.planetFallOverride = true; // set the override, so only external OXP locations appear
            }
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    // just pointing this at the correct worldscript name
    this.feudalstates_shipWillEnterWitchspace = function (cause, destination) {
        if (system.government == 1 && worldScripts.PlanetFall2) {
            worldScripts.PlanetFall2.planetFallOverride = false;
        }
    }
    
    //-------------------------------------------------------------------------------------------------------------
    // reproduction of Galactic Almanac's naming method for Royal Courts
    this.planetFall_mainSurface_FSRoyalCourt1 = [
    	"Hall","Castle","Fortress","Bastion","Palace","Chateau","Citadel","Keep"
    ];
    this.planetFall_mainSurface_FSRoyalCourt2 = [
    	"Honour","Chivalry","Fortitude","Stoicism","Endurance","Fortune","Courage","Nobility","Gallantry",
    	"Bravery","Heroism","Valour","Daring","Adventure","Enlightenment","Audacity","Temperance",
    	"Grace","Virtue","Fealty","Honesty","Integrity"
    ];
    this.planetFall_mainSurface_FSRoyalCourt3a = [
    	"Royal","Regal","Feudal"
    ];
    this.planetFall_mainSurface_FSRoyalCourt3b = [
    	"Court","Lodge"
    ];
    
    //-------------------------------------------------------------------------------------------------------------
    this.$PF_RoyalCourt = function $PF_RoyalCourt(dataKey) {
    	if (!this.rsnInUse) return "";
        // do we have a stored name for this key
    	var stored = this.nameStore[galaxyNumber][system.ID][dataKey];
        // if not, generate one
    	if (!stored) {
    		var def = {
    			fieldA: [].concat(this.planetFall_mainSurface_FSRoyalCourt1),
    			fieldB: [].concat(this.planetFall_mainSurface_FSRoyalCourt2),
    			fieldC: [].concat(this.planetFall_mainSurface_FSRoyalCourt3a),
    			fieldD: [].concat(this.planetFall_mainSurface_FSRoyalCourt3b),
    			fieldE: ["[3] [4]"],
    			fieldF: [],
    			fieldG: [],
    			fieldH: [],
    			fieldI: [],
    			fieldJ: [],
    			fieldK: [],
    			fieldL: [],
    			fieldM: [],
    			fieldN: [],
    			fieldO: [],
    			fieldP: [],
    			fieldQ: [],
    			fieldR: [],
    			sentences: [
    				"1 of 2 (5)"
    			],
    		};
    		var text = this._phraseGen._makePhrase(def);
    		this.nameStore[galaxyNumber][system.ID][dataKey] = text;
    	} else {
            // otherwise, use the stored value
    		var text = stored;
    	}
        return text;
    }
    
    Scripts/feudal-planetfall-conditions.js
    "use strict";
    this.name = "feudal-planetfall-conditions.js";
    this.author = "phkb";
    this.copyright = "June 2021";
    this.description = "Condition script for Planetfall";
    this.version = "1.0";
    
    this.allowSpawnShip = function(shipKey) {
        if (system.government == 1) return true;
        return false;
    }