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/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs index e2aa51755..3e6602adf 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs @@ -358,6 +358,12 @@ namespace Barotrauma.Networking client.EntityEventLastSent[entityEvent.ID] = NetTime.Now; } + 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 253fa2c81..01a3e5c28 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -1104,20 +1104,6 @@ namespace Barotrauma } } else if (targetCharacter.AIController is EnemyAIController enemy) - { - targetingTag = "dead"; - if (targetCharacter.Submarine != Character.Submarine) - { - // In a different sub or the target is outside when we are inside or vice versa -> Ignore the target - continue; - } - else if (targetCharacter.CurrentHull != Character.CurrentHull) - { - // In the same sub, halve the priority, if not in the same hull. - valueModifier = 0.5f; - } - } - else if (targetCharacter.AIController is EnemyAIController enemy) { if (enemy.combatStrength > combatStrength) { @@ -1230,7 +1216,7 @@ namespace Barotrauma valueModifier = isOutdoor ? 1 : 0; valueModifier *= isOpen ? 5 : 1; } - for (int i = 0; i < s.Sections.Length; i++) + else if (targetCharacter.CurrentHull != Character.CurrentHull) { valueModifier = isOutdoor ? 0 : 1; valueModifier *= isOpen ? 0 : 1; @@ -1252,6 +1238,11 @@ 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/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs index 21fd14e74..d74524d9e 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs @@ -734,15 +734,13 @@ namespace Barotrauma.Items.Components private void OverrideRequiredItems(XElement element) { var prevRequiredItems = new Dictionary>(requiredItems); - bool overrideRequiredItems = false; + requiredItems.Clear(); + foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "requireditem": - if (!overrideRequiredItems) requiredItems.Clear(); - overrideRequiredItems = true; - RelatedItem newRequiredItem = RelatedItem.Load(subElement, item.Name); if (newRequiredItem == null) continue; diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index 1e14647f7..20545c3ec 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -653,6 +653,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); }