Beispiel #1
0
        public override void Entry(IModHelper helper)
        {
            Config = helper.ReadConfig <AnythingPondsConfig>();
            helper.Events.Input.ButtonPressed += Input_ButtonPressed;

            if (Config.Enable_Algae_and_Seaweed_Pond_Definitions)
            {
                AlgaePondData = helper.Data.ReadJsonFile <AnythingPondsPondData>("pond_algae.json");
                if (AlgaePondData == null)
                {
                    Monitor.Log("Can't find algae json file; a fresh copy will be created.", LogLevel.Info);
                    AlgaePondData = new AnythingPondsPondData("Algae");
                    helper.Data.WriteJsonFile("pond_algae.json", AlgaePondData);
                }
                else
                {
                    Monitor.Log("Algae json file loaded.");
                }
            }
            GenericPondData = helper.Data.ReadJsonFile <AnythingPondsPondData>("pond_generic.json");
            if (GenericPondData == null)
            {
                Monitor.Log("Can't find generic pond json file; a fresh copy will be created.", LogLevel.Info);
                GenericPondData = new AnythingPondsPondData("Generic");
                helper.Data.WriteJsonFile("pond_generic.json", GenericPondData);
            }
            else
            {
                Monitor.Log("Generic pond json file loaded.");
            }

            // Originally I had these all wrapped in an if (Config.Allow_Empty_Ponds_to_Become_Algae_or_Seaweed),
            //  but now we are tracking the ponds regardless mainly so that if somebody decides they want to turn
            //  that feature on and already have empty ponds they won't have to wait additional time. This does
            //  mean a bit of extra info is stored in saves that the user doesn't need if the option is off.
            helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded;
            helper.Events.GameLoop.Saving     += GameLoop_Saving;
            helper.Events.GameLoop.DayStarted += GameLoop_DayStarted;

            Helper.Content.InvalidateCache("Data/FishPondData");
        }