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..594f05908 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) 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..a1900f957 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; 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 db28e72a4..9cda14371 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"), @@ -202,7 +204,33 @@ namespace Barotrauma private bool RefreshJoinButtonState(GUIComponent component, object obj) { - if (obj == null || waitingForRefresh) return false; + 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 (!string.IsNullOrWhiteSpace(clientNameBox.Text)) + { + joinButton.Enabled = true; + } + else + { + clientNameBox.Flash(); + joinButton.Enabled = false; + } if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) { @@ -264,8 +292,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()); @@ -286,17 +317,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; @@ -361,8 +394,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) @@ -502,6 +538,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 caf730a0b..81cb836b6 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -360,6 +360,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/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index aeb9279fe..1a5874252 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -115,9 +115,9 @@ namespace Barotrauma Vector2 currTargetSimPos = Vector2.Zero; currTargetSimPos = Target.SimPosition; // Take the sub position into account in the sim pos - if (SteeringManager != PathSteering && character.Submarine == null && Target.Submarine != null) + if (character.Submarine == null && Target.Submarine != null) { - currTargetSimPos += Target.Submarine.SimPosition; + //currTargetSimPos += Target.Submarine.SimPosition; } else if (character.Submarine != null && Target.Submarine == null) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs index 3f47266e4..1ff6c66b7 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/SteeringManager.cs @@ -45,9 +45,9 @@ namespace Barotrauma steering += DoSteeringWander(weight); } - public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1, Vector2? heading = null) + public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1) { - steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight, heading); + steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight); } public void SteeringManual(float deltaTime, Vector2 velocity) @@ -129,12 +129,10 @@ namespace Barotrauma return newSteering; } - protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight, Vector2? heading = null) + protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight) { - if (steering == Vector2.Zero || host.Steering == Vector2.Zero) - { - return Vector2.Zero; - } + if (steering == Vector2.Zero || host.Steering == Vector2.Zero) return Vector2.Zero; + float maxDistance = lookAheadDistance; if (rayCastTimer <= 0.0f) { @@ -160,11 +158,19 @@ namespace Barotrauma { obstaclePosition.X = closestStructure.SimPosition.X; } + avoidObstaclePos = obstaclePosition; + //avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - obstaclePosition); } + /*else if (closestBody.UserData is Item) + { + avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - item.SimPosition); + }*/ else { + avoidObstaclePos = Submarine.LastPickedPosition; + //avoidSteering = Vector2.Normalize(host.SimPosition - Submarine.LastPickedPosition); } } } @@ -179,26 +185,14 @@ namespace Barotrauma Vector2 diff = avoidObstaclePos.Value - host.SimPosition; float dist = diff.Length(); - if (dist > maxDistance) - { - return Vector2.Zero; - } - if (heading.HasValue) - { - var f = heading ?? host.Steering; - // Avoid to left or right depending on the current heading - Vector2 relativeVector = Vector2.Normalize(diff) - Vector2.Normalize(f); - var dir = relativeVector.X > 0 ? diff.Right() : diff.Left(); - float factor = 1.0f - Math.Min(dist / maxDistance, 1); - return dir * factor * weight; - } - else - { - // Doesn't work right because it effectively just slows down or reverses the movement, where as we'd like to go right or left to avoid the target. - // There's also another issue, which also affects going right or left: the raycast doesn't hit anything if we turn too much -> avoiding doesn't work well. - // Could probably "remember" the avoidance a bit longer so that the avoid steering is not immedieately disgarded, but kept for a while and reduced gradually? - return -diff * (1.0f - dist / maxDistance) * weight; - } + if (!avoidObstaclePos.HasValue) return Vector2.Zero; + + Vector2 diff = avoidObstaclePos.Value - host.SimPosition; + float dist = diff.Length(); + + if (dist > maxDistance) return Vector2.Zero; + + return -diff * (1.0f - dist / maxDistance) * weight; } } } diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 64b8a8358..4411dfe59 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,6 +424,79 @@ namespace Barotrauma { Language = doc.Root.GetAttributeString("language", "English"); } + } + + public void CheckBindings(bool useDefaults) + { + foreach (InputType inputType in Enum.GetValues(typeof(InputType))) + { + var binding = keyMapping[(int)inputType]; + if (binding == null) + { + switch (inputType) + { + case InputType.Deselect: + if (useDefaults) + { + binding = new KeyOrMouse(1); + } + else + { + // Legacy support + var selectKey = keyMapping[(int)InputType.Select]; + if (selectKey != null && selectKey.Key != Keys.None) + { + binding = new KeyOrMouse(selectKey.Key); + } + } + break; + case InputType.Shoot: + if (useDefaults) + { + binding = new KeyOrMouse(0); + } + else + { + // Legacy support + var useKey = keyMapping[(int)InputType.Use]; + if (useKey != null && useKey.MouseButton.HasValue) + { + binding = new KeyOrMouse(useKey.MouseButton.Value); + } + } + break; + default: + break; + } + if (binding == null) + { + DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!"); + binding = new KeyOrMouse(Keys.D1); + } + keyMapping[(int)inputType] = binding; + } + } + } + + #region Load DefaultConfig + private void LoadDefaultConfig(bool setLanguage = true) + { + XDocument doc = XMLExtensions.TryLoadXml(savePath); + + if (setLanguage || string.IsNullOrEmpty(Language)) + { + 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", ""); @@ -821,54 +894,6 @@ 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); @@ -934,55 +959,6 @@ namespace Barotrauma selectedContentPackagePaths = new HashSet(); - foreach (XElement subElement in doc.Root.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "keymapping": - LoadKeyBinds(subElement); - break; - case "gameplay": - jobPreferences = new List(); - foreach (XElement ele in subElement.Element("jobpreferences").Elements("job")) - { - string jobIdentifier = ele.GetAttributeString("identifier", ""); - if (string.IsNullOrEmpty(jobIdentifier)) continue; - jobPreferences.Add(jobIdentifier); - } - break; - case "player": - defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName); - CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex); - if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g)) - { - CharacterGender = g; - } - if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r)) - { - CharacterRace = r; - } - else - { - CharacterRace = Race.White; - } - CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex); - CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex); - CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex); - CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex); - break; - case "tutorials": - foreach (XElement tutorialElement in subElement.Elements()) - { - CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", "")); - } - break; - } - } - - UnsavedSettings = false; - - selectedContentPackagePaths = new HashSet(); - foreach (XElement subElement in doc.Root.Elements()) { gSettings = new XElement("graphicssettings"); 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())