示例#1
0
        private void UpdateMe(On.Terraria.Main.orig_UpdateMenu orig)
        {
            if (Main.mouseMiddle && !genning)
            {
                genning = true;
                PutMeInAWorld();
            }

            if (genning && !WorldGen.gen && Main.menuMode != 888)
            {
                using (FileStream f = File.Create(ModLoader.ModPath + "/TempWorld"))
                {
                    BinaryWriter w = new BinaryWriter(f);
                    WorldFile.SaveWorld_Version2(w);
                }

                var temp = new PlayerFileData(ModLoader.ModPath + "/TempPlayer", false);
                temp.Name        = "Temporary Player";
                temp.Player      = new Player();
                temp.Player.name = "Temporary Player";
                temp.Metadata    = FileMetadata.FromCurrentSettings(FileType.Player);

                Main.player[0] = temp.Player;

                Main.ActivePlayerFileData = temp;

                WorldGen.playWorld();
                genning = false;
            }

            orig();
        }