(9bd8db487) Allow to aim in ladders when not moving.

This commit is contained in:
Joonas Rikkonen
2019-04-02 12:41:18 +03:00
parent 7d8b489319
commit e86d86c41f
9 changed files with 49 additions and 46 deletions
@@ -200,13 +200,9 @@ namespace Barotrauma
{
cam.OffsetAmount = 0.0f;
}
else if (SelectedConstruction != null && ViewTarget == null &&
SelectedConstruction.Components.Any(ic => ic?.GuiFrame != null && ic.ShouldDrawHUD(this)))
else if (SelectedConstruction != null && SelectedConstruction.Components.Any(ic => (ic.GuiFrame != null && GUI.IsMouseOn(ic.GuiFrame))))
{
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)
{
@@ -214,7 +210,7 @@ namespace Barotrauma
{
if (deltaTime > 0.0f) cam.OffsetAmount = 0.0f;
}
else
else if (Lights.LightManager.ViewTarget == this && Vector2.DistanceSquared(AnimController.Limbs[0].SimPosition, mouseSimPos) > 1.0f)
{
Body body = Submarine.CheckVisibility(AnimController.Limbs[0].SimPosition, mouseSimPos);
Structure structure = body == null ? null : body.UserData as Structure;
@@ -11,16 +11,19 @@ namespace Barotrauma
protected override void ControlInput(Camera cam)
{
base.ControlInput(cam);
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 (BackgroundFrame.Contains(PlayerInput.MousePosition))
{
if (PlayerInput.KeyHit(InputType.Select))
cam.OffsetAmount = 0;
//if this is used, we need to implement syncing this inventory with the server
/*Character.DisableControls = true;
if (Character.Controlled != null)
{
Character.Controlled.SelectedConstruction = null;
}
}*/
if (PlayerInput.KeyHit(InputType.Select))
{
Character.Controlled.SelectedConstruction = null;
}
}*/
}
}
protected override void CalculateBackgroundFrame()
@@ -407,7 +407,7 @@ namespace Barotrauma.Lights
/// <summary>
/// Returns the segments that are facing towards viewPosition
/// </summary>
public void GetVisibleSegments(Vector2 viewPosition, List<Segment> visibleSegments, bool ignoreEdges)
public void GetVisibleSegments(Vector2 viewPosition, List<Segment> visibleSegments)
{
for (int i = 0; i < 4; i++)
{
@@ -453,7 +453,7 @@ namespace Barotrauma.Lights
foreach (ConvexHull hull in hulls)
{
hull.RefreshWorldPositions();
hull.GetVisibleSegments(drawPos, visibleSegments, ignoreEdges: false);
hull.GetVisibleSegments(drawPos, visibleSegments);
}
//Generate new points at the intersections between segments