(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

View File

@@ -354,11 +354,12 @@ namespace Barotrauma.Items.Components
else
{
if (!powerTransfer.CanTransfer) continue;
powerTransfer.CheckJunctions(
deltaTime,
false,
(thisRelayComponent != null && c.IsOutput) ? 0.0f : clampPower,
(thisRelayComponent != null && !c.IsOutput) ? 0.0f : clampLoad);
float maxPowerIn = (thisRelayComponent != null && c.IsOutput) ? 0.0f : clampPower;
float maxPowerOut = (thisRelayComponent != null && !c.IsOutput) ? 0.0f : clampLoad;
if (maxPowerIn > 0.0f || maxPowerOut > 0.0f)
{
powerTransfer.CheckJunctions(deltaTime, false, maxPowerIn, maxPowerOut);
}
}
continue;

View File

@@ -55,6 +55,11 @@ namespace Barotrauma.Items.Components
private set;
}
public override string ToString()
{
return "Connection (" + item.Name + ", " + Name + ")";
}
public Connection(XElement element, ConnectionPanel connectionPanel)
{