Пример #1
0
        // Decorations mod entry point
        public static void Patch()
        {
            // 1) INITIALIZE HARMONY
            if (!MyHarmony.Initialize())
            {
                return;
            }

            // 2) LOAD CONFIGURATION
            ConfigSwitcher.LoadConfiguration();

            // 3) REGISTER NEW ITEMS
            DecorationsMod.DecorationItems = RegisterNewItems();

            // 4) REGISTER LANGUAGE STRINGS
            RegisterLanguageStrings();

            // 5) MAKE SOME EXISTING ITEMS PICKUPABLE & PLACEABLE
            if (ConfigSwitcher.EnablePlaceItems)
            {
                PlaceToolItems.MakeItemsPlaceable();
            }

            // 6) REGISTER DECORATIONS FABRICATOR
            Logger.Log("INFO: Registering decorations fabricator...");
            Fabricator_Decorations decorationsFabricator = new Fabricator_Decorations();

            decorationsFabricator.RegisterDecorationsFabricator(DecorationsMod.DecorationItems);

            // 7) REGISTER FLORA FABRICATOR
            if (ConfigSwitcher.EnableNewFlora)
            {
                Logger.Log("INFO: Registering seeds fabricator...");
                Fabricator_Flora floraFabricator = new Fabricator_Flora();
                floraFabricator.RegisterFloraFabricator(DecorationsMod.DecorationItems);
            }

            // 8) HARMONY PATCHING
            MyHarmony.PatchAll();
            // Various enhancements.
            if (ConfigSwitcher.FixAquariumLighting)
            {
                PrefabsHelper.FixAquariumSkyApplier();
            }
            MyHarmony.FixSignInput();
            // Mods compatibility.
            MyHarmony.FixAutoLoadMod();

            // 9) SETUP IN GAME OPTIONS MENU
            Logger.Log("INFO: Setting up in-game options menu...");
            SMLHelper.V2.Handlers.OptionsPanelHandler.RegisterModOptions(new ConfigOptions("Decorations mod"));
        }
Пример #2
0
        // Decorations mod entry point
        public static void Patch()
        {
            // 1) INITIALIZE HARMONY
            if ((HarmonyInstance = HarmonyInstance.Create("com.osubmarin.decorationsmod")) == null)
            {
                Logger.Log("ERROR: Unable to initialize Harmony!");
                return;
            }

            // 2) LOAD CONFIGURATION
            ConfigSwitcher.LoadConfiguration();

            // 3) REGISTER NEW ITEMS
            DecorationsMod.DecorationItems = RegisterNewItems();

            // 4) REGISTER LANGUAGE STRINGS
            RegisterLanguageStrings();

            // 5) MAKE SOME EXISTING ITEMS PICKUPABLE & PLACEABLE
            if (ConfigSwitcher.EnablePlaceItems)
            {
                PlaceToolItems.MakeItemsPlaceable();
            }

            // 6) REGISTER DECORATIONS FABRICATOR
            Fabricator_Decorations decorationsFabricator = new Fabricator_Decorations();

            decorationsFabricator.RegisterDecorationsFabricator(DecorationsMod.DecorationItems);

            // 7) REGISTER FLORA FABRICATOR
            if (ConfigSwitcher.EnableNewFlora)
            {
                Fabricator_Flora floraFabricator = new Fabricator_Flora();
                floraFabricator.RegisterFloraFabricator(DecorationsMod.DecorationItems);
            }

            // 8) HARMONY PATCHING
            HarmonyPatchAll();

            // 9) ENHANCEMENTS
            if (ConfigSwitcher.FixAquariumLighting)
            {
                PrefabsHelper.FixAquariumSkyApplier();
            }

            // 10) SETUP IN GAME OPTIONS MENU
            Logger.Log("Setting up in-game options menu...");
            SMLHelper.V2.Handlers.OptionsPanelHandler.RegisterModOptions(new ConfigOptions("Decorations mod"));
        }
Пример #3
0
        private void ConfigOptions_ToggleChanged(object sender, SMLHelper.V2.Options.ToggleChangedEventArgs e)
        {
            if (!string.IsNullOrEmpty(e?.Id))
            {
                switch (e.Id)
                {
                case "OpenDecorationsModConfigurator":
                    break;

                case "UseFlatScreenResolution":
                    ConfigSwitcher.UseFlatScreenResolution = e.Value;
                    UpdateConfigFile("\r\nuseAlternativeScreenResolution=" + (e.Value ? "false" : "true") + "\r\n", "\r\nuseAlternativeScreenResolution=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " alternate screen resolution.");
                    break;

                case "UseCompactTooltips":
                    ConfigSwitcher.UseCompactTooltips = e.Value;
                    UpdateConfigFile("\r\nuseCompactTooltips=" + (e.Value ? "false" : "true") + "\r\n", "\r\nuseCompactTooltips=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Compact tooltips " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "LockQuickslotsWhenPlacingItem":
                    ConfigSwitcher.LockQuickslotsWhenPlacingItem = e.Value;
                    UpdateConfigFile("\r\nlockQuickslotsWhenPlacingItem=" + (e.Value ? "false" : "true") + "\r\n", "\r\nlockQuickslotsWhenPlacingItem=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Lock quickslots when placing item " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "AllowBuildOutside":
                    ConfigSwitcher.AllowBuildOutside = e.Value;
                    UpdateConfigFile("\r\nallowBuildOutside=" + (e.Value ? "false" : "true") + "\r\n", "\r\nallowBuildOutside=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Allow build outside " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "AllowPlaceOutside":
                    ConfigSwitcher.AllowPlaceOutside = e.Value;
                    UpdateConfigFile("\r\nallowPlaceOutside=" + (e.Value ? "false" : "true") + "\r\n", "\r\nallowPlaceOutside=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Allow place outside " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "EnableDiscoveryMode":
                    ConfigSwitcher.AddItemsWhenDiscovered = e.Value;
                    UpdateConfigFile("\r\naddItemsWhenDiscovered=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddItemsWhenDiscovered=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " adding items when discovered.");
                    break;

                case "EnableSofas":
                    ConfigSwitcher.EnableSofas = e.Value;
                    UpdateConfigFile("\r\nenableSofas=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableSofas=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " sofas.");
                    break;

                case "EnablePlaceItems":
                    ConfigSwitcher.EnablePlaceItems = e.Value;
                    if (e.Value)
                    {
                        PlaceToolItems.MakeItemsPlaceable();
                    }
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " placeable items.");
                    UpdateConfigFile("\r\nenablePlaceItems=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenablePlaceItems=" + (e.Value ? "true" : "false") + "\r\n");
                    break;

                case "EnablePlaceBatteries":
                    ConfigSwitcher.EnablePlaceBatteries = e.Value;
                    if (e.Value)
                    {
                        PlaceToolItems.MakeBatteriesPlaceable();
                        DecorationsMod.PatchBatteries();
                    }
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " placeable batteries.");
                    UpdateConfigFile("\r\nenablePlaceBatteries=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenablePlaceBatteries=" + (e.Value ? "true" : "false") + "\r\n");
                    break;

                case "EnableNewItems":
                    ConfigSwitcher.EnableNewItems = e.Value;
                    UpdateConfigFile("\r\nenableNewBuilderItems=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableNewBuilderItems=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " new builder items.");
                    break;

                case "EnableNewFlora":
                    ConfigSwitcher.EnableNewFlora = e.Value;
                    UpdateConfigFile("\r\nenableNewFlora=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableNewFlora=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " new flora.");
                    break;

                case "EnablePrecursorTab":
                    ConfigSwitcher.EnablePrecursorTab = e.Value;
                    UpdateConfigFile("\r\nenablePrecursorTab=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenablePrecursorTab=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " precursor tab.");
                    break;

                case "EnableNutrientBlock":
                    ConfigSwitcher.EnableNutrientBlock = e.Value;
                    UpdateConfigFile("\r\nenableNutrientBlock=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableNutrientBlock=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " nutrient block.");
                    break;

                case "EnableRegularEggs":
                    ConfigSwitcher.EnableRegularEggs = e.Value;
                    UpdateConfigFile("\r\nenableAllEggs=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableAllEggs=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " regular eggs.");
                    break;

                case "EnableEggsWhenCreatureScanned":
                    ConfigSwitcher.EnableEggsWhenCreatureScanned = e.Value;
                    UpdateConfigFile("\r\naddEggsWhenCreatureScanned=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddEggsWhenCreatureScanned=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " eggs unlocking when discovered.");
                    break;

                case "EnableEggsAtStart":
                    ConfigSwitcher.EnableEggsAtStart = e.Value;
                    UpdateConfigFile("\r\naddEggsAtStart=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddEggsAtStart=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " eggs unlocking at start.");
                    break;

                case "PrecursorKeysAll":
                    ConfigSwitcher.PrecursorKeysAll = e.Value;
                    UpdateConfigFile("\r\nprecursorKeysAll=" + (e.Value ? "false" : "true") + "\r\n", "\r\nprecursorKeysAll=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " regular alien tablets.");
                    break;

                case "EnableRegularAirSeeds":
                    ConfigSwitcher.EnableRegularAirSeeds = e.Value;
                    UpdateConfigFile("\r\naddRegularAirSeeds=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddRegularAirSeeds=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " regular air seeds.");
                    break;

                case "AddRegularAirSeedsWhenDiscovered":
                    ConfigSwitcher.AddAirSeedsWhenDiscovered = e.Value;
                    UpdateConfigFile("\r\naddAirSeedsWhenDiscovered=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddAirSeedsWhenDiscovered=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " unlocking air seeds when discovered.");
                    break;

                case "EnableRegularWaterSeeds":
                    ConfigSwitcher.EnableRegularWaterSeeds = e.Value;
                    UpdateConfigFile("\r\naddRegularWaterSeeds=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddRegularWaterSeeds=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " regular water seeds.");
                    break;

                case "AddRegularWaterSeedsWhenDiscovered":
                    ConfigSwitcher.AddWaterSeedsWhenDiscovered = e.Value;
                    UpdateConfigFile("\r\naddWaterSeedsWhenDiscovered=" + (e.Value ? "false" : "true") + "\r\n", "\r\naddWaterSeedsWhenDiscovered=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " unlocking water seeds when discovered.");
                    break;

                case "AllowIndoorLongPlanterOutside":
                    ConfigSwitcher.AllowIndoorLongPlanterOutside = e.Value;
                    UpdateConfigFile("\r\nallowIndoorLongPlanterOutside=" + (e.Value ? "false" : "true") + "\r\n", "\r\nallowIndoorLongPlanterOutside=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Indoor long planter outside " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "AllowOutdoorLongPlanterInside":
                    ConfigSwitcher.AllowOutdoorLongPlanterInside = e.Value;
                    UpdateConfigFile("\r\nallowOutdoorLongPlanterInside=" + (e.Value ? "false" : "true") + "\r\n", "\r\nallowOutdoorLongPlanterInside=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Outdoor long planter inside " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                case "FixAquariumLighting":
                    ConfigSwitcher.FixAquariumLighting = e.Value;
                    if (e.Value)
                    {
                        PrefabsHelper.FixAquariumSkyApplier();
                        ErrorMessage.AddMessage("Aquarium lighting fix enabled.");
                    }
                    else
                    {
                        ErrorMessage.AddMessage("Restart game completely to disable aquarium lighting fix.");
                    }
                    UpdateConfigFile("\r\nfixAquariumLighting=" + (e.Value ? "false" : "true") + "\r\n", "\r\nfixAquariumLighting=" + (e.Value ? "true" : "false") + "\r\n");
                    break;

                case "GlowingAquariumGlass":
                    ConfigSwitcher.GlowingAquariumGlass = e.Value;
                    UpdateConfigFile("\r\nenableAquariumGlassGlowing=" + (e.Value ? "false" : "true") + "\r\n", "\r\nenableAquariumGlassGlowing=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Restart game completely to " + (e.Value ? "enable" : "disable") + " glowing effect.");
                    break;

                case "GhostLeviatan_enable":
                    ConfigSwitcher.GhostLeviatan_enable = e.Value;
                    UpdateConfigFile("\r\nGhostLeviatan_enable=" + (e.Value ? "false" : "true") + "\r\n", "\r\nGhostLeviatan_enable=" + (e.Value ? "true" : "false") + "\r\n");
                    ErrorMessage.AddMessage("Ghost Leviatan spawning " + (e.Value ? "enabled" : "disabled") + ".");
                    break;

                /*
                 * case "AlienRelic1Animation":
                 *  ConfigSwitcher.AlienRelic1Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic1Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic1Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 1 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic2Animation":
                 *  ConfigSwitcher.AlienRelic2Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic2Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic2Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 2 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic3Animation":
                 *  ConfigSwitcher.AlienRelic3Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic3Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic3Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 3 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic4Animation":
                 *  ConfigSwitcher.AlienRelic4Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic4Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic4Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 4 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic5Animation":
                 *  ConfigSwitcher.AlienRelic5Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic5Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic5Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 5 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic6Animation":
                 *  ConfigSwitcher.AlienRelic6Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic6Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic6Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 6 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic7Animation":
                 *  ConfigSwitcher.AlienRelic7Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic7Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic7Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 7 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic8Animation":
                 *  ConfigSwitcher.AlienRelic8Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic8Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic8Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 8 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic9Animation":
                 *  ConfigSwitcher.AlienRelic9Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic9Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic9Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 9 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic10Animation":
                 *  ConfigSwitcher.AlienRelic10Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic10Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic10Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 10 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 * case "AlienRelic11Animation":
                 *  ConfigSwitcher.AlienRelic11Animation = e.Value;
                 *  UpdateConfigFile("\r\nalienRelic11Animation=" + (e.Value ? "false" : "true") + "\r\n", "\r\nalienRelic11Animation=" + (e.Value ? "true" : "false") + "\r\n");
                 *  ErrorMessage.AddMessage("Alien relic 11 animation " + (e.Value ? "enabled" : "disabled") + ".");
                 *  break;
                 */
                default:
                    break;
                }
            }
        }