From 556d86ed4f9c2975b160fe627a7eaf8bccb81850 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Wed, 27 Mar 2019 20:45:45 +0200 Subject: [PATCH] (bce1100e8) ClientCode.projitems update --- .../BarotraumaClient/ClientCode.projitems | 2 +- .../BarotraumaClient/Source/DebugConsole.cs | 32 +++++++------------ .../Source/Networking/GameClient.cs | 3 ++ .../Source/Characters/AI/EnemyAIController.cs | 18 ++++------- .../Source/Characters/Animation/Ragdoll.cs | 12 +++++++ .../Source/Items/Components/Signal/Wire.cs | 3 ++ .../BarotraumaShared/Source/Map/Explosion.cs | 3 ++ .../Source/Physics/PhysicsBody.cs | 12 +++++++ 8 files changed, 51 insertions(+), 34 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems index 74a09042b..a19aa9fe1 100644 --- a/Barotrauma/BarotraumaClient/ClientCode.projitems +++ b/Barotrauma/BarotraumaClient/ClientCode.projitems @@ -82,6 +82,7 @@ + @@ -220,6 +221,5 @@ - \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs index b77e42d54..8b210a319 100644 --- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs @@ -939,27 +939,6 @@ namespace Barotrauma while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode; destinationElement = nextNode as XElement; } - destinationDoc.Save(destinationPath); - }, - () => - { - var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray(); - return new string[][] - { - files, - files - }; - })); - - commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) => - { - string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt"; - List lines = new List(); - foreach (MapEntityPrefab me in MapEntityPrefab.List) - { - lines.Add("" + me.Name + ""); - lines.Add("" + me.Description + ""); - } }, isCheat: false)); #endif @@ -1085,6 +1064,17 @@ namespace Barotrauma if (args.Length == 0) return; LocalizationCSVtoXML.Convert(args[0]); })); + + commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) => + { + string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt"; + List lines = new List(); + foreach (MapEntityPrefab me in MapEntityPrefab.List) + { + lines.Add("" + me.Name + ""); + lines.Add("" + me.Description + ""); + } + }, isCheat: false)); #endif commands.Add(new Command("cleanbuild", "", (string[] args) => diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 898b2e2a1..d77b95052 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -1371,6 +1371,9 @@ namespace Barotrauma.Networking case ServerNetObject.CLIENT_LIST: ReadClientList(inc); break; + case ServerNetObject.CLIENT_LIST: + ReadClientList(inc); + break; case ServerNetObject.CHAT_MESSAGE: ChatMessage.ClientRead(inc); break; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index 272c56938..d3bb650bf 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -466,14 +466,9 @@ namespace Barotrauma } } - if (wallTarget != null) + if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater) { - attackWorldPos = wallTarget.Position; - if (wallTarget.Structure.Submarine != null) - { - attackWorldPos += wallTarget.Structure.Submarine.Position; - } - attackSimPos = ConvertUnits.ToSimUnits(attackWorldPos); + Character.AnimController.TargetDir = Character.SimPosition.X < attackSimPosition.X ? Direction.Right : Direction.Left; } if (raycastTimer > 0.0) @@ -1019,6 +1014,10 @@ namespace Barotrauma targetingTag = targetCharacter.SpeciesName.ToLowerInvariant(); } else if (targetingPriorities.ContainsKey(targetCharacter.SpeciesName.ToLowerInvariant())) + { + targetingTag = targetCharacter.SpeciesName.ToLowerInvariant(); + } + else if (targetingPriorities.ContainsKey(targetCharacter.SpeciesName.ToLowerInvariant())) { if (targetCharacter.AIController is EnemyAIController enemy) { @@ -1174,11 +1173,6 @@ namespace Barotrauma Character.AnimController.ReleaseStuckLimbs(); } - private int GetMinimumPassableHoleCount() - { - return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize); - } - #endregion protected override void OnStateChanged(AIState from, AIState to) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs index a0fc07c53..93cbfeb83 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs @@ -1039,6 +1039,8 @@ namespace Barotrauma CheckValidity(); + CheckValidity(); + UpdateNetPlayerPosition(deltaTime); CheckDistFromCollider(); UpdateCollisionCategories(); @@ -1353,6 +1355,16 @@ namespace Barotrauma UpdateProjSpecific(deltaTime); } + private void CheckValidity() + { + CheckValidity(Collider); + foreach (Limb limb in limbs) + { + if (limb.body == null || !limb.body.Enabled) { continue; } + CheckValidity(limb.body); + } + } + partial void UpdateProjSpecific(float deltaTime); partial void Splash(Limb limb, Hull limbHull); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs index 5413a6deb..99ec28e8c 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/Wire.cs @@ -185,6 +185,9 @@ namespace Barotrauma.Items.Components if (nodes.Count > 0 && nodes[0] == nodePos) break; if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break; + if (nodes.Count > 0 && nodes[0] == nodePos) break; + if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break; + //make sure we place the node at the correct end of the wire (the end that's closest to the new node pos) int newNodeIndex = 0; if (nodes.Count > 1) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs index 67cb5f5c5..84c9e84a9 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs @@ -189,6 +189,9 @@ namespace Barotrauma Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false); bool underWater = hull == null || explosionPos.Y < hull.Surface; + Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false); + bool underWater = hull == null || explosionPos.Y < hull.Surface; + explosionPos = ConvertUnits.ToSimUnits(explosionPos); Dictionary distFactors = new Dictionary(); diff --git a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs index b8edb356a..9210e9452 100644 --- a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs @@ -60,6 +60,18 @@ namespace Barotrauma private set; } + public Vector2 LinearVelocity + { + get; + private set; + } + + public float AngularVelocity + { + get; + private set; + } + public readonly float Timestamp; public readonly UInt16 ID;