(ecda2cb2a) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-04-02 12:41:32 +03:00
parent e86d86c41f
commit 5cf66d7343
5 changed files with 17 additions and 16 deletions
@@ -200,9 +200,13 @@ namespace Barotrauma
{ {
cam.OffsetAmount = 0.0f; 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; 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) 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; 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); Body body = Submarine.CheckVisibility(AnimController.Limbs[0].SimPosition, mouseSimPos);
Structure structure = body == null ? null : body.UserData as Structure; Structure structure = body == null ? null : body.UserData as Structure;
@@ -11,19 +11,16 @@ namespace Barotrauma
protected override void ControlInput(Camera cam) protected override void ControlInput(Camera cam)
{ {
base.ControlInput(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 (PlayerInput.KeyHit(InputType.Select))
//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)) Character.Controlled.SelectedConstruction = null;
{ }
Character.Controlled.SelectedConstruction = null; }*/
}
}*/
}
} }
protected override void CalculateBackgroundFrame() protected override void CalculateBackgroundFrame()
@@ -407,7 +407,7 @@ namespace Barotrauma.Lights
/// <summary> /// <summary>
/// Returns the segments that are facing towards viewPosition /// Returns the segments that are facing towards viewPosition
/// </summary> /// </summary>
public void GetVisibleSegments(Vector2 viewPosition, List<Segment> visibleSegments) public void GetVisibleSegments(Vector2 viewPosition, List<Segment> visibleSegments, bool ignoreEdges)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@@ -453,7 +453,7 @@ namespace Barotrauma.Lights
foreach (ConvexHull hull in hulls) foreach (ConvexHull hull in hulls)
{ {
hull.RefreshWorldPositions(); hull.RefreshWorldPositions();
hull.GetVisibleSegments(drawPos, visibleSegments); hull.GetVisibleSegments(drawPos, visibleSegments, ignoreEdges: false);
} }
//Generate new points at the intersections between segments //Generate new points at the intersections between segments
@@ -1147,7 +1147,7 @@ namespace Barotrauma
{ {
//Limb head = AnimController.GetLimb(LimbType.Head); //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. // 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) if (dontFollowCursor)
{ {
AnimController.TargetDir = Direction.Right; AnimController.TargetDir = Direction.Right;