Esempio n. 1
0
        public override void Entry(IModHelper helper)
        {
            // init
            Logger = Monitor;
            Config = helper.ReadConfig <FrameworkConfig>();

            // init content registry
            var contentHelperWrapper = new ContentHelperWrapper(this.Helper.Content, this.Monitor);

            contentHelperWrapper.AssetLoaders.Add(
                ContentRegistry.Init(contentHelperWrapper, this.Helper.DirectoryPath)
                );

            // add console commands
            Logger.Log("Registering framework events...", LogLevel.Trace);
            helper.ConsoleCommands.Add("ef_bushreset", "Resets bushes in the whole game, use this if you installed a map mod and want to keep using your old save.", Internal.BushReset.Trigger);
            if (Config.TrainerCommands)
            {
                helper.ConsoleCommands
                .Add("farm_settype", "farm_settype <type> | Enables you to change your farm type to any of the following: " + string.Join(",", Commands.Commands.Farms), Commands.Commands.farm)
                .Add("farm_clear", "farm_clear | Removes ALL objects from your farm, this cannot be undone!", Commands.Commands.farm)

                .Add("player_warp", "player_warp <location> <x> <y> | Warps the player to the given position in the game.", Commands.Commands.player);
            }

            // add events
            GameEvents.UpdateTick += FirstUpdateTick;
            SaveEvents.AfterLoad  += SaveEvents_AfterLoad;
            Events.MoreEvents.Setup();
            GameEvents.UpdateTick         += TypeRegistry.Update;
            SaveEvents.AfterReturnToTitle += SaveEvents_AfterReturnToTitle;
            if (Config.SkipCredits)
            {
                GameEvents.UpdateTick += CreditsTick;
            }
            Logger.Log("Framework has finished!", LogLevel.Info);

            // version check
            VersionChecker.AddCheck("EntoaroxFramework", Version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/EntoaroxFramework.json");
        }