Fixed Steering components never setting their currPowerConsumption field above zero, making them cause zero load on the electrical grid.

This commit is contained in:
Joonas Rikkonen
2018-01-01 15:00:12 +02:00
parent 99391f68b2
commit 79f3f04c3b
2 changed files with 7 additions and 4 deletions
@@ -90,7 +90,7 @@ namespace Barotrauma.Items.Components
GuiFrame.Draw(spriteBatch); GuiFrame.Draw(spriteBatch);
if (voltage < minVoltage && powerConsumption > 0.0f) return; if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false); //GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
@@ -136,6 +136,8 @@ namespace Barotrauma.Items.Components
public override void UpdateHUD(Character character) public override void UpdateHUD(Character character)
{ {
GuiFrame.Update(1.0f / 60.0f); GuiFrame.Update(1.0f / 60.0f);
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f) if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f)
{ {
@@ -98,7 +98,6 @@ namespace Barotrauma.Items.Components
: base(item, element) : base(item, element)
{ {
IsActive = true; IsActive = true;
InitProjSpecific(); InitProjSpecific();
} }
@@ -128,8 +127,10 @@ namespace Barotrauma.Items.Components
unsentChanges = false; unsentChanges = false;
} }
} }
if (voltage < minVoltage && powerConsumption > 0.0f) return; currPowerConsumption = powerConsumption;
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
ApplyStatusEffects(ActionType.OnActive, deltaTime, null); ApplyStatusEffects(ActionType.OnActive, deltaTime, null);