diff --git a/Subsurface/Content/Characters/Husk/husk.xml b/Subsurface/Content/Characters/Husk/husk.xml index 137bd0eeb..47e6bd822 100644 --- a/Subsurface/Content/Characters/Husk/husk.xml +++ b/Subsurface/Content/Characters/Husk/husk.xml @@ -1,12 +1,14 @@  - + - + legtorque="15.0" + thightorque="-5.0" + walkspeed="2.0" + swimspeed="2.0"> @@ -78,18 +80,18 @@ - + - + - diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml index 6a2794628..f9d079e81 100644 --- a/Subsurface/Content/Items/Weapons/weapons.xml +++ b/Subsurface/Content/Items/Weapons/weapons.xml @@ -109,7 +109,7 @@ - + diff --git a/Subsurface/Source/Characters/AI/EnemyAIController.cs b/Subsurface/Source/Characters/AI/EnemyAIController.cs index 233f6e223..6507992cc 100644 --- a/Subsurface/Source/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Source/Characters/AI/EnemyAIController.cs @@ -107,6 +107,14 @@ namespace Barotrauma Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X)); + if (Character.AnimController is HumanoidAnimController) + { + if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater) + { + Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left; + } + } + if (updateTargetsTimer > 0.0) { updateTargetsTimer -= deltaTime; diff --git a/Subsurface/Source/Characters/Animation/AnimController.cs b/Subsurface/Source/Characters/Animation/AnimController.cs index 551b0c245..e86eba7a6 100644 --- a/Subsurface/Source/Characters/Animation/AnimController.cs +++ b/Subsurface/Source/Characters/Animation/AnimController.cs @@ -43,6 +43,9 @@ namespace Barotrauma stepSize = ToolBox.GetAttributeVector2(element, "stepsize", Vector2.One); stepSize = ConvertUnits.ToSimUnits(stepSize); + walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f); + swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f); + //stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One); //stepOffset = ConvertUnits.ToSimUnits(stepOffset); diff --git a/Subsurface/Source/Characters/Animation/FishAnimController.cs b/Subsurface/Source/Characters/Animation/FishAnimController.cs index 91162eaf5..9b8b81393 100644 --- a/Subsurface/Source/Characters/Animation/FishAnimController.cs +++ b/Subsurface/Source/Characters/Animation/FishAnimController.cs @@ -31,9 +31,6 @@ namespace Barotrauma flip = ToolBox.GetAttributeBool(element, "flip", false); - walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f); - swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f); - float footRot = ToolBox.GetAttributeFloat(element,"footrotation", float.NaN); if (float.IsNaN(footRot)) { diff --git a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs index e7b2e5813..c47a903c9 100644 --- a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs +++ b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs @@ -241,7 +241,7 @@ namespace Barotrauma float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f; - movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp); + movement = MathUtils.SmoothStep(movement, TargetMovement*walkSpeed, movementLerp); movement.Y = 0.0f; for (int i = 0; i < 2; i++) @@ -502,7 +502,7 @@ namespace Barotrauma if (TargetMovement == Vector2.Zero) return; - movement = MathUtils.SmoothStep(movement, TargetMovement, 0.3f); + movement = MathUtils.SmoothStep(movement, TargetMovement*swimSpeed, 0.3f); //dont try to move upwards if head is already out of water if (surfaceLimiter > 1.0f && TargetMovement.Y > 0.0f) diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 485007862..51fc5f421 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -391,7 +391,10 @@ namespace Barotrauma Properties = ObjectProperty.GetProperties(this); - Info = characterInfo==null ? new CharacterInfo(file) : characterInfo; + if (file == humanConfigFile) + { + Info = characterInfo == null ? new CharacterInfo(file) : characterInfo; + } XDocument doc = ToolBox.TryLoadXml(file); if (doc == null || doc.Root == null) return; @@ -453,22 +456,26 @@ namespace Barotrauma } } - if (Info.PickedItemIDs.Any()) + if (file == humanConfigFile) { - for (ushort i = 0; i < Info.PickedItemIDs.Count; i++ ) + if (Info.PickedItemIDs.Any()) { - if (Info.PickedItemIDs[i] == 0) continue; + for (ushort i = 0; i < Info.PickedItemIDs.Count; i++ ) + { + if (Info.PickedItemIDs[i] == 0) continue; - Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item; + Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item; - System.Diagnostics.Debug.Assert(item != null); - if (item == null) continue; + System.Diagnostics.Debug.Assert(item != null); + if (item == null) continue; - item.Pick(this, true, true, true); - inventory.TryPutItem(item, i, false); + item.Pick(this, true, true, true); + inventory.TryPutItem(item, i, false); + } } } + AnimController.FindHull(null); if (AnimController.CurrentHull != null) Submarine = AnimController.CurrentHull.Submarine; diff --git a/Subsurface/Source/Characters/CharacterInfo.cs b/Subsurface/Source/Characters/CharacterInfo.cs index 09c967ca6..ab8e073b8 100644 --- a/Subsurface/Source/Characters/CharacterInfo.cs +++ b/Subsurface/Source/Characters/CharacterInfo.cs @@ -132,6 +132,8 @@ namespace Barotrauma return; } + name = ""; + if (doc.Root.Element("name") != null) { string firstNamePath = ToolBox.GetAttributeString(doc.Root.Element("name"), "firstname", ""); diff --git a/Subsurface/Source/Map/EntityGrid.cs b/Subsurface/Source/Map/EntityGrid.cs index f4524c3c1..c0aef6943 100644 --- a/Subsurface/Source/Map/EntityGrid.cs +++ b/Subsurface/Source/Map/EntityGrid.cs @@ -32,16 +32,17 @@ namespace Barotrauma Rectangle rect = entity.Rect; //if (Submarine.Loaded != null) rect.Offset(-Submarine.HiddenSubPosition); Rectangle indices = GetIndices(rect); - if (indices.X < 0 || indices.Width >= entities.GetLength(0) || - indices.Y < 0 || indices.Height >= entities.GetLength(1)) + + if (indices.Width < 0 || indices.X >= entities.GetLength(0) || + indices.Height < 0 || indices.Y >= entities.GetLength(1)) { DebugConsole.ThrowError("Error in EntityGrid.InsertEntity: " + entity + " is outside the grid"); return; } - for (int x = indices.X; x <= indices.Width; x++) + for (int x = Math.Max(indices.X, 0); x <= Math.Min(indices.Width, entities.GetLength(0)); x++) { - for (int y = indices.Y; y <= indices.Height; y++) + for (int y = Math.Max(indices.Y,0); y <= Math.Min(indices.Height, entities.GetLength(1)); y++) { entities[x, y].Add(entity); } diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index d4b9647db..1c5870cbb 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -882,6 +882,9 @@ namespace Barotrauma.Networking GameMain.GameScreen.Select(); + + AddChatMessage("Press TAB to chat. Use ''/d'' to talk to dead players and spectators, and ''/playername'' to only send the message to a specific player.", ChatMessageType.Server); + yield return CoroutineStatus.Success; } @@ -1267,17 +1270,43 @@ namespace Barotrauma.Networking public override void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server) { - AddChatMessage(message, type); - - if (server.Connections.Count == 0) return; + string[] words = message.Split(' '); List recipients = new List(); + Client targetClient = null; - foreach (Client c in ConnectedClients) + if (words.Length > 2) { - if (type!=ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c); + if (words[1] == "/dead" || words[1] == "/d") + { + type = ChatMessageType.Dead; + } + else + { + targetClient = ConnectedClients.Find(c => + words[0] == "/" + c.name.ToLower() || + c.Character != null && words[0] == "/" + c.Character.Name.ToLower()); + } + + message = words[0] + " " + string.Join(" ", words, 2, words.Length - 2); } + if (targetClient != null) + { + recipients.Add(targetClient); + } + else + { + foreach (Client c in ConnectedClients) + { + if (type != ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c); + } + } + + AddChatMessage(message, type); + + if (!server.Connections.Any()) return; + foreach (Client c in recipients) { ReliableMessage msg = c.ReliableChannel.CreateMessage(); diff --git a/Subsurface/Source/Networking/ServerLog.cs b/Subsurface/Source/Networking/ServerLog.cs index dc9a8881d..5accd96ee 100644 --- a/Subsurface/Source/Networking/ServerLog.cs +++ b/Subsurface/Source/Networking/ServerLog.cs @@ -9,7 +9,7 @@ namespace Barotrauma.Networking { class ServerLog { - const int LinesPerFile = 500; + const int LinesPerFile = 300; const string SavePath = "ServerLogs"; diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 24f2594e4..f9fca9346 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ