示例#1
0
        private static void SaveRespawnShip(MyPlayer player)
        {
            if (!MySession.Static.Settings.RespawnShipDelete)
            {
                return;
            }

            System.Diagnostics.Debug.Assert(player.RespawnShip != null, "Saving a null respawn ship");
            if (player.RespawnShip == null)
            {
                return;
            }

            MyCubeGrid oldHome;

            if (MyEntities.TryGetEntityById <MyCubeGrid>(player.RespawnShip[0], out oldHome))
            {
                ulong  sizeInBytes = 0;
                string sessionPath = MySession.Static.CurrentPath;
                Console.WriteLine(sessionPath);
                string fileName = "RS_" + player.Client.SteamUserId + ".sbr";
                ParallelTasks.Parallel.Start(delegate()
                {
                    MyLocalCache.SaveRespawnShip((MyObjectBuilder_CubeGrid)oldHome.GetObjectBuilder(), sessionPath, fileName, out sizeInBytes);
                });
            }
        }