Build 0.17.14.0

This commit is contained in:
Markus Isberg
2022-04-27 07:44:37 +09:00
parent 7a09cf3260
commit 6e38444fc4
47 changed files with 560 additions and 280 deletions
@@ -33,9 +33,6 @@ namespace Barotrauma.Items.Components
set;
}
private JobPrefab cachedJobPrefab;
private string cachedName;
public ImmutableHashSet<Identifier> OwnerTagSet { get; set; }
[Serialize("", IsPropertySaveable.Yes, alwaysUseInstanceValues: true)]
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
@@ -677,21 +677,18 @@ namespace Barotrauma.Items.Components
/// </summary>
protected float GetAvailableInstantaneousBatteryPower()
{
if (item.Connections == null) { return 0.0f; }
if (item.Connections == null || powerIn == null) { return 0.0f; }
float availablePower = 0.0f;
foreach (Connection c in item.Connections)
var recipients = powerIn.Recipients;
foreach (Connection recipient in recipients)
{
var recipients = c.Recipients;
foreach (Connection recipient in recipients)
{
if (!recipient.IsPower || !recipient.IsOutput) { continue; }
var battery = recipient.Item?.GetComponent<PowerContainer>();
if (battery == null) { continue; }
float maxOutputPerFrame = battery.MaxOutPut / 60.0f;
float framesPerMinute = 3600.0f;
availablePower += Math.Min(battery.Charge * framesPerMinute, maxOutputPerFrame);
}
}
if (!recipient.IsPower || !recipient.IsOutput) { continue; }
var battery = recipient.Item?.GetComponent<PowerContainer>();
if (battery == null || battery.Item.Condition <= 0.0f) { continue; }
float maxOutputPerFrame = battery.MaxOutPut / 60.0f;
float framesPerMinute = 3600.0f;
availablePower += Math.Min(battery.Charge * framesPerMinute, maxOutputPerFrame);
}
return availablePower;
}
@@ -597,7 +597,7 @@ namespace Barotrauma.Items.Components
else if (ic is PowerTransfer pt)
{
//power transfer items (junction boxes, relays) don't deteriorate if they're no carrying any power
if (Math.Abs(pt.CurrPowerConsumption) > 0.1f) { return true; }
if (pt.Voltage > 0.1f) { return true; }
}
else if (ic is PowerContainer pc)
{