diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs index 846e82d39..a3d57f795 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs @@ -449,11 +449,12 @@ namespace Barotrauma { float depth = ActiveSprite.Depth - 0.0000015f; - DamagedSprite.Draw(spriteBatch, - new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), - color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin, - -body.DrawRotation, - 1.0f, spriteEffect, depth); + // TODO: enable when the damage overlay textures have been remade. + //DamagedSprite.Draw(spriteBatch, + // new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), + // color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin, + // -body.DrawRotation, + // 1.0f, spriteEffect, depth); } if (GameMain.DebugDraw) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index a95140454..69b2aa985 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -20,8 +20,8 @@ namespace Barotrauma /// const float CharacterWaitOnSwitch = 10.0f; - private readonly List characterInfos = new List(); - private readonly List characters = new List(); + private List characterInfos = new List(); + private List characters = new List(); private Point screenResolution; diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs index ad998bd39..0bb370465 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs @@ -256,18 +256,6 @@ namespace Barotrauma { if (c.Info == null || c.Inventory == null) { continue; } var inventoryElement = new XElement("inventory"); - - // Recharge headset batteries - var headset = c.Inventory.FindItemByIdentifier("headset"); - if (headset != null) - { - var battery = headset.OwnInventory.FindItemByTag("loadable"); - if (battery != null) - { - battery.Condition = battery.MaxCondition; - } - } - c.SaveInventory(c.Inventory, inventoryElement); c.Info.InventoryData = inventoryElement; c.Inventory?.DeleteAllItems(); diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs index 2ebb44dc4..8c3597b8d 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -620,7 +620,6 @@ namespace Barotrauma { if (DraggingItemToWorld && Character.Controlled.FocusedItem?.OwnInventory != null && - Character.Controlled.FocusedItem.OwnInventory.CanBePut(draggingItem) && Character.Controlled.FocusedItem.OwnInventory.TryPutItem(draggingItem, Character.Controlled)) { GUI.PlayUISound(GUISoundType.PickItem); diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs index fe1140184..28a1f7b89 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs @@ -142,27 +142,24 @@ namespace Barotrauma backgroundPos.Y = -backgroundPos.Y; backgroundPos *= 0.05f; - if (level.GenerationParams.BackgroundTopSprite != null) + + if (backgroundPos.Y < 1024) { - int backgroundSize = (int)level.GenerationParams.BackgroundTopSprite.size.Y; - if (backgroundPos.Y < backgroundSize) + if (backgroundPos.Y < 0 && level.GenerationParams.BackgroundTopSprite != null) { - if (backgroundPos.Y < 0) - { - var backgroundTop = level.GenerationParams.BackgroundTopSprite; - backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, backgroundSize, (int)Math.Min(-backgroundPos.Y, backgroundSize)); - backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)), - color: level.BackgroundTextureColor); - } - if (-backgroundPos.Y < GameMain.GraphicsHeight && level.GenerationParams.BackgroundSprite != null) - { - var background = level.GenerationParams.BackgroundSprite; - background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), backgroundSize, backgroundSize); - background.DrawTiled(spriteBatch, - (backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero, - new Vector2(GameMain.GraphicsWidth, (int)Math.Min(Math.Ceiling(backgroundSize - backgroundPos.Y), backgroundSize)), - color: level.BackgroundTextureColor); - } + var backgroundTop = level.GenerationParams.BackgroundTopSprite; + backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024)); + backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)), + color: level.BackgroundTextureColor); + } + if (backgroundPos.Y > -1024 && level.GenerationParams.BackgroundSprite != null) + { + var background = level.GenerationParams.BackgroundSprite; + background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), 1024, 1024); + background.DrawTiled(spriteBatch, + (backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero, + new Vector2(GameMain.GraphicsWidth, (int)Math.Ceiling(1024 - backgroundPos.Y)), + color: level.BackgroundTextureColor); } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs index 215e2db4d..91dd8e015 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs @@ -483,26 +483,6 @@ namespace Barotrauma { if (selectedList.Contains(entity)) { return; } selectedList.Add(entity); - HandleDoorGapLinks(entity, - onGapFound: (door, gap) => - { - door.RefreshLinkedGap(); - if (!selectedList.Contains(gap)) - { - selectedList.Add(gap); - } - }, - onDoorFound: (door, gap) => - { - if (!selectedList.Contains(door.Item)) - { - selectedList.Add(door.Item); - } - }); - } - - private static void HandleDoorGapLinks(MapEntity entity, Action onGapFound, Action onDoorFound) - { if (entity is Item i) { var door = i.GetComponent(); @@ -511,26 +491,31 @@ namespace Barotrauma var gap = door.LinkedGap; if (gap != null) { - onGapFound(door, gap); + door.RefreshLinkedGap(); + if (!selectedList.Contains(gap)) + { + selectedList.Add(gap); + } } } } - else if (entity is Gap gap) - { - var door = gap.ConnectedDoor; - if (door != null) - { - onDoorFound(door, gap); - } - } } public static void RemoveSelection(MapEntity entity) { selectedList.Remove(entity); - HandleDoorGapLinks(entity, - onGapFound: (door, gap) => selectedList.Remove(gap), - onDoorFound: (door, gap) => selectedList.Remove(door.Item)); + if (entity is Item i) + { + var door = i.GetComponent(); + if (door != null) + { + var gap = door.LinkedGap; + if (gap != null) + { + selectedList.Remove(gap); + } + } + } } static partial void UpdateAllProjSpecific(float deltaTime) @@ -600,11 +585,12 @@ namespace Barotrauma public static void UpdateEditor(Camera cam) { + FilteredSelectedList.Clear(); if (highlightedListBox != null) highlightedListBox.UpdateManually((float)Timing.Step); if (editingHUD != null) { - if (FilteredSelectedList.Count == 0 || editingHUD.UserData != FilteredSelectedList[0]) + if (selectedList.Count == 0 || editingHUD.UserData != selectedList[0]) { foreach (GUIComponent component in editingHUD.Children) { @@ -615,7 +601,7 @@ namespace Barotrauma editingHUD = null; } } - FilteredSelectedList.Clear(); + if (selectedList.Count == 0) return; foreach (var e in selectedList) { diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs index ee84ed139..4f96e0cdc 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs @@ -441,43 +441,36 @@ namespace Barotrauma characterPreviewFrame = null; } - if (characterList != null) + if (Campaign is SinglePlayerCampaign) { - if (Campaign is SinglePlayerCampaign) + var hireableCharacters = location.GetHireableCharacters(); + foreach (GUIComponent child in characterList.Content.Children.ToList()) { - var hireableCharacters = location.GetHireableCharacters(); - foreach (GUIComponent child in characterList.Content.Children.ToList()) + if (child.UserData is CharacterInfo character) { - if (child.UserData is CharacterInfo character) - { - if (GameMain.GameSession.CrewManager != null) - { - if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; } - } - } - else if (child.UserData as string == "mycrew" || child.UserData as string == "hire") - { - continue; - } - characterList.RemoveChild(child); + if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; } } - if (!hireableCharacters.Any()) + else if (child.UserData as string == "mycrew" || child.UserData as string == "hire") { - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center) - { - CanBeFocused = false - }; + continue; } - else + characterList.RemoveChild(child); + } + if (!hireableCharacters.Any()) + { + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center) { - foreach (CharacterInfo c in hireableCharacters) - { - var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c); - new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight); - } + CanBeFocused = false + }; + } + else + { + foreach (CharacterInfo c in hireableCharacters) + { + var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c); + new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight); } } - characterList.UpdateScrollBarSize(); } characterList.UpdateScrollBarSize(); diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs index a55342ca6..d94697541 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs @@ -948,11 +948,7 @@ namespace Barotrauma new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUI.LargeFont) { ForceUpperCase = true }; var label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerName"), textAlignment: textAlignment); - serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment) - { - MaxTextLength = NetConfig.ServerNameMaxLength, - OverflowClip = true - }; + serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment); label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerPort"), textAlignment: textAlignment); portBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs index d392f2bfa..d050187db 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs @@ -335,12 +335,8 @@ namespace Barotrauma new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), rightInfoColumn.RectTransform), style: null); //server info ------------------------------------------------------------------ - - ServerName = new GUITextBox(new RectTransform(new Vector2(infoColumnContainer.RectTransform.RelativeSize.X, 0.05f), infoFrameContent.RectTransform)) - { - MaxTextLength = NetConfig.ServerNameMaxLength, - OverflowClip = true - }; + + ServerName = new GUITextBox(new RectTransform(new Vector2(0.3f, 0.05f), infoFrameContent.RectTransform)); ServerName.OnDeselected += (textBox, key) => { GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name); diff --git a/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs b/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs index f8b1c148d..9f0a4b88c 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs @@ -35,7 +35,6 @@ namespace Barotrauma.Networking public bool CompareTo(string ipCompare) { - if (string.IsNullOrEmpty(IP)) { return false; } if (!IsRangeBan) { return ipCompare == IP; @@ -50,7 +49,6 @@ namespace Barotrauma.Networking public bool CompareTo(IPAddress ipCompare) { - if (string.IsNullOrEmpty(IP)) { return false; } if (ipCompare.IsIPv4MappedToIPv6 && CompareTo(ipCompare.MapToIPv4().ToString())) { return true; diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs index 586e28a2e..291ca50dc 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs @@ -93,10 +93,6 @@ namespace Barotrauma.Networking { name = name.Replace(":", ""); name = name.Replace(";", ""); - if (name.Length > NetConfig.ServerNameMaxLength) - { - name = name.Substring(0, NetConfig.ServerNameMaxLength); - } this.name = name; diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems index 4780726aa..cc7685501 100644 --- a/Barotrauma/BarotraumaShared/SharedContent.projitems +++ b/Barotrauma/BarotraumaShared/SharedContent.projitems @@ -1295,6 +1295,15 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index a5ab1fa32..d62ab48bb 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -1553,7 +1553,7 @@ namespace Barotrauma public void Use(float deltaTime, Character character = null, Limb targetLimb = null) { - if (RequireAimToUse && (character == null || !character.IsKeyDown(InputType.Aim))) + if (RequireAimToUse && !character.IsKeyDown(InputType.Aim)) { return; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs index c6db98cbc..7c907cd87 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs @@ -17,7 +17,8 @@ namespace Barotrauma } public bool IsOptional { get; set; } - + public bool MatchOnEmpty { get; set; } + public bool IgnoreInEditor { get; set; } private string[] excludedIdentifiers; @@ -99,6 +100,11 @@ namespace Barotrauma var containedItems = parentItem.ContainedItems; if (containedItems == null) return false; + if (MatchOnEmpty && !containedItems.Any(ci => ci != null)) + { + return true; + } + foreach (Item contained in containedItems) { if (contained.Condition > 0.0f && MatchesItem(contained)) return true; @@ -222,6 +228,7 @@ namespace Barotrauma ri.IsOptional = element.GetAttributeBool("optional", false); ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false); + ri.MatchOnEmpty = element.GetAttributeBool("matchonempty", false); return ri; } } diff --git a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs index dfe562c88..6c3210466 100644 --- a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs @@ -424,6 +424,7 @@ namespace Barotrauma public virtual bool HasRequiredConditions(List targets) { if (!propertyConditionals.Any()) return true; + if (requiredItems.All(ri => ri.MatchOnEmpty) && targets.Count == 0) return true; switch (conditionalComparison) { case PropertyConditional.Comparison.Or: diff --git a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub index 7d10e0914..b8903bf84 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub and b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub differ