diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs index 018d5254b..d9425a502 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs @@ -181,13 +181,11 @@ namespace Barotrauma bool attackInput = msg.ReadBoolean(); keys[(int)InputType.Attack].Held = attackInput; keys[(int)InputType.Attack].SetState(false, attackInput); - - if (aimInput) - { - double aimAngle = ((double)msg.ReadUInt16() / 65535.0) * 2.0 * Math.PI; - cursorPosition = AimRefPosition + new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f; - TransformCursorPos(); - } + + double aimAngle = msg.ReadUInt16() / 65535.0 * 2.0 * Math.PI; + cursorPosition = AimRefPosition + new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f; + TransformCursorPos(); + bool ragdollInput = msg.ReadBoolean(); keys[(int)InputType.Ragdoll].Held = ragdollInput; keys[(int)InputType.Ragdoll].SetState(false, ragdollInput); diff --git a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs index d00a8d7eb..f991738e2 100644 --- a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs @@ -354,12 +354,10 @@ namespace Barotrauma tempBuffer.Write(((HumanoidAnimController)AnimController).Crouching); } tempBuffer.Write(attack); - - if (aiming) - { - Vector2 relativeCursorPos = cursorPosition - AimRefPosition; - tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI))); - } + + Vector2 relativeCursorPos = cursorPosition - AimRefPosition; + tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI))); + tempBuffer.Write(IsRagdolled || IsUnconscious || Stun > 0.0f || IsDead); tempBuffer.Write(AnimController.Dir > 0.0f); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs index d8ad6eda2..b8b1ce152 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs @@ -489,24 +489,20 @@ namespace Barotrauma.Items.Components closestDist = dist; } - if (closestEnemy == null) return false; + if (closestEnemy == null) { return false; } character.AIController.SelectTarget(closestEnemy.AiTarget); character.CursorPosition = closestEnemy.WorldPosition; - if (item.Submarine != null) character.CursorPosition -= item.Submarine.Position; - - //force aim input even if the turret doesn't require it, - //because the cursor position (and consequently, turret aim direction) is only synced to clients when aiming - character.SetInput(InputType.Aim, false, true); - + if (item.Submarine != null) { character.CursorPosition -= item.Submarine.Position; } + float enemyAngle = MathUtils.VectorToAngle(closestEnemy.WorldPosition - item.WorldPosition); float turretAngle = -rotation; - if (Math.Abs(MathUtils.GetShortestAngle(enemyAngle, turretAngle)) > 0.15f) return false; + if (Math.Abs(MathUtils.GetShortestAngle(enemyAngle, turretAngle)) > 0.15f) { return false; } var pickedBody = Submarine.PickBody(ConvertUnits.ToSimUnits(item.WorldPosition), closestEnemy.SimPosition, null); - if (pickedBody != null && !(pickedBody.UserData is Limb)) return false; + if (pickedBody != null && !(pickedBody.UserData is Limb)) { return false; } if (objective.Option.ToLowerInvariant() == "fireatwill") {