(73782c3bc) Don't prevent selecting items in the sub editor when the cursor is on a wire node, because it makes it very difficult (or impossible) to select items in the wiring mode. + Don't start moving wire nodes unless the cursor is moved by at least 16px from the initial position of the node.

This commit is contained in:
Joonas Rikkonen
2019-04-18 12:05:43 +03:00
parent c77c30fda7
commit 6aef4073b7
2 changed files with 21 additions and 13 deletions

View File

@@ -154,11 +154,22 @@ namespace Barotrauma.Items.Components
Vector2 nodeWorldPos = GameMain.SubEditorScreen.Cam.ScreenToWorld(PlayerInput.MousePosition) - sub.HiddenSubPosition - sub.Position;// Nodes[(int)selectedNodeIndex];
nodeWorldPos.X = MathUtils.Round(nodeWorldPos.X, Submarine.GridSize.X / 2.0f);
nodeWorldPos.Y = MathUtils.Round(nodeWorldPos.Y, Submarine.GridSize.Y / 2.0f);
if (selectedNodeIndex.HasValue)
{
nodeWorldPos.X = MathUtils.Round(nodeWorldPos.X, Submarine.GridSize.X / 2.0f);
nodeWorldPos.Y = MathUtils.Round(nodeWorldPos.Y, Submarine.GridSize.Y / 2.0f);
draggingWire.nodes[(int)selectedNodeIndex] = nodeWorldPos;
draggingWire.UpdateSections();
}
else
{
if (Vector2.DistanceSquared(nodeWorldPos, draggingWire.nodes[(int)highlightedNodeIndex]) > Submarine.GridSize.X * Submarine.GridSize.X)
{
selectedNodeIndex = highlightedNodeIndex;
}
}
draggingWire.nodes[(int)selectedNodeIndex] = nodeWorldPos;
draggingWire.UpdateSections();
MapEntity.SelectEntity(draggingWire.item);
}
@@ -213,7 +224,8 @@ namespace Barotrauma.Items.Components
Character.Controlled.ClearInputs();
}
draggingWire = selectedWire;
selectedNodeIndex = closestIndex;
//selectedNodeIndex = closestIndex;
return;
}
//remove the node
else if (PlayerInput.RightButtonClicked() && closestIndex > 0 && closestIndex < selectedWire.nodes.Count - 1)
@@ -264,14 +276,6 @@ namespace Barotrauma.Items.Components
if (highlighted != null)
{
highlighted.item.IsHighlighted = true;
if (Character.Controlled != null)
{
Character.Controlled.FocusedItem = null;
Character.Controlled.ResetInteract = true;
Character.Controlled.ClearInputs();
}
if (PlayerInput.LeftButtonClicked())
{
MapEntity.DisableSelect = true;

View File

@@ -1132,6 +1132,10 @@ namespace Barotrauma
{
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
}
if (!broken)
{
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
}
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }