(4ddf8b0b2) Fixed power not working correctly in some grids with chained relays and junction boxes. Closes #1385

This commit is contained in:
Joonas Rikkonen
2019-04-07 21:44:02 +03:00
parent 4b58cd0294
commit be96afc5dd
2 changed files with 11 additions and 5 deletions
@@ -354,11 +354,12 @@ namespace Barotrauma.Items.Components
else else
{ {
if (!powerTransfer.CanTransfer) continue; if (!powerTransfer.CanTransfer) continue;
powerTransfer.CheckJunctions( float maxPowerIn = (thisRelayComponent != null && c.IsOutput) ? 0.0f : clampPower;
deltaTime, float maxPowerOut = (thisRelayComponent != null && !c.IsOutput) ? 0.0f : clampLoad;
false, if (maxPowerIn > 0.0f || maxPowerOut > 0.0f)
(thisRelayComponent != null && c.IsOutput) ? 0.0f : clampPower, {
(thisRelayComponent != null && !c.IsOutput) ? 0.0f : clampLoad); powerTransfer.CheckJunctions(deltaTime, false, maxPowerIn, maxPowerOut);
}
} }
continue; continue;
@@ -55,6 +55,11 @@ namespace Barotrauma.Items.Components
private set; private set;
} }
public override string ToString()
{
return "Connection (" + item.Name + ", " + Name + ")";
}
public Connection(XElement element, ConnectionPanel connectionPanel) public Connection(XElement element, ConnectionPanel connectionPanel)
{ {