- Autorestart works in campaign mode.

- The server select a random destination when the campaign starts and after each round, so the campaign can be played even if there's no host/client to choose the destinations. (TODO: make it possible to vote for the destination?)
- Reverting to the previous save if the entire crew is dead works correctly now.
- Clients load the campaign saves after receiving them (-> discovered locations/connections are synced with clients).
This commit is contained in:
Joonas Rikkonen
2017-09-19 22:05:42 +03:00
parent e26600d088
commit f291a22976
12 changed files with 207 additions and 168 deletions
@@ -6,7 +6,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
public partial class SaveUtil
partial class SaveUtil
{
public static string SaveFolder = "Data" + Path.DirectorySeparatorChar + "Saves";
public static string MultiplayerSaveFolder = "Data" + Path.DirectorySeparatorChar + "Saves" + Path.DirectorySeparatorChar + "Multiplayer";
@@ -92,6 +92,13 @@ namespace Barotrauma
GameMain.GameSession = new GameSession(selectedSub, filePath, doc);
}
public static void LoadGame(string filePath, GameSession gameSession)
{
DecompressToDirectory(filePath, TempPath, null);
XDocument doc = ToolBox.TryLoadXml(Path.Combine(TempPath, "gamesession.xml"));
gameSession.Load(doc.Root);
}
public static XDocument LoadGameSessionDoc(string filePath)
{
string tempPath = Path.Combine(SaveFolder, "temp");
@@ -110,8 +117,6 @@ namespace Barotrauma
public static void DeleteSave(string filePath)
{
//filePath = Path.Combine(SaveFolder, filePath + ".save");
try
{
File.Delete(filePath);