From 428533fec2721d7119e23a5a6b2aaac0e6107982 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 18:27:37 +1000 Subject: [PATCH] Let's try that again........ seems like I somehow got an old copy of SaveSystem.cs and committed that, re-introducing the game's dependency on Unite, which is dead, press F to pay respects. --- ShiftOS_TheReturn/SaveSystem.cs | 88 +++++++++++++++------------------ 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index b35277b..a4e79a7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,7 +79,6 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } - /// /// Start the entire ShiftOS engine. /// @@ -105,8 +104,6 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); - Random rnd = new Random(); - int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -141,19 +138,7 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); - if (loadingJoke1 == 0) - Console.WriteLine("[sos] Getting good and ready..."); - if (loadingJoke1 == 1) - Console.WriteLine("[sos] Shifting the OS..."); - if (loadingJoke1 == 2) - Console.WriteLine("[sos] Placing things everywhere..."); - if (loadingJoke1 == 3) - Console.WriteLine("[sos] Making an an errors..."); - if (loadingJoke1 == 4) - Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); - Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); - Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -178,22 +163,29 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //Connection successful! Stop waiting! + guidReceived = true; Console.WriteLine("[inetd] Connection successful."); }; try { - - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) + if (ServerManager.ServerOnline) { - Thread.Sleep(10); + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) + { + Thread.Sleep(10); + } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); + } + else + { + Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); } catch (Exception ex) { @@ -535,8 +527,10 @@ namespace ShiftOS.Engine { try { - Story.Start(CurrentSave.PickupPoint); - TerminalBackend.PrintPrompt(); + if (Story.Context == null) + { + Story.Start(CurrentSave.PickupPoint); + } } catch { } } @@ -643,40 +637,40 @@ namespace ShiftOS.Engine /// public static void SaveGame() { + if (IsSandbox == false) + { #if !NOSAVE - if (!IsSandbox) + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - if (!Shiftorium.Silent) - Console.WriteLine(""); - if (!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => { - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => + try { - try - { // please don't do networking on the main thread if you're just going to // discard the response, it's extremely slow ServerManager.SendMessage("mud_save", serialisedSaveFile); - } - catch { } - }) - { IsBackground = false }.Start(); - if (!System.IO.Directory.Exists(Paths.SaveDirectory)) - { - System.IO.Directory.CreateDirectory(Paths.SaveDirectory); - } + catch { } + }) + { IsBackground = false }.Start(); + if (!System.IO.Directory.Exists(Paths.SaveDirectory)) + { + System.IO.Directory.CreateDirectory(Paths.SaveDirectory); - System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); + + System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif + } } ///