diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs index 8442fe1ba..86f4895d3 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs @@ -273,7 +273,7 @@ namespace Barotrauma { IsHorizontal = false }; - cprButton = new GUIButton(new RectTransform(new Point(80, 80), GUI.Canvas), text: "", style: "CPRButton") + cprButton = new GUIButton(new RectTransform(new Point((int)(80 * GUI.Scale)), GUI.Canvas), text: "", style: "CPRButton") { OnClicked = (button, userData) => { diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index 34de3d244..18093e0ed 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -396,8 +396,11 @@ namespace Barotrauma { MouseOn.DrawToolTip(spriteBatch); } - - Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition); + + if (GameMain.WindowActive) + { + Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, 0, Scale / 2f); + } } public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f) @@ -567,7 +570,7 @@ namespace Barotrauma private static void HandlePersistingElements(float deltaTime) { - if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt") + if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt" && GUIMessageBox.VisibleBox.UserData as string != "bugreporter") { GUIMessageBox.VisibleBox.AddToGUIUpdateList(); } @@ -582,7 +585,7 @@ namespace Barotrauma } //the "are you sure you want to quit" prompts are drawn on top of everything else - if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt") + if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt" || GUIMessageBox.VisibleBox?.UserData as string == "bugreporter") { GUIMessageBox.VisibleBox.AddToGUIUpdateList(); } @@ -1444,7 +1447,16 @@ namespace Barotrauma RelativeSpacing = 0.05f }; - var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge") + var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("bugreportbutton"), style: "GUIButtonLarge") + { + Color = Color.Red, + HoverColor = Color.DarkRed, + PressedColor = Color.White, + OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; } + }; + + + button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge") { OnClicked = TogglePauseMenu }; diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs index 39f531931..c633cc90e 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs @@ -91,7 +91,7 @@ namespace Barotrauma } InnerFrame.RectTransform.NonScaledSize = - new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50)); + new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + (int)(50 * GUI.yScale))); Content.RectTransform.NonScaledSize = new Point(Content.Rect.Width, height); } @@ -99,7 +99,7 @@ namespace Barotrauma Buttons = new List(buttons.Length); for (int i = 0; i < buttons.Length; i++) { - var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform, maxSize: new Point(300, 35)), buttons[i], style: "GUIButtonLarge"); + var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform), buttons[i], style: "GUIButtonLarge"); Buttons.Add(button); } diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs index 28a8f28a7..8d6a47a65 100644 --- a/Barotrauma/BarotraumaClient/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -334,7 +334,7 @@ namespace Barotrauma SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume); - SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume); + SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 5.0f); if (Config.EnableSplashScreen) { var pendingSplashScreens = TitleScreen.PendingSplashScreens; @@ -666,7 +666,7 @@ namespace Barotrauma (NetworkMember == null || !NetworkMember.GameStarted); #if !DEBUG - if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen) + if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen && Config.PauseOnFocusLost) { GUI.TogglePauseMenu(); paused = true; @@ -812,17 +812,19 @@ namespace Barotrauma // ToDo: Move texts/links to localization, when possible. public void ShowBugReporter() { - var msgBox = new GUIMessageBox("", ""); - var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f }; + var msgBox = new GUIMessageBox(TextManager.Get("bugreportbutton"), ""); + msgBox.UserData = "bugreporter"; + var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f }; + linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height); List> links = new List>() { - new Pair("Barotrauma Feedback Form","https://barotraumagame.com/feedback"), - new Pair("Github Issue Form (Needs account)","https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md") + new Pair(TextManager.Get("bugreportfeedbackform"),"https://barotraumagame.com/feedback"), + new Pair(TextManager.Get("bugreportgithubform"),"https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md") }; foreach (var link in links) { - new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) + new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) { UserData = link.Second, OnClicked = (btn, userdata) => @@ -833,6 +835,9 @@ namespace Barotrauma } }; } + + msgBox.InnerFrame.RectTransform.MinSize = new Point(0, + msgBox.InnerFrame.Rect.Height + linkHolder.Rect.Height + msgBox.Content.AbsoluteSpacing * 2 + (int)(50 * GUI.Scale)); } static bool waitForKeyHit = true; diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index b96b2f9c5..1dde7cb03 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -85,13 +85,6 @@ namespace Barotrauma TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont) { ForceUpperCase = true }; - //TODO: enable when new texts can be added - /*new GUIButton(new RectTransform(new Vector2(1.0f, 0.75f), settingsTitle.RectTransform, Anchor.CenterRight), style: "GUIBugButton") - { - ToolTip = "Bug Reporter", - OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; } - };*/ - var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft)); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages")); @@ -178,6 +171,12 @@ namespace Barotrauma }; } + new GUIButton(new RectTransform(new Vector2(0.05f, 0.75f), tabButtonHolder.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.0f, 0.2f) }, style: "GUIBugButton") + { + ToolTip = TextManager.Get("bugreportbutton"), + OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; } + }; + var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.08f), paddedFrame.RectTransform, Anchor.BottomCenter), style: null); /// Graphics tab -------------------------------------------------------------- @@ -464,10 +463,6 @@ namespace Barotrauma { DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime); } - deviceList.OnSelected = (GUIComponent selected, object obj) => - { - string name = obj as string; - if (VoiceCaptureDevice == name) { return true; } GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("DirectionalVoiceChat")); directionalVoiceChat.Selected = UseDirectionalVoiceChat; diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs index b304ac33e..b79bd9c75 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs @@ -543,7 +543,10 @@ namespace Barotrauma //equipped item that can't be put in the inventory, use delayed dropping if (quickUseAction == QuickUseAction.Drop) { - slots[i].QuickUseButtonToolTip = "Hold to unequip"; + slots[i].QuickUseButtonToolTip = + TextManager.Get("QuickUseAction.HoldToUnequip", returnNull: true) ?? + (GameMain.Config.Language == "English" ? "Hold to unequip" : TextManager.Get("QuickUseAction.Unequip")); + if (PlayerInput.LeftButtonHeld()) { slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime); diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs index 55caa8d4b..d588efa0d 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs @@ -89,7 +89,7 @@ namespace Barotrauma.Items.Components RelativeSpacing = 0.05f }; - new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), + var outLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), sliderArea.RectTransform), TextManager.Get("PumpOut"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont); pumpSpeedSlider = new GUIScrollBar(new RectTransform(new Vector2(0.8f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider") { @@ -109,9 +109,10 @@ namespace Barotrauma.Items.Components return true; } }; + var inLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), sliderArea.RectTransform), + TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont); - new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), - TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont); + GUITextBlock.AutoScaleAndNormalize(outLabel, inLabel); } public override void OnItemLoaded() diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs index bcce5950b..d5ab17ccb 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs @@ -143,7 +143,7 @@ namespace Barotrauma.Items.Components private void Draw(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval) { //spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); - GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont); + GUI.DrawString(spriteBatch, labelPos, DisplayName, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont); connectionSprite.Draw(spriteBatch, position); diff --git a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs index 550149d9f..46d973c57 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs @@ -281,7 +281,8 @@ namespace Barotrauma new Vector2(rect.Width, rect.Height), color: color, textureScale: TextureScale * Scale, - startOffset: backGroundOffset); + startOffset: backGroundOffset, + depth: Math.Max(Prefab.BackgroundSprite.Depth, depth + 0.000001f)); if (UseDropShadow) { diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 5807af85a..9215d7d70 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -903,7 +903,7 @@ namespace Barotrauma.Networking connected = false; ConnectToServer(serverIP); } - else + if (clientID == myID) { string msg = ""; if (disconnectReason == DisconnectReason.Unknown) @@ -921,8 +921,18 @@ namespace Barotrauma.Networking msg += TextManager.GetServerMessage(splitMsg[i]); } } - var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg); - msgBox.Buttons[0].OnClicked += ReturnToServerList; + + if (msg == NetConnection.NoResponseMessage) + { + //display a generic "could not connect" popup if the message is Lidgren's "failed to establish connection" + var msgBox = new GUIMessageBox(TextManager.Get("ConnectionFailed"), TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer")); + msgBox.Buttons[0].OnClicked += ReturnToServerList; + } + else + { + var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg); + msgBox.Buttons[0].OnClicked += ReturnToServerList; + } } } diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index 1fe366c5b..ae478d92d 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -31,6 +31,8 @@ namespace Barotrauma private bool masterServerResponded; private IRestResponse masterServerResponse; + private GUIButton refreshButton; + private float[] columnRelativeWidth; //filters @@ -140,7 +142,7 @@ namespace Barotrauma OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu }; - var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center), + refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center), "", style: "GUIButtonRefresh") { ToolTip = TextManager.Get("ServerListRefresh"), @@ -196,10 +198,6 @@ namespace Barotrauma UserData = "noresults" }; } - else - { - joinButton.Enabled = false; - } return true; } @@ -220,9 +218,35 @@ 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; + if (obj == null || waitingForRefresh) { return false; } + + if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) + { + joinButton.Enabled = true; + } + else + { + clientNameBox.Flash(); + joinButton.Enabled = false; + } if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) { @@ -258,8 +282,11 @@ namespace Barotrauma ipBox.Text = null; joinButton.Enabled = false; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), - TextManager.Get("RefreshingServerList")); + new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), + TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center) + { + CanBeFocused = false + }; CoroutineManager.StartCoroutine(WaitForRefresh()); @@ -280,17 +307,19 @@ namespace Barotrauma if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished)) { serverList.ClearChildren(); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), - TextManager.Get("ServerListNoSteamConnection")); + new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), + TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center) + { + CanBeFocused = false + }; } } else { CoroutineManager.StartCoroutine(SendMasterServerRequest()); + waitingForRefresh = false; } - waitingForRefresh = false; - refreshDisableTimer = DateTime.Now + AllowedRefreshInterval; yield return CoroutineStatus.Success; @@ -355,8 +384,11 @@ namespace Barotrauma serverList.Content.ClearChildren(); if (serverInfos.Count() == 0) { - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), - TextManager.Get("NoServers")); + new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), + TextManager.Get("NoServers"), textAlignment: Alignment.Center) + { + CanBeFocused = false + }; return; } foreach (ServerInfo serverInfo in serverInfos) @@ -496,6 +528,7 @@ namespace Barotrauma UserData = "noresults" }; } + waitingForRefresh = false; } private IEnumerable SendMasterServerRequest() diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs index 704ae4c9d..d7b1219b3 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs @@ -478,7 +478,7 @@ namespace Barotrauma } else { - var downloadBtn = new GUIButton(new RectTransform(new Point(32, 32), rightColumn.RectTransform), "+", style: null) + var downloadBtn = new GUIButton(new RectTransform(new Point((int)(32 * GUI.Scale)), rightColumn.RectTransform), "+", style: null) { Font = GUI.LargeFont, Color = new Color(38, 65, 86, 255), diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs index 2ea236421..b91b277b9 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -379,6 +379,9 @@ namespace Barotrauma if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime)) { Character.Speak(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order); +#if SERVER + GameMain.Server.SendOrderChatMessage(new OrderChatMessage(newOrder, "", Character.CurrentHull, null, Character)); +#endif } } } diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 753eb173f..b1e178700 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -45,7 +45,7 @@ namespace Barotrauma public bool PauseOnFocusLost { get; set; } = true; public bool MuteOnFocusLost { get; set; } - public bool UseDirectionalVoiceChat { get; set; } + public bool UseDirectionalVoiceChat { get; set; } = true; public enum VoiceMode { @@ -206,7 +206,7 @@ namespace Barotrauma { voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f); #if CLIENT - GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume); + GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume * 5.0f); #endif } } @@ -424,74 +424,6 @@ namespace Barotrauma { Language = doc.Root.GetAttributeString("language", "English"); } - } - - #region Load DefaultConfig - private void LoadDefaultConfig() - { - XDocument doc = XMLExtensions.TryLoadXml(savePath); - - Language = doc.Root.GetAttributeString("language", "English"); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); - - MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); - - AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true); - WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false); - - VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); - SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); - - QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); diff --git a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs index 695b56df0..68b5ca6df 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs @@ -609,8 +609,7 @@ namespace Barotrauma foreach (InterestingPosition pos in positionsOfInterest) { if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) continue; - if (Math.Abs(pos.Position.X - StartPosition.X) < 10000) continue; - if (Math.Abs(pos.Position.Y - StartPosition.Y) < 10000) continue; + if (Math.Abs(pos.Position.X - StartPosition.X) < minWidth * 2 || Math.Abs(pos.Position.X - EndPosition.X) < minWidth * 2) continue; if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue; iceChunkPositions.Add(pos.Position); } diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index b73eb5e65..ea5fb139f 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -301,6 +301,10 @@ namespace Barotrauma #endif spriteColor = prefab.SpriteColor; if (sp.IsHorizontal.HasValue) + { + IsHorizontal = sp.IsHorizontal.Value; + } + else if (ResizeHorizontal && !ResizeVertical) { IsHorizontal = true; } @@ -345,7 +349,7 @@ namespace Barotrauma } // Only add ai targets automatically to submarine/outpost walls - if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null) + if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null && !Prefab.NoAITarget) { aiTarget = new AITarget(this); } diff --git a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs index b049e8d8e..b43be342f 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs @@ -184,6 +184,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())