diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index ec5b88851..cbb751f50 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -656,6 +656,13 @@ namespace Barotrauma msg.Timer -= deltaTime; msg.Pos += msg.Velocity * deltaTime; } + + foreach (GUIMessage msg in messages) + { + if (!msg.WorldSpace) continue; + msg.Timer -= deltaTime; + msg.Pos += msg.Velocity * deltaTime; + } } messages.RemoveAll(m => m.Timer <= 0.0f); diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs index 6ff7cb7f7..dc51312ea 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs @@ -127,18 +127,6 @@ namespace Barotrauma.Items.Components Stretch = true, RelativeSpacing = 0.03f }; - autopilotTickBox = new GUITickBox(new RectTransform(new Vector2(0.3f, 0.3f), paddedControlContainer.RectTransform), - TextManager.Get("SteeringAutoPilot"), style: "GUIRadioButton") - { - OnSelected = (GUITickBox box) => - { - AutoPilot = box.Selected; - if (AutoPilot && MaintainPos) - { - posToMaintain = controlledSub == null ? item.WorldPosition : controlledSub.WorldPosition; - } - unsentChanges = true; - user = Character.Controlled; maintainPosTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), paddedAutoPilotControls.RectTransform), TextManager.Get("SteeringMaintainPos"), font: GUI.SmallFont) diff --git a/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs index d7c3f4ea0..519d8d800 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs @@ -346,6 +346,12 @@ namespace Barotrauma.Networking Write(msg, eventsToSync, out sentEvents, client); } + foreach (NetEntityEvent entityEvent in sentEvents) + { + (entityEvent as ServerEntityEvent).Sent = true; + client.EntityEventLastSent[entityEvent.ID] = NetTime.Now; + } + foreach (NetEntityEvent entityEvent in sentEvents) { (entityEvent as ServerEntityEvent).Sent = true; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index 8ff638c05..debfb6d73 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -797,6 +797,7 @@ namespace Barotrauma { UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance); } + return false; } private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime) @@ -1215,16 +1216,7 @@ namespace Barotrauma valueModifier = isOutdoor ? 1 : 0; valueModifier *= isOpen ? 5 : 1; } - } - } - else if (target.Entity is Structure s) - { - targetingTag = "wall"; - if (aggressiveBoarding) - { - // Ignore walls when inside. - valueModifier = character.CurrentHull == null ? 2 : 0; - if (valueModifier > 0) + for (int i = 0; i < s.Sections.Length; i++) { valueModifier = isOutdoor ? 0 : 1; valueModifier *= isOpen ? 0 : 1; @@ -1246,11 +1238,6 @@ namespace Barotrauma valueModifier *= targetingPriorities[targetingTag].Priority; - if (targetingTag == null) continue; - if (!targetingPriorities.ContainsKey(targetingTag)) continue; - - valueModifier *= targetingPriorities[targetingTag].Priority; - if (valueModifier == 0.0f) continue; Vector2 toTarget = target.WorldPosition - character.WorldPosition; diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index 25e9155a7..40a8b79b4 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -587,6 +587,39 @@ namespace Barotrauma AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); + if (sprite == null) + { + DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!"); +#if SERVER + sprite = new Sprite("", Vector2.Zero); + sprite.SourceRect = new Rectangle(0, 0, 32, 32); +#else + sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null) + { + Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2 + }; +#endif + size = sprite.size; + sprite.EntityID = identifier; + } + + if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier)) + { + DebugConsole.ThrowError( + "Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading."); + } + if (!string.IsNullOrEmpty(identifier)) + { + MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier); + if (existingPrefab != null) + { + DebugConsole.ThrowError( + "Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!"); + } + } + + AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList(); + List.Add(this); } diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs index 9a413cd79..738c9fa16 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs @@ -533,30 +533,6 @@ namespace Barotrauma { maxX = Math.Min(maxX, ruin.Area.X - 100.0f); } - else - { - maxX = Math.Min(maxX, ruin.Area.X - 100.0f); - } - } - - if (minX < 0.0f && maxX > Level.Loaded.Size.X) - { - //no walls found at either side, just use the initial spawnpos and hope for the best - } - else if (minX < 0) - { - //no wall found at the left side, spawn to the left from the right-side wall - spawnPos.X = maxX - minWidth - 100.0f; - } - else if (maxX > Level.Loaded.Size.X) - { - //no wall found at right side, spawn to the right from the left-side wall - spawnPos.X = minX + minWidth + 100.0f; - } - else - { - //walls found at both sides, use their midpoint - spawnPos.X = (minX + maxX) / 2; } if (minX < 0.0f && maxX > Level.Loaded.Size.X)