diff --git a/Barotrauma/BarotraumaClient/Launch_Barotrauma b/Barotrauma/BarotraumaClient/Launch_Barotrauma index 8792fad24..4e95158fd 100644 --- a/Barotrauma/BarotraumaClient/Launch_Barotrauma +++ b/Barotrauma/BarotraumaClient/Launch_Barotrauma @@ -1,3 +1,3 @@ #!/bin/sh -exec mono "./Barotrauma.exe" MONO_LOG_LEVEL=debug "$@" +./Barotrauma diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index f0d80d9ee..c74cd30c3 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -186,12 +186,18 @@ PreserveNewest + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs index ac5edb682..2e11c7af2 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs @@ -98,7 +98,7 @@ namespace Barotrauma if (distSqrd > 10.0f || !character.AllowInput) { Collider.TargetRotation = newRotation; - SetPosition(newPosition, lerp: distSqrd < 5.0f); + SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false); } else { @@ -238,30 +238,20 @@ namespace Barotrauma } float errorMagnitude = positionError.Length(); - if (errorMagnitude > 0.01f) + if (errorMagnitude > 0.5f) + { + character.MemLocalState.Clear(); + SetPosition(serverPos.Position, lerp: true, ignorePlatforms: false); + } + else if (errorMagnitude > 0.01f) { Collider.TargetPosition = Collider.SimPosition + positionError; Collider.TargetRotation = Collider.Rotation + rotationError; Collider.MoveToTargetPosition(lerp: true); - if (errorMagnitude > 0.5f) - { - character.MemLocalState.Clear(); - foreach (Limb limb in Limbs) - { - limb.body.TargetPosition = limb.body.SimPosition + positionError; - limb.body.MoveToTargetPosition(lerp: true); - } - } } } } - } - if (Character.Controlled == character) - { - GameMain.GameScreen.Cam.Shake = Math.Min(Math.Max(strongestImpact, GameMain.GameScreen.Cam.Shake), 3.0f); - } - } if (character.MemLocalState.Count > 120) character.MemLocalState.RemoveRange(0, character.MemLocalState.Count - 120); character.MemState.Clear(); diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 2eff39aa6..b4e831e77 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -46,8 +46,7 @@ namespace Barotrauma if (controlled == value) return; controlled = value; if (controlled != null) controlled.Enabled = true; - CharacterHealth.OpenHealthWindow = null; - + CharacterHealth.OpenHealthWindow = null; } } diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs index 441ae6a6e..e180f44e6 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs @@ -85,7 +85,8 @@ namespace Barotrauma { if (character.Inventory != null) { - if (!character.LockHands && character.Stun < 0.1f) + if (!character.LockHands && character.Stun < 0.1f && + (character.SelectedConstruction == null || character.SelectedConstruction.GetComponent() == null)) { character.Inventory.Update(deltaTime, cam); } @@ -320,6 +321,7 @@ namespace Barotrauma } if (character.Inventory != null && !character.LockHands) { + character.Inventory.Locked = (character.SelectedConstruction != null && character.SelectedConstruction.GetComponent() != null); character.Inventory.DrawOwn(spriteBatch); character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ? CharacterInventory.Layout.Default : diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs index 71b3d07d0..0ea60b4a5 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs @@ -793,7 +793,7 @@ namespace Barotrauma base.Draw(spriteBatch); - if (hideButton != null && hideButton.Visible) + if (hideButton != null && hideButton.Visible && !Locked) { hideButton.DrawManually(spriteBatch, alsoChildren: true); } @@ -835,6 +835,7 @@ namespace Barotrauma color = Color.White; highlightedQuickUseSlot = slots[i]; } + if (Locked) { color *= 0.3f; } var quickUseIndicator = Items[i].AllowedSlots.Any(a => a == InvSlotType.Any) ? EquipIndicator : DropIndicator; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs index 8fb30030a..e3c4ea985 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -820,8 +820,9 @@ namespace Barotrauma else { Sprite slotSprite = slot.SlotSprite ?? slotSpriteSmall; - - spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slot.IsHighlighted ? Color.White : Color.White * 0.8f); + Color slotColor = slot.IsHighlighted ? Color.White : Color.White * 0.8f; + if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; } + spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slotColor); if (item != null && drawItem) { @@ -873,14 +874,17 @@ namespace Barotrauma } indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(), - Color.DarkGray * 0.9f, + (inventory != null && inventory.Locked) ? Color.DarkGray * 0.5f : Color.DarkGray * 0.9f, origin: indicatorSprite.size / 2, rotate: 0.0f, scale: indicatorScale); - + + Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green); + if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; } + spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(), sourceRectangle: new Rectangle(indicatorSprite.SourceRect.Location, new Point((int)(indicatorSprite.SourceRect.Width * containedState), indicatorSprite.SourceRect.Height)), - color: ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green), + color: indicatorColor, rotation: 0.0f, origin: indicatorSprite.size / 2, scale: indicatorScale, @@ -920,6 +924,7 @@ namespace Barotrauma } Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor(); + if (inventory != null && inventory.Locked) { spriteColor *= 0.5f; } if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface) { spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f); @@ -931,7 +936,10 @@ namespace Barotrauma sprite.Draw(spriteBatch, itemPos, spriteColor, rotation, scale); } - if (inventory != null && Character.Controlled?.Inventory == inventory && slot.QuickUseKey != Keys.None) + if (inventory != null && + !inventory.Locked && + Character.Controlled?.Inventory == inventory && + slot.QuickUseKey != Keys.None) { GUI.DrawString(spriteBatch, rect.Location.ToVector2(), slot.QuickUseKey.ToString().Substring(1, 1), diff --git a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs index 08a9b5ae0..99b7bbedd 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs @@ -1,6 +1,9 @@ using Barotrauma.Extensions; using Barotrauma.Lights; using Barotrauma.Networking; +using FarseerPhysics; +using FarseerPhysics.Dynamics; +using FarseerPhysics.Dynamics.Contacts; using Lidgren.Network; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -165,6 +168,20 @@ namespace Barotrauma { Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position); + int section = FindSectionIndex(pos); + if (section > -1) + { + Vector2 normal = contact.Manifold.LocalNormal; + + float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f; + if (impact > 10.0f) + { + SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags); + } + } + } + } + public override bool IsVisible(Rectangle worldView) { Rectangle worldRect = WorldRect; diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs index 3c1705000..515bc987a 100644 --- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs @@ -238,7 +238,7 @@ namespace Barotrauma } float ambienceVolume = 0.8f; - if (Character.Controlled != null) + if (Character.Controlled != null && !Character.Controlled.Removed) { AnimController animController = Character.Controlled.AnimController; if (animController.HeadInWater) diff --git a/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs index b5497c509..1c7c140ff 100644 --- a/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs +++ b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.8.10.0")] -[assembly: AssemblyFileVersion("0.8.0.0")] +[assembly: AssemblyFileVersion("0.8.10.0")] diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index 35a31f8aa..eac638a27 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -1064,6 +1064,8 @@ namespace Barotrauma private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure; + private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure; + //goes through all the AItargets, evaluates how preferable it is to attack the target, //whether the Character can see/hear the target and chooses the most preferable target within //sight/hearing range diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs index e264c0f05..277a8b54c 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs @@ -223,8 +223,10 @@ namespace Barotrauma } } + bool isDiving = character.AnimController.InWater && character.AnimController.HeadInWater; + //only humanoids can climb ladders - if (!character.AnimController.InWater && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent) + if (!isDiving && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent) { if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item && currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition)) @@ -234,7 +236,7 @@ namespace Barotrauma } var collider = character.AnimController.Collider; - if (character.IsClimbing && !character.AnimController.InWater) + if (character.IsClimbing && !isDiving) { Vector2 diff = currentPath.CurrentNode.SimPosition - pos; bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent; @@ -279,7 +281,7 @@ namespace Barotrauma else if (character.AnimController.InWater) { // If the character is underwater, we don't need the ladders anymore - if (character.IsClimbing) + if (character.IsClimbing && isDiving) { character.AnimController.Anim = AnimController.Animation.None; character.SelectedConstruction = null; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs index 5de8c9140..3530df734 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs @@ -560,7 +560,8 @@ namespace Barotrauma //TODO: take into account that the feet aren't necessarily in CurrentHull //full slowdown (1.5f) when water is up to the torso surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface); - slowdownAmount = MathHelper.Clamp((surfaceY - colliderPos.Y) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f; + float bottomPos = Math.Max(colliderPos.Y, currentHull.Rect.Y - currentHull.Rect.Height); + slowdownAmount = MathHelper.Clamp((surfaceY - bottomPos) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f; } float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 435f0fd7d..d3dcbc16b 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -2551,16 +2551,14 @@ namespace Barotrauma if (info != null) { info.Remove(); } -#if CLIENT - GameMain.GameSession?.CrewManager?.RemoveCharacter(this); -#endif - #if CLIENT GameMain.GameSession?.CrewManager?.RemoveCharacter(this); #endif CharacterList.Remove(this); + if (Controlled == this) { Controlled = null; } + if (Inventory != null) { foreach (Item item in Inventory.Items) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index 59d65255f..38dcb8a64 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -635,24 +635,6 @@ namespace Barotrauma var character = ((Limb)f2.Body.UserData).character; if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true; } - - if (!Prefab.Platform && Prefab.StairDirection == Direction.None) - { - Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position); - - int section = FindSectionIndex(pos); - if (section > -1) - { - Vector2 normal = contact.Manifold.LocalNormal; - - float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f; - if (impact < 10.0f) return true; -#if CLIENT - SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags); -#endif - AddDamage(section, impact); - } - } OnImpactProjSpecific(f1, f2, contact); diff --git a/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs index c2cd7710d..e89da30e1 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs @@ -102,7 +102,7 @@ namespace Barotrauma { string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace; DebugConsole.ThrowError(errorMsg); - GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue1:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return; } spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, worldPosition, condition)); @@ -115,7 +115,7 @@ namespace Barotrauma { string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace; DebugConsole.ThrowError(errorMsg); - GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue2:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return; } spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, position, sub, condition)); diff --git a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub index 94becc0e0..cce7eff49 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub and b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub index 373ae025e..028008485 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub and b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Orca.sub b/Barotrauma/BarotraumaShared/Submarines/Orca.sub index e0e6c5f3c..75badce72 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Orca.sub and b/Barotrauma/BarotraumaShared/Submarines/Orca.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub index 094ad050d..a689efd8d 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub and b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub differ