From c86225fd823d9f07c85447e78c462c6cd39deff7 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sat, 18 May 2019 17:37:21 +0300 Subject: [PATCH] (dfb5c5dec) Option to determine the orientation of a wall in xml (if omitted, the orientation is determined automatically based on the dimensions of the wall instance, just like before). --- .../Source/Screens/ServerListScreen.cs | 16 +++++++ .../BarotraumaShared/Source/GameSettings.cs | 48 +++++++++++++++++++ .../BarotraumaShared/Source/Map/Structure.cs | 6 ++- .../Source/Map/StructurePrefab.cs | 14 ++++++ 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index 0344ba7c1..1f146ab06 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -218,6 +218,22 @@ namespace Barotrauma return true; } + private bool RefreshJoinButtonState(GUIComponent component, object obj) + { + if (obj == null || waitingForRefresh) { return false; } + + if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) + { + joinButton.Enabled = true; + } + else + { + joinButton.Enabled = false; + } + + return true; + } + private bool SelectServer(GUIComponent component, object obj) { if (obj == null || waitingForRefresh) { return false; } diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 9c026094d..9a3654bc8 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -821,6 +821,54 @@ namespace Barotrauma VoiceSetting = voiceSetting; } } + if (!SelectedContentPackages.Any()) + { + var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage); + if (availablePackage != null) + { + SelectedContentPackages.Add(availablePackage); + } + } + + //save to get rid of the invalid selected packages in the config file + if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); } + } + #endregion + + #region Save DefaultConfig + private void SaveNewDefaultConfig() + { + XDocument doc = new XDocument(); + + if (doc.Root == null) + { + doc.Add(new XElement("config")); + } + + doc.Root.Add( + new XAttribute("language", TextManager.Language), + new XAttribute("masterserverurl", MasterServerUrl), + new XAttribute("autocheckupdates", AutoCheckUpdates), + new XAttribute("musicvolume", musicVolume), + new XAttribute("soundvolume", soundVolume), + new XAttribute("voicechatvolume", voiceChatVolume), + new XAttribute("verboselogging", VerboseLogging), + new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs), + new XAttribute("enablesplashscreen", EnableSplashScreen), + new XAttribute("usesteammatchmaking", useSteamMatchmaking), + new XAttribute("quickstartsub", QuickStartSubmarineName), + new XAttribute("requiresteamauthentication", requireSteamAuthentication), + new XAttribute("aimassistamount", aimAssistAmount)); + + if (!ShowUserStatisticsPrompt) + { + doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics)); + } + + if (WasGameUpdated) + { + doc.Root.Add(new XAttribute("wasgameupdated", true)); + } useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking); requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication); diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index ad9a18c72..1256614ee 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -300,7 +300,11 @@ namespace Barotrauma TextureScale = sp.TextureScale; #endif spriteColor = prefab.SpriteColor; - if (ResizeHorizontal && !ResizeVertical) + if (sp.IsHorizontal.HasValue) + { + IsHorizontal = sp.IsHorizontal.Value; + } + else if (ResizeHorizontal && !ResizeVertical) { IsHorizontal = true; } diff --git a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs index 6105b453b..114128ef6 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs @@ -86,6 +86,15 @@ namespace Barotrauma private set; } + /// + /// If null, the orientation is determined automatically based on the dimensions of the structure instances + /// + public bool? IsHorizontal + { + get; + private set; + } + [Serialize(Direction.None, false)] public Direction StairDirection { @@ -168,6 +177,11 @@ namespace Barotrauma sp.Tags.Add(tag.Trim().ToLowerInvariant()); } + if (element.Attribute("ishorizontal") != null) + { + sp.IsHorizontal = element.GetAttributeBool("ishorizontal", false); + } + foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString())