diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs index bf80ea025..5192c5a0f 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs @@ -331,8 +331,11 @@ namespace Barotrauma if (!string.IsNullOrEmpty(text)) { Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset; - pos.X = (int)pos.X; - pos.Y = (int)pos.Y; + if (RoundToNearestPixel) + { + pos.X = (int)pos.X; + pos.Y = (int)pos.Y; + } Font.DrawString(spriteBatch, Wrap ? wrappedText : text, diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs index 512abe647..c837950c7 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs @@ -105,7 +105,8 @@ namespace Barotrauma.Items.Components textBlock = new GUITextBlock(new RectTransform(item.Rect.Size), "", textColor: textColor, font: GUI.UnscaledSmallFont, textAlignment: Alignment.Center, wrap: true, style: null) { - TextDepth = item.SpriteDepth - 0.0001f, + TextDepth = item.SpriteDepth - 0.00001f, + RoundToNearestPixel = false, TextScale = TextScale }; } diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs index 5ee4d596f..b4cdb82cc 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs @@ -2408,7 +2408,10 @@ namespace Barotrauma.Networking if (senderCharacter != null && client.Character != null && !client.Character.IsDead) { - modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character); + if (senderCharacter != client.Character) + { + modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character); + } //too far to hear the msg -> don't send if (string.IsNullOrWhiteSpace(modifiedMessage)) continue; @@ -2457,13 +2460,16 @@ namespace Barotrauma.Networking if (message.Sender != null && client.Character != null && !client.Character.IsDead) { - modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character); + if (message.Sender != client.Character) + { + modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character); + } //too far to hear the msg -> don't send if (string.IsNullOrWhiteSpace(modifiedMessage)) continue; } - SendDirectChatMessage(message, client); + SendDirectChatMessage(new OrderChatMessage(message.Order, message.OrderOption, message.TargetEntity, message.TargetCharacter, message.Sender), client); } string myReceivedMessage = message.Text; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index 9e0a92f58..7fe272a64 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -117,7 +117,7 @@ namespace Barotrauma // Take the sub position into account in the sim pos 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/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 6b3637a52..d6722b111 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -424,79 +424,6 @@ 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", ""); @@ -959,6 +886,55 @@ 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");