38f1ddb...178a853: v0.8.9.1, removed content folder

This commit is contained in:
Joonas Rikkonen
2019-03-18 19:46:58 +02:00
parent 38f1ddb6fe
commit 6c0679c297
1054 changed files with 151673 additions and 144931 deletions
@@ -79,7 +79,7 @@ namespace Barotrauma
if (int.TryParse(string.Join(" ", args), out index))
{
if (index > 0 && index < GameMain.NetLobbyScreen.GameModes.Length &&
GameMain.NetLobbyScreen.GameModes[index].Name == "Campaign")
GameMain.NetLobbyScreen.GameModes[index].Identifier == "multiplayercampaign")
{
MultiPlayerCampaign.StartCampaignSetup();
}
@@ -97,16 +97,22 @@ namespace Barotrauma
}
else
{
GameMain.NetLobbyScreen.SelectedModeName = modeName;
var gameMode = GameModePreset.List.Find(gm => gm.Name.ToLower() == modeName.ToLower());
if (gameMode == null)
{
ThrowError("Game mode \"" + modeName + "\" not found!");
return;
}
GameMain.NetLobbyScreen.SelectedModeIdentifier = gameMode.Identifier;
}
}
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeIdentifier, Color.Cyan);
},
() =>
{
return new string[][]
{
GameModePreset.list.Select(gm => gm.Name).ToArray()
GameModePreset.List.Select(gm => gm.Name).ToArray()
};
}));
@@ -127,7 +133,7 @@ namespace Barotrauma
{
return new string[][]
{
MissionPrefab.MissionTypes.ToArray()
Enum.GetValues(typeof(MissionType)).Cast<string>().ToArray()
};
}));
+52 -29
View File
@@ -1,4 +1,5 @@
using Barotrauma.Networking;
using Barotrauma.Steam;
using FarseerPhysics.Dynamics;
using GameAnalyticsSDK.Net;
using Microsoft.Xna.Framework;
@@ -6,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Xml.Linq;
@@ -41,25 +43,19 @@ namespace Barotrauma
//null screens because they are not implemented by the server,
//but they're checked for all over the place
//TODO: maybe clean up instead of having these constants
public static readonly Screen MainMenuScreen = UnimplementedScreen.Instance;
public static readonly Screen LobbyScreen = UnimplementedScreen.Instance;
public static readonly Screen ServerListScreen = UnimplementedScreen.Instance;
public static readonly Screen SubEditorScreen = UnimplementedScreen.Instance;
public static readonly Screen CharacterEditorScreen = UnimplementedScreen.Instance;
public static bool ShouldRun = true;
public static ContentPackage SelectedPackage
public static HashSet<ContentPackage> SelectedPackages
{
get { return Config.SelectedContentPackage; }
get { return Config.SelectedContentPackages; }
}
public GameMain()
{
Instance = this;
World = new World(new Vector2(0, -9.82f));
FarseerPhysics.Settings.AllowSleep = true;
FarseerPhysics.Settings.ContinuousPhysics = false;
@@ -71,14 +67,14 @@ namespace Barotrauma
{
UpdaterUtil.CleanOldFiles();
Config.WasGameUpdated = false;
Config.Save("config.xml");
Config.Save();
}
if (GameSettings.SendUserStatistics)
{
GameAnalyticsManager.Init();
}
TextManager.LoadTextPacks();
SteamManager.Initialize();
if (GameSettings.SendUserStatistics) GameAnalyticsManager.Init();
GameScreen = new GameScreen();
}
@@ -86,15 +82,19 @@ namespace Barotrauma
{
MissionPrefab.Init();
MapEntityPrefab.Init();
MapGenerationParams.Init();
LevelGenerationParams.LoadPresets();
ScriptedEventSet.LoadPrefabs();
JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs));
StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure));
ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item));
StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure));
ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item));
JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs));
NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations));
ItemAssemblyPrefab.LoadAll();
LevelObjectPrefab.LoadAll();
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
GameModePreset.Init();
LocationType.Init();
Submarine.RefreshSavedSubs();
@@ -109,37 +109,51 @@ namespace Barotrauma
private void CheckContentPackage()
{
var exePaths = Config.SelectedContentPackage.GetFilesOfType(ContentType.ServerExecutable);
if (exePaths.Count > 0 && AppDomain.CurrentDomain.FriendlyName != exePaths[0])
foreach (ContentPackage contentPackage in Config.SelectedContentPackages)
{
DebugConsole.ShowQuestionPrompt(TextManager.Get("IncorrectExe")
.Replace("[selectedpackage]", Config.SelectedContentPackage.Name)
.Replace("[exename]", exePaths[0]),
(option) =>
var exePaths = contentPackage.GetFilesOfType(ContentType.ServerExecutable);
if (exePaths.Count() > 0 && AppDomain.CurrentDomain.FriendlyName != exePaths.First())
{
DebugConsole.ShowQuestionPrompt(TextManager.Get("IncorrectExe")
.Replace("[selectedpackage]", contentPackage.Name)
.Replace("[exename]", exePaths.First()),
(option) =>
{
if (option.ToLower() == "y" || option.ToLower() == "yes")
{
string fullPath = Path.GetFullPath(exePaths[0]);
string fullPath = Path.GetFullPath(exePaths.First());
Process.Start(fullPath);
ShouldRun = false;
}
}
});
break;
}
}
}
/// <summary>
/// Returns the file paths of all files of the given type in the currently selected content packages.
/// </summary>
public IEnumerable<string> GetFilesOfType(ContentType type)
{
return ContentPackage.GetFilesOfType(SelectedPackages, type);
}
public void StartServer()
{
XDocument doc = XMLExtensions.TryLoadXml(GameServer.SettingsFile);
if (doc == null)
{
DebugConsole.ThrowError("File \"" + GameServer.SettingsFile + "\" not found. Starting the server with default settings.");
Server = new GameServer("Server", 14242, false, "", false, 10);
Server = new GameServer("Server", NetConfig.DefaultPort, NetConfig.DefaultQueryPort, false, "", false, 10);
return;
}
Server = new GameServer(
doc.Root.GetAttributeString("name", "Server"),
doc.Root.GetAttributeInt("port", 14242),
doc.Root.GetAttributeInt("port", NetConfig.DefaultPort),
doc.Root.GetAttributeInt("queryport", NetConfig.DefaultQueryPort),
doc.Root.GetAttributeBool("public", false),
doc.Root.GetAttributeString("password", ""),
doc.Root.GetAttributeBool("enableupnp", false),
@@ -184,6 +198,7 @@ namespace Barotrauma
DebugConsole.Update();
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
Server.Update((float)Timing.Step);
SteamManager.Update((float)Timing.Step);
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
Timing.Accumulator -= Timing.Step;
@@ -194,6 +209,9 @@ namespace Barotrauma
stopwatch.Stop();
CloseServer();
SteamManager.ShutDown();
if (GameSettings.SendUserStatistics) GameAnalytics.OnStop();
}
public void ProcessInput()
@@ -212,5 +230,10 @@ namespace Barotrauma
{
return CoroutineManager.StartCoroutine(loader);
}
public void Exit()
{
ShouldRun = false;
}
}
}
@@ -16,7 +16,8 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(saveName)) return;
string savePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer, saveName);
GameMain.GameSession = new GameSession(new Submarine(GameMain.NetLobbyScreen.SelectedSub.FilePath, ""), savePath, GameModePreset.list.Find(g => g.Name == "Campaign"));
GameMain.GameSession = new GameSession(new Submarine(GameMain.NetLobbyScreen.SelectedSub.FilePath, ""), savePath,
GameModePreset.List.Find(g => g.Identifier == "multiplayercampaign"));
var campaign = ((MultiPlayerCampaign)GameMain.GameSession.GameMode);
campaign.GenerateMap(GameMain.NetLobbyScreen.LevelSeed);
campaign.SetDelegates();
@@ -25,7 +25,7 @@ namespace Barotrauma.Items.Components
get;
set;
}
public override void Move(Vector2 amount)
{
//do nothing
@@ -11,7 +11,7 @@ namespace Barotrauma.Networking
void InitUPnP()
{
server.UPnP.ForwardPort(config.Port, "barotrauma");
server.UPnP.ForwardPort(NetPeerConfiguration.Port, "barotrauma");
}
bool DiscoveringUPnP()
@@ -9,6 +9,10 @@
public CharacterInfo CharacterInfo
{
get { return null; }
set
{
//do nothing
}
}
public Character Character
@@ -86,6 +86,16 @@ namespace Barotrauma
return false;
}
public static bool MidButtonClicked()
{
return false;
}
public static bool MidButtonHeld()
{
return false;
}
public static bool DoubleClicked()
{
return false;
@@ -1,8 +1,10 @@
#region Using Statements
using Barotrauma.Steam;
using GameAnalyticsSDK.Net;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
@@ -32,10 +34,11 @@ namespace Barotrauma
game.Run();
inputThread.Abort(); inputThread.Join();
if (GameSettings.SendUserStatistics) GameAnalytics.OnStop();
SteamManager.ShutDown();
}
catch (Exception e)
{
CrashDump(game, "servercrashreport.txt", e);
CrashDump(game, "servercrashreport.log", e);
inputThread.Abort(); inputThread.Join();
}
}
@@ -50,7 +53,7 @@ namespace Barotrauma
sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! ");
sb.AppendLine("\n");
sb.AppendLine("Game version " + GameMain.Version);
sb.AppendLine("Selected content package: " + GameMain.SelectedPackage.Name);
sb.AppendLine("Selected content packages: " + (!GameMain.SelectedPackages.Any() ? "None" : string.Join(", ", GameMain.SelectedPackages.Select(c => c.Name))));
sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed));
sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")"));
sb.AppendLine("Selected screen: " + (Screen.Selected == null ? "None" : Screen.Selected.ToString()));
@@ -94,6 +97,7 @@ namespace Barotrauma
Console.Write("A crash report(\"crashreport.log\") was saved in the root folder of the game. The error was not sent to the developers because user statistics have been disabled, but" +
" if you'd like to help fix this bug, you may post it on Barotrauma's GitHub issue tracker: https://github.com/Regalis11/Barotrauma/issues/");
}
SteamManager.ShutDown();
}
}
}
@@ -45,14 +45,14 @@ namespace Barotrauma
}
}
public string SelectedModeName
public string SelectedModeIdentifier
{
get { return gameModes[SelectedModeIndex].Name; }
get { return gameModes[SelectedModeIndex].Identifier; }
set
{
for (int i = 0; i < gameModes.Count(); i++)
for (int i = 0; i < gameModes.Length; i++)
{
if (gameModes[i].Name.ToLower() == value.ToLower())
if (gameModes[i].Identifier.ToLower() == value.ToLower())
{
SelectedModeIndex = i;
break;
@@ -75,26 +75,22 @@ namespace Barotrauma
set
{
lastUpdateID++;
missionTypeIndex = Math.Max(0, Math.Min(MissionPrefab.MissionTypes.Count() - 1, value));
missionTypeIndex = MathHelper.Clamp(value, 0, Enum.GetValues(typeof(MissionType)).Length - 1);
}
}
public string MissionTypeName
{
get { return MissionPrefab.MissionTypes[MissionTypeIndex]; }
get { return ((MissionType)missionTypeIndex).ToString(); }
set
{
for (int i = 0; i < MissionPrefab.MissionTypes.Count(); i++)
if (Enum.TryParse(value, out MissionType missionType))
{
if (MissionPrefab.MissionTypes[i].ToLower() == value.ToLower())
{
MissionTypeIndex = i;
break;
}
missionTypeIndex = (int)missionType;
}
}
}
public void ChangeServerName(string n)
{
ServerName = n; lastUpdateID++;
@@ -130,7 +126,7 @@ namespace Barotrauma
DebugConsole.NewMessage("Selected sub: " + SelectedSub.Name, Color.White);
DebugConsole.NewMessage("Selected shuttle: " + SelectedShuttle.Name, Color.White);
gameModes = GameModePreset.list.ToArray();
gameModes = GameModePreset.List.ToArray();
}
private List<Submarine> subs;
@@ -165,7 +161,7 @@ namespace Barotrauma
{
for (int i = 0; i < GameModes.Length; i++)
{
if ((GameModes[i].Name == "Campaign") == enabled)
if ((GameModes[i].Identifier == "multiplayercampaign") == enabled)
{
selectedModeIndex = i;
break;
@@ -192,8 +188,8 @@ namespace Barotrauma
}
if (GameMain.Server.ModeSelectionMode == SelectionMode.Random)
{
var allowedGameModes = Array.FindAll(gameModes, m => !m.IsSinglePlayer && m.Name != "Campaign");
SelectedModeName = allowedGameModes[Rand.Range(0, allowedGameModes.Length)].Name;
var allowedGameModes = Array.FindAll(gameModes, m => !m.IsSinglePlayer && m.Identifier != "multiplayercampaign");
SelectedModeIdentifier = allowedGameModes[Rand.Range(0, allowedGameModes.Length)].Identifier;
}
}
}