diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 79abaed11..996a07b55 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -200,9 +200,13 @@ namespace Barotrauma { cam.OffsetAmount = 0.0f; } - else if (SelectedConstruction != null && SelectedConstruction.Components.Any(ic => (ic.GuiFrame != null && GUI.IsMouseOn(ic.GuiFrame)))) + else if (SelectedConstruction != null && ViewTarget == null && + SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this))) { cam.OffsetAmount = 0.0f; + cursorPosition = + SelectedConstruction.Position + + new Vector2(cursorPosition.X % 10.0f, cursorPosition.Y % 10.0f); //apply a little bit of movement to the cursor pos to prevent AFK kicking } else if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f) { @@ -210,7 +214,7 @@ namespace Barotrauma { if (deltaTime > 0.0f) cam.OffsetAmount = 0.0f; } - else if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f) + else { Body body = Submarine.CheckVisibility(AnimController.Limbs[0].SimPosition, mouseSimPos); Structure structure = body == null ? null : body.UserData as Structure; diff --git a/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs index 8f2aa6359..6ef97a119 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/ItemInventory.cs @@ -11,19 +11,16 @@ namespace Barotrauma protected override void ControlInput(Camera cam) { base.ControlInput(cam); - if (BackgroundFrame.Contains(PlayerInput.MousePosition)) + cam.OffsetAmount = 0; + //if this is used, we need to implement syncing this inventory with the server + /*Character.DisableControls = true; + if (Character.Controlled != null) { - cam.OffsetAmount = 0; - //if this is used, we need to implement syncing this inventory with the server - /*Character.DisableControls = true; - if (Character.Controlled != null) + if (PlayerInput.KeyHit(InputType.Select)) { - if (PlayerInput.KeyHit(InputType.Select)) - { - Character.Controlled.SelectedConstruction = null; - } - }*/ - } + Character.Controlled.SelectedConstruction = null; + } + }*/ } protected override void CalculateBackgroundFrame() diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs index 3d7202476..1cbf20833 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/ConvexHull.cs @@ -407,7 +407,7 @@ namespace Barotrauma.Lights /// /// Returns the segments that are facing towards viewPosition /// - public void GetVisibleSegments(Vector2 viewPosition, List visibleSegments) + public void GetVisibleSegments(Vector2 viewPosition, List visibleSegments, bool ignoreEdges) { for (int i = 0; i < 4; i++) { diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs index cbc9ac0e1..9ff808757 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs @@ -453,7 +453,7 @@ namespace Barotrauma.Lights foreach (ConvexHull hull in hulls) { hull.RefreshWorldPositions(); - hull.GetVisibleSegments(drawPos, visibleSegments); + hull.GetVisibleSegments(drawPos, visibleSegments, ignoreEdges: false); } //Generate new points at the intersections between segments diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 19c905b3f..612801496 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1147,7 +1147,7 @@ namespace Barotrauma { //Limb head = AnimController.GetLimb(LimbType.Head); // Values lower than this seem to cause constantious flipping when the mouse is near the player and the player is running, because the root collider moves after flipping. - float followMargin = 30; + float followMargin = 40; if (dontFollowCursor) { AnimController.TargetDir = Direction.Right;