"use strict";
this.name = "PlanetFall2_BlackMonks";
this.author = "phkb";
this.copyright = "Creative Commons Attribution - Non-Commercial - Share Alike 4.0 license.";
this.description = "Script for PF2 Black Monks";

this._spawn = {
    mainPlanet: true,
    extraPlanets: true,
    moons: true
};

this._bmConfig = {
    Name: this.name,
    Display: expandMissionText("pf_blackmonks_config"),
    Alias: expandMissionText("pf_blackmonks_title"),
    Alive: "_bmConfig",
	Bool: {
		B0: { Name: "_spawn.mainPlanet", Def: true, Desc: expandMissionText("pf_blackmonks_main") },
		B1: { Name: "_spawn.extraPlanets", Def: true, Desc: expandMissionText("pf_blackmonks_extra") },
		B2: { Name: "_spawn.moons", Def: true, Desc: expandMissionText("pf_blackmonks_moons") },
		Info: expandMissionText("pf_blackmonks_bool_info")
	},
};

this.startUp = function() {
	var pf = worldScripts.PlanetFall2;
    pf._landingImages["blackmonks"] = ["blackmonks_1.png", "blackmonks_2.png", "blackmonks_3.png", "blackmonks_4.png", "blackmonks_5.png", "blackmonks_6.png", "blackmonks_7.png", "blackmonks_8.png"];
    pf._landingImages["blackmonks_moon"] = ["blackmonks_moon_1.png", "blackmonks_moon_2.png", "blackmonks_moon_3.png", "blackmonks_moon_4.png"];

    var pfai = worldScripts.planetFall2_priorityAI;
    pfai._landingPriority["planetFall2_mainSurface_blackMonks"] = 2;
    pfai._landingPriority["planetFall2_subSurface_blackMonks"] = 2;
    pfai._landingPriority["planetFall2_moonSurface_blackMonks"] = 2;

    if (missionVariables.PF2BlackMonks) this._spawn = JSON.parse(missionVariables.PF2BlackMonks);
}

this.startUpComplete = function() {
    // register our settings, if Lib_Config is present
    if (worldScripts.Lib_Config) {
        worldScripts.Lib_Config._registerSet(this._bmConfig);
    }
}

this.playerWillSaveGame = function() {
    missionVariables.PF2BlackMonks = JSON.stringify(this._spawn);
}