diff --git a/Subsurface/Content/Items/blank.png b/Subsurface/Content/Items/blank.png index 9a1af9801..8cc7ad79c 100644 Binary files a/Subsurface/Content/Items/blank.png and b/Subsurface/Content/Items/blank.png differ diff --git a/Subsurface/Source/Items/Components/ItemLabel.cs b/Subsurface/Source/Items/Components/ItemLabel.cs index 7837ad5c0..a26acc44e 100644 --- a/Subsurface/Source/Items/Components/ItemLabel.cs +++ b/Subsurface/Source/Items/Components/ItemLabel.cs @@ -14,6 +14,12 @@ namespace Barotrauma.Items.Components set { if (value == TextBlock.Text || item.Rect.Width < 5) return; + + if (textBlock.Rect.Width != item.Rect.Width || textBlock.Rect.Height != item.Rect.Height) + { + textBlock = null; + } + TextBlock.Text = value; } } @@ -57,7 +63,7 @@ namespace Barotrauma.Items.Components : base(item, element) { } - + public override void Draw(SpriteBatch spriteBatch, bool editing = false) { base.Draw(spriteBatch, editing); diff --git a/Subsurface/Source/Items/Components/Machines/Reactor.cs b/Subsurface/Source/Items/Components/Machines/Reactor.cs index cbe18715c..f809c0086 100644 --- a/Subsurface/Source/Items/Components/Machines/Reactor.cs +++ b/Subsurface/Source/Items/Components/Machines/Reactor.cs @@ -452,11 +452,17 @@ namespace Barotrauma.Items.Components spriteBatch.DrawString(GUI.Font, "Grid load: " + (int)load + " kW", new Vector2(x + 600, y + 30), Color.Yellow); + float maxLoad = 0.0f; + foreach (float loadVal in loadGraph) + { + maxLoad = Math.Max(maxLoad, loadVal); + } + DrawGraph(tempGraph, spriteBatch, - new Rectangle(x + 30, y + 30, 400, 250), 10000.0f, xOffset, Color.Red); + new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Red); DrawGraph(loadGraph, spriteBatch, - new Rectangle(x + 30, y + 30, 400, 250), 10000.0f, xOffset, Color.Yellow); + new Rectangle(x + 30, y + 30, 400, 250), Math.Max(10000.0f, maxLoad), xOffset, Color.Yellow); spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + (int)shutDownTemp, new Vector2(x + 450, y + 80), Color.White); diff --git a/Subsurface/Source/Items/Components/Power/PowerContainer.cs b/Subsurface/Source/Items/Components/Power/PowerContainer.cs index 5ecaa21bd..85ff2bd07 100644 --- a/Subsurface/Source/Items/Components/Power/PowerContainer.cs +++ b/Subsurface/Source/Items/Components/Power/PowerContainer.cs @@ -124,7 +124,7 @@ namespace Barotrauma.Items.Components foreach (Connection c2 in c.Recipients) { PowerTransfer pt = c2.Item.GetComponent(); - if (pt == null) continue; + if (pt == null || !pt.IsActive) continue; gridLoad += pt.PowerLoad; } diff --git a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs index d4a8c5198..c443b8e1d 100644 --- a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs +++ b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs @@ -130,7 +130,7 @@ namespace Barotrauma.Items.Components //if (it.Updated) continue; Powered powered = it.GetComponent(); - if (powered == null) continue; + if (powered == null || !powered.IsActive) continue; if (connectedList.Contains(powered)) continue; diff --git a/Subsurface/Source/Items/Components/Signal/RelayComponent.cs b/Subsurface/Source/Items/Components/Signal/RelayComponent.cs index 958dffa13..92511b0c5 100644 --- a/Subsurface/Source/Items/Components/Signal/RelayComponent.cs +++ b/Subsurface/Source/Items/Components/Signal/RelayComponent.cs @@ -3,7 +3,7 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - class RelayComponent : ItemComponent + class RelayComponent : PowerTransfer { private float maxPower; @@ -17,27 +17,43 @@ namespace Barotrauma.Items.Components } } + private bool isOn; + [Editable, HasDefaultValue(false, true)] public bool IsOn { - get; set; + get + { + return IsActive; + } + set + { + isOn = value; + IsActive = value; + if (!IsActive) + { + currPowerConsumption = 0.0f; + } + } } public RelayComponent(Item item, XElement element) : base (item, element) { - IsActive = true; - IsOn = true; + IsActive = isOn; } public override void Update(float deltaTime, Camera cam) { + base.Update(deltaTime, cam); item.SendSignal(0, IsOn ? "1" : "0", "state_out"); } public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power=0.0f) { + if (connection.IsPower && connection.Name.Contains("_out")) return; + if (item.Condition <= 0.0f) return; if (power > maxPower) item.Condition = 0.0f;