Exemplo n.º 1
0
        public void Awake()
        {
            SpreadsheetGenMod.Logger = base.Logger;  // "C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\LogOutput.log"
            SpreadsheetGenMod.Config = base.Config;

            // Determine the default spreadsheet path and configured spreadsheet path.
            spreadsheetFileNameTemplate = "DSP_Star_Sector_Resources_${seed}-${starCount}.csv";
            if (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) != "")
            {
                spreadsheetFileNameTemplate = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Path.DirectorySeparatorChar + spreadsheetFileNameTemplate;
            }
            spreadsheetFileNameTemplate = Config.Bind <string>("Output", "SpreadsheetFileName", spreadsheetFileNameTemplate, "Path to the output spreadsheet.  You can use ${seed} and ${starCount} as placeholders and the mod will insert them into the filename.").Value;
            spreadsheetColumnSeparator  = Config.Bind <string>("Output", "SpreadsheetColumnSeparator", spreadsheetColumnSeparator, "Character to use as Separator in the generated file.").Value;
            spreadsheetFloatPrecision   = Config.Bind <int>("Output", "SpreadsheetFloatPrecision", spreadsheetFloatPrecision, "Decimals to use when exporting floating point numbers. Use -1 to disable rounding.").Value;
            spreadsheetLocale           = new CultureInfo(Config.Bind <string>("Output", "SpreadsheetLocale", spreadsheetLocale.Name, "Locale to use for exporting numbers.").Value, false);

            enablePlanetLoadingFlag   = Config.Bind <bool>("Enable", "LoadAllPlanets", enablePlanetLoadingFlag, "Planet loading is needed to get all resource data, but you can skip this step for memory efficiency.").Value;
            enablePlanetUnloadingFlag = Config.Bind <bool>("Enable", "UnloadPlanets", enablePlanetUnloadingFlag, "Once planets are loaded to obtain their resource data, unload them to conserve memory.  (This setting is only used if LoadAllPlanets is true.)").Value;
            enableOnStartTrigger      = Config.Bind <bool>("Enable", "SaveOnStart", enableOnStartTrigger, "Whether or not spreadsheet generation should be triggered by starting a game.").Value;
            enableOnPauseTrigger      = Config.Bind <bool>("Enable", "SaveOnPause", enableOnPauseTrigger, "Whether or not spreadsheet generation should be triggered by pausing the game.").Value;

            Logger.LogInfo("Will use spreadsheet path \"" + spreadsheetFileNameTemplate + "\"");

            Harmony harmony = new Harmony(pluginGuid);

            harmony.PatchAll(typeof(SpreadsheetGenMod));

            Logger.LogInfo("Initialization complete.");
        }
 private void ChangeColors(object sender, EventArgs e)
 {
     ArmorColor = new Color(
         Config.Bind <float>("Armor", "R", 1f, "Red value of the armor").Value,
         Config.Bind <float>("Armor", "G", 0.6846404f, "Green value of the armor").Value,
         Config.Bind <float>("Armor", "B", 0.24313718f, "Blue value of the armor").Value,
         Config.Bind <float>("Armor", "A", 1f, "Alpha value of the armor").Value
         );
     SkeletonColor = new Color(
         Config.Bind <float>("Skeleton", "R", 1f, "Red value of the skeleton").Value,
         Config.Bind <float>("Skeleton", "G", 1f, "Green value of the skeleton").Value,
         Config.Bind <float>("Skeleton", "B", 1f, "Blue value of the skeleton").Value,
         Config.Bind <float>("Skeleton", "A", 1f, "Alpha value of the skeleton").Value
         );
 }
        /// <summary>
        /// A helper to easily set up and initialize an pod from your pod classes if the user has it enabled in their configuration files.
        /// </summary>
        /// <param name="configFile">The configuration file from the main plugin."</param>
        /// <param name="podBase">A new instance of an PodBase class."</param>
        public static bool ValidatePod(BepInEx.Configuration.ConfigFile configFile, PodBase podBase)
        {
            var survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(BodyCatalog.FindBodyPrefab(podBase.BodyName));

            if (survivorDef != null)
            {
                var enabled = configFile.Bind <bool>(podBase.ConfigCategory, "Enable Pod Modification?", true, "[Server] Should this body's pod get modified?").Value;
                if (enabled)
                {
                    return(true);
                }
            }
            return(false);
        }
        public static void OnConfigReload()
        {
            configEnableMod                   = Config.Bind <bool>("Config", "Enable", true, "Enable/disable drone clearing mod.");
            configCollectResourcesFlag        = Config.Bind <bool>("Config", "CollectResources", configCollectResourcesFlag, "Take time to collect resources. If false, clearing will be quicker, but no resources will be collected.").Value;
            configMaxClearingDroneCount       = Config.Bind <uint>("Config", "DroneCountLimit", configMaxClearingDroneCount, "Limit the number of drones that will be used when clearing.").Value;
            configLimitClearingDistance       = Config.Bind <float>("Config", "ClearingDistance", configLimitClearingDistance, "Fraction of mecha build distance to perform clearing.  Min 0.0, Max 1.0").Value;
            configLimitClearingDistance       = Math.Min(configLimitClearingDistance, 1.0f);
            configLimitClearingDistance       = Math.Max(configLimitClearingDistance, 0.0f);
            configEnableClearingWhileDrifting = Config.Bind <bool>("Config", "ClearWhileDrifting", configEnableClearingWhileDrifting, "This flag can be used to enable/disable clearing while drifing over oceans.").Value;
            configEnableClearingWhileFlying   = Config.Bind <bool>("Config", "ClearWhileFlying", configEnableClearingWhileFlying, "This flag can be used to enable/disable clearing while flying.").Value;
            configEnableRecallWhileFlying     = Config.Bind <bool>("Config", "RecallWhileFlying", configEnableRecallWhileFlying, "Enable this feature if you want drones assigned to clearing to be recalled when Icarus is flying. (This setting is only used if configEnableClearingWhileFlying is false.)").Value;
            configReservedInventorySpace      = Config.Bind <uint>("Config", "InventorySpace", configReservedInventorySpace, "Initiate clearing when there are this number of inventory spaces empty.  (Setting has no impact if CollectResources is false.)").Value;
            configReservedPower               = Config.Bind <float>("Config", "PowerReserve", configReservedPower, "Initiate clearing only when there is at least this fraction of Icarus's power remaining.").Value;
            configSpeedScaleFactor            = Config.Bind <float>("Config", "SpeedScale", configSpeedScaleFactor, "Is this mod so great that it feels too much like cheating?  Slow the drones down with this setting.  They normally operate at the same speed as Icarus.  Too slow?  You can cheat too by setting a value greater than 1.").Value;
            configSpeedScaleFactor            = Math.Max(configSpeedScaleFactor, 0.0f);
            configEnableInstantClearing       = Config.Bind <bool>("Config", "DSPCheats_InstantClearing", configEnableInstantClearing, "If the DSP Cheats mod is installed, and Instant-Build is enabled, should this mod work with that one and instantly clear?").Value;
            configEnableDebug                 = Config.Bind <bool>("Config", "EnableDebug", configEnableDebug, "Enabling debug will add more feedback to the BepInEx console.  This includes the reasons why drones are not clearing.").Value;

            configEnableClearingItemTree   = Config.Bind <bool>("Items", "IncludeTrees", configEnableClearingItemTree, "Enabling clearing of trees.").Value;
            configEnableClearingItemStone  = Config.Bind <bool>("Items", "IncludeStone", configEnableClearingItemStone, "Enabling clearing of stones which can block the mecha's movement.  (This includes the space capsule at the start of a new game.)").Value;
            configEnableClearingItemDetail = Config.Bind <bool>("Items", "IncludePebbles", configEnableClearingItemDetail, "Enabling clearing of tiny stones which won't block the mecha's movement.").Value;
            configEnableClearingItemIce    = Config.Bind <bool>("Items", "IncludeIce", configEnableClearingItemIce, "Enabling clearing of ice.").Value;

            configEnableClearingPlanetGeneric = Config.Bind <bool>("Planets", "IncludeGeneric", configEnableClearingPlanetGeneric, "Enable clearing on generic planets.").Value;
            configEnableClearingPlanetVocano  = Config.Bind <bool>("Planets", "IncludeVolcanic", configEnableClearingPlanetVocano, "Enable clearing on volcanic planets.").Value;
            configEnableClearingPlanetOcean   = Config.Bind <bool>("Planets", "IncludeOcean", configEnableClearingPlanetOcean, "Enable clearing on ocean planets.").Value;
            configEnableClearingPlanetDesert  = Config.Bind <bool>("Planets", "IncludeDesert", configEnableClearingPlanetDesert, "Enable clearing on desert planets.").Value;
            configEnableClearingPlanetIce     = Config.Bind <bool>("Planets", "IncludeIce", configEnableClearingPlanetIce, "Enable clearing on ice planets.").Value;

            Logger.LogInfo("Configuration loaded.");
        }