////////////////

        public override void Load()
        {
            InvasionLogic.ModLoad();

            LoadHooks.AddPostWorldUnloadEachHook(() => {
                try {
                    var myworld = ModContent.GetInstance <DynamicInvasionsWorld>();
                    myworld.Uninitialize();
                } catch { }
            });
        }
示例#2
0
        ////////////////

        internal LoadHelpers()
        {
            LoadHooks.AddWorldLoadEachHook(() => {
                this.WorldStartupDelay = 0;
            });
            LoadHooks.AddWorldUnloadEachHook(() => {
                this.WorldStartupDelay       = 0;
                this.IsClientPlaying_Hackish = false;
            });
            LoadHooks.AddPostWorldUnloadEachHook(() => {              // Redundant?
                this.WorldStartupDelay       = 0;
                this.IsClientPlaying_Hackish = false;
            });
        }
        public override void Load()
        {
            LoadHooks.AddPostWorldUnloadEachHook(() => {
                try {
                    var myworld   = ModContent.GetInstance <RewardsWorld>();
                    myworld.Logic = null;
                } catch { }
            });

            DataDumper.SetDumpSource("Rewards", () => {
                if (Main.netMode == 2)
                {
                    return("  No 'current player' for server");
                }
                if (Main.myPlayer < 0 || Main.myPlayer >= Main.player.Length || Main.LocalPlayer == null || !Main.LocalPlayer.active)
                {
                    return("  Invalid player data");
                }

                var myplayer = (RewardsPlayer)TmlHelpers.SafelyGetModPlayer(Main.LocalPlayer, this, "RewardsPlayer");

                return("  IsFullySynced: " + myplayer.IsFullySynced);
            });
        }
        ////////////////

        internal void OnPostModsLoad()
        {
            LoadHooks.AddPostWorldUnloadEachHook(() => {
                this.PlayerIds = new Dictionary <int, string>();
            });
        }
        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);
            });
        }