示例#1
0
        ////

        public override void PostSetupContent()
        {
            LoadHooks.AddPostWorldLoadEachHook(() => {
                if (Main.netMode != 1)
                {
                    var myworld = ModContent.GetInstance <AmbushesWorld>();
                    myworld.InitializeAmbushesAsync(myworld.MaxAmbushes);
                }
            });
        }
示例#2
0
        ////////////////

        public override void Load()
        {
            BetterPaintMod.Instance = this;

            LoadHooks.AddPostWorldLoadEachHook(() => {
                string intro1    = "1 of 5 - Eager to try out better painting? You'll need a Paint Blaster, crafted via " + (this.Config.PaintBlasterRecipeClentaminator ? "Clentaminator" : "Illegal Gun Parts") + " and Paint Sprayer at a Tinkerer's Workshop.";
                string intro2    = "2 of 5 - To make paint, you'll need a Paint Mixer, crafted via Dye Vat" + (this.Config.PaintMixerRecipeBlendOMatic ? ", Blend-O-Matic, " : " ") + "and Extractinator at a Tinkerer's Workshop.";
                string intro3    = "3 of 5 - To paint, you'll need Color Cartridges, crafted via colored Paints (any " + this.Config.PaintRecipePaints + ") and Gel (" + this.Config.PaintRecipeGels + ") at a Paint Mixer.";
                string postIntro = "4 of 5 - Use the Control Panel (single player only) to configure settings, including whether the Painter NPC should sell Better Paint items, if crafting isn't your cup of tea.";
                string pander    = "5 of 5 - If you enjoy this mod and want to see more, please give your support at: https://www.patreon.com/hamstar0";

                InboxMessages.SetMessage("BetterPaintIntro1", intro1, false);
                InboxMessages.SetMessage("BetterPaintIntro2", intro2, false);
                InboxMessages.SetMessage("BetterPaintIntro3", intro3, false);
                InboxMessages.SetMessage("BetterPaintPostIntro", postIntro, false);
                InboxMessages.SetMessage("BetterPaintPander", pander, false);

                if (Main.netMode != 0)
                {
                    InboxMessages.SetMessage("BetterPaintNoMuliYet", "Better Paint (as of v1.2.0) is not yet compatible with multiplayer.", true);
                }
            });
        }
        internal void OnModLoad()
        {
            LoadHooks.AddPostModLoadHook(() => {
                var hook = new CustomTimerAction(delegate() {
                    if (Main.netMode == 1)
                    {
                        return;
                    }
                    this.ExpireCurrentWorldInSession(ResetModeMod.Instance);
                });

                TimeLimitAPI.AddCustomAction("reset", hook);

                this.Load();
                this.LoadRewards();
            });


            LoadHooks.AddPostWorldLoadEachHook(delegate {
                var mymod = ResetModeMod.Instance;

                if (mymod.Config.AutoStartSession)
                {
                    if (Main.netMode == 0 || Main.netMode == 2)
                    {
                        this.StartSession();
                    }
                }

                this.IsWorldInPlay = true;
            });


            LoadHooks.AddWorldUnloadEachHook(() => {
                this.IsWorldInPlay = false;
            });


            LoadHooks.AddPostWorldUnloadEachHook(() => {
                var mymod = ResetModeMod.Instance;

                if (mymod.Config.DebugModeInfo)
                {
                    LogHelpers.Alert("(In promise) - Unloading world...");
                }

                this.IsExiting = false;

                if (mymod.CurrentNetMode == 0 || mymod.CurrentNetMode == 2)
                {
                    if (mymod.Config.DeleteAllWorldsBetweenGames)
                    {
                        if (this.Data.AwaitingNextWorld)
                        {
                            this.ClearAllWorlds();
                        }
                    }

                    this.Save();
                }

                CustomLoadHooks.TriggerHook(ResetModeMod.WorldExitValidator, ResetModeMod.MyValidatorKey);
            });
        }