Separate recharge and power_out connections in batteries (todo: configure recharge connections as power connections)

This commit is contained in:
Regalis
2016-02-05 22:10:51 +02:00
parent 6db3062cc8
commit ec7bd3523c
3 changed files with 78 additions and 22 deletions

View File

@@ -113,7 +113,7 @@ namespace Barotrauma.Items.Components
if (!c.IsPower) continue;
foreach (Connection recipient in c.Recipients)
{
if (recipient == null || !recipient.IsPower) continue;
if (recipient == null || !c.IsPower) continue;
Item it = recipient.Item;
if (it == null) continue;
@@ -124,11 +124,23 @@ namespace Barotrauma.Items.Components
if (powered == null) continue;
PowerTransfer powerTransfer = powered as PowerTransfer;
PowerContainer powerContainer = powered as PowerContainer;
if (powerTransfer != null)
{
if (powerTransfer.updateTimer>0) continue;
powerTransfer.CheckJunctions(deltaTime);
}
else if (powerContainer != null)
{
if (recipient.Name.Contains("recharge"))
{
fullLoad += powerContainer.CurrPowerConsumption;
}
else
{
fullPower += powerContainer.CurrPowerOutput;
}
}
else
{
connectedList.Add(powered);