diff --git a/Subsurface/Source/Items/Components/Signal/Connection.cs b/Subsurface/Source/Items/Components/Signal/Connection.cs index 08b461a23..4c122bd96 100644 --- a/Subsurface/Source/Items/Components/Signal/Connection.cs +++ b/Subsurface/Source/Items/Components/Signal/Connection.cs @@ -24,7 +24,7 @@ namespace Barotrauma.Items.Components private Item item; public readonly bool IsOutput; - + private static Wire draggingConnected; private List effects; @@ -423,8 +423,7 @@ namespace Barotrauma.Items.Components { if (mouseOn) { - item.IsHighlighted = true; - wire.Item.IsHighlighted = true; + ConnectionPanel.HighlightedWire = wire; if (!wire.Locked) { diff --git a/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs b/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs index 43a8be392..b9d1fd632 100644 --- a/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs +++ b/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs @@ -7,7 +7,9 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { class ConnectionPanel : ItemComponent - { + { + public static Wire HighlightedWire; + public List Connections; Character user; @@ -33,15 +35,29 @@ namespace Barotrauma.Items.Components IsActive = true; } - public override void DrawHUD(SpriteBatch spriteBatch, Character character) + public override void UpdateHUD(Character character) { if (character != Character.Controlled || character != user) return; if (Screen.Selected != GameMain.EditMapScreen && - character.IsKeyHit(InputType.Select) && - character.SelectedConstruction==this.item) character.SelectedConstruction = null; - + character.IsKeyHit(InputType.Select) && + character.SelectedConstruction == this.item) character.SelectedConstruction = null; + + if (HighlightedWire != null) + { + HighlightedWire.Item.IsHighlighted = true; + if (HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true; + if (HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true; + } + } + + public override void DrawHUD(SpriteBatch spriteBatch, Character character) + { + if (character != Character.Controlled || character != user) return; + + HighlightedWire = null; Connection.DrawConnections(spriteBatch, this, character); + } public override XElement Save(XElement parentElement) diff --git a/Subsurface/Source/Items/Components/Signal/Wire.cs b/Subsurface/Source/Items/Components/Signal/Wire.cs index 7fe3c3529..b505011ca 100644 --- a/Subsurface/Source/Items/Components/Signal/Wire.cs +++ b/Subsurface/Source/Items/Components/Signal/Wire.cs @@ -398,14 +398,14 @@ namespace Barotrauma.Items.Components { foreach (WireSection section in sections) { - section.Draw(spriteBatch, Color.Gold, drawOffset, depth, 0.5f); + section.Draw(spriteBatch, Color.Gold, drawOffset, depth + 0.00001f, 0.7f); } } else if (item.IsSelected) { foreach (WireSection section in sections) { - section.Draw(spriteBatch, Color.Red, drawOffset, depth, 0.5f); + section.Draw(spriteBatch, Color.Red, drawOffset, depth + 0.00001f, 0.7f); } } diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index aeecfc1f3..1cbe1e4ee 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -768,8 +768,6 @@ namespace Barotrauma inWater = IsInWater(); if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime); - isHighlighted = false; - if (body == null || !body.Enabled) return; if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f) diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index d01389cf1..23083c0f2 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -115,6 +115,11 @@ namespace Barotrauma } #endif + foreach (MapEntity e in MapEntity.mapEntityList) + { + e.IsHighlighted = false; + } + if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime); if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime);