Wires can be dragged from a connection panel to the inventory without dropping them, wire connections & nodes are cleared when taking the wire outside
This commit is contained in:
@@ -280,6 +280,18 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (draggingConnected != null)
|
||||||
|
{
|
||||||
|
DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false);
|
||||||
|
|
||||||
|
if (!PlayerInput.LeftButtonHeld())
|
||||||
|
{
|
||||||
|
panel.Item.NewComponentEvent(panel, true, true);
|
||||||
|
//draggingConnected.Drop(Character);
|
||||||
|
draggingConnected = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//if the Character using the panel has a wire item equipped
|
//if the Character using the panel has a wire item equipped
|
||||||
//and the wire hasn't been connected yet, draw it on the panel
|
//and the wire hasn't been connected yet, draw it on the panel
|
||||||
if (equippedWire!=null)
|
if (equippedWire!=null)
|
||||||
@@ -299,17 +311,6 @@ namespace Barotrauma.Items.Components
|
|||||||
//stop dragging a wire item if cursor is outside the panel
|
//stop dragging a wire item if cursor is outside the panel
|
||||||
if (mouseInRect) Inventory.draggingItem = null;
|
if (mouseInRect) Inventory.draggingItem = null;
|
||||||
|
|
||||||
if (draggingConnected != null)
|
|
||||||
{
|
|
||||||
DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false);
|
|
||||||
|
|
||||||
if (!PlayerInput.LeftButtonHeld())
|
|
||||||
{
|
|
||||||
panel.Item.NewComponentEvent(panel, true, true);
|
|
||||||
//draggingConnected.Drop(Character);
|
|
||||||
draggingConnected = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 0, width, height), Color.White);
|
spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 0, width, height), Color.White);
|
||||||
|
|
||||||
|
|||||||
@@ -213,10 +213,11 @@ namespace Barotrauma.Items.Components
|
|||||||
if (connections[0] != null && connections[0].Item.Submarine != null) sub = connections[0].Item.Submarine;
|
if (connections[0] != null && connections[0].Item.Submarine != null) sub = connections[0].Item.Submarine;
|
||||||
if (connections[1] != null && connections[1].Item.Submarine != null) sub = connections[1].Item.Submarine;
|
if (connections[1] != null && connections[1].Item.Submarine != null) sub = connections[1].Item.Submarine;
|
||||||
|
|
||||||
if (item.Submarine != null && item.Submarine != sub)
|
if (item.Submarine != sub)
|
||||||
{
|
{
|
||||||
ClearConnections();
|
ClearConnections();
|
||||||
Nodes.Clear();
|
Nodes.Clear();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newNodePos = RoundNode(item.Position, item.CurrentHull) - sub.HiddenSubPosition;
|
newNodePos = RoundNode(item.Position, item.CurrentHull) - sub.HiddenSubPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user