コード例 #1
0
        public void Awake()
        {
            logger = base.Logger;

            myCfg = Config;

            GenModDict = new Dictionary <int, long>();

            #region SettingsEasyMode_Generators

            modGenWindTurbine = Config.Bind <long>("-| 1 Easy Mode |1| Wind Turbine", "Max Power (kW)", 300, "Max kW a Wind Turbine can generate").Value;
            modGenSolar       = Config.Bind <long>("-| 1 Easy Mode |2| Solar Panel", "Max Power (kW)", 360, "Max kW a Solar Panel can generate").Value;
            modGenThermal     = Config.Bind <long>("-| 1 Easy Mode |3| Thermal Power Generator", "Max Power (kW)", 2160, "Max kW a Thermal Power Generator can generate").Value;
            modGenMiniFusion  = Config.Bind <long>("-| 1 Easy Mode |4| Mini Fusion Power Generator", "Max Power (kW)", 9000, "Max kW a Mini Fusion Power Generator can generate").Value;
            modGenArtStar     = Config.Bind <long>("-| 1 Easy Mode |5| Artificial Star", "Max Power (kW)", 75000, "Max kW a Artificial Star can generate").Value;
            #endregion


            AdvancedMode    = Config.Bind <bool>("-| 2 Advanced Mode", "Activate Advanced Mode", false, "Advanced settings can be useful if you have additional modded Power Generators & want to specify different values for them.\nIn Advanced mode, Easy Mode settings get ignored!\nTo find out Modded ITEM IDs checkout \"\\BepInEx\\config\\LDBTool\\LDBTool.CustomID.cfg\" or ask the mod creator.").Value;
            generatorValues = Config.Bind <string>("-| 2 Advanced Mode Power Generators", "Power Generator ItemIDs Values", "2203:300|2205:360|2204:2160|2211:9000|2210:75000", "Here you can specify the Power generation values for Generators.\n\nFormat: {ItemID}:{PowerGen(kW)}\nSeperate multiple entries by |\nExample: 2203:300|2205:360|2204:2160|2211:9000|2210:75000\n\nVanilla IDs:\n2203 = Wind Turbine\n2205 = Solar Panel\n2204 = Thermal Power Generator\n2211 = Mini Fusion Generator\n2210 = Artificial Star").Value;

            EditExisting = Config.Bind <bool>("-| 3 Edit Existing", "Edit existing Buildings on Load", false, "If enabled, the Mod will NOT ONLY work with new set Power Generator Buildings, but will also try to edit all existing ones when loading a Savegame. You can keep it disabled if you did once.\nAlso you can use this setting to reset to defaults(just enter the default values in any mode and activate this setting)\nNote that any changes made in the Config, require the game to restart!\nThis setting will automatically deactivate once you load a game after activating it.").Value;

            var harmony = new Harmony(ModGuid);

            harmony.PatchAll(typeof(EnergyManagerPatch));
        }
コード例 #2
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.");
        }
コード例 #3
0
        public void Awake()
        {
            IcarusColorPickerPlugin.Config = base.Config;
            IcarusColorPickerPlugin.Logger = base.Logger;

            Logger.LogMessage("Loading IcarusColorPicker configs...");
            ChangeColors(null, null);

            Config.ConfigReloaded += ChangeColors;

            Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), ModGuid);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        public void Awake()
        {
            DysonSphereDroneClearing.Logger = base.Logger;  // "C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\LogOutput.log"
            DysonSphereDroneClearing.Config = base.Config;
            OnConfigReload();
            Config.ConfigReloaded += OnConfigReload;

            // PlayerOrder.ReachTest, PlayerAction_Mine.GameTick
            // MechaDroneLogic.UpdateDrones -> MechaDroneLogic.Build -> PlanetFactory.BuildFinally
            // PlanetFactory.BuildFinally calls FlattenTerrain and SetSandCount.
            harmony = new Harmony(pluginGuid);
            harmony.PatchAll(typeof(DysonSphereDroneClearing));

            enabledSprite  = GetSprite(new Color(0, 1, 0));          // Bright Green
            disabledSprite = GetSprite(new Color(0.5f, 0.5f, 0.5f)); // Medium Grey

            Logger.LogInfo("Initialization complete.");
        }