Unstable 0.17.10.0
This commit is contained in:
@@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components
|
||||
/// </summary>
|
||||
public override float GetCurrentPowerConsumption(Connection connection = null)
|
||||
{
|
||||
if (connection != this.powerIn)
|
||||
if (connection != this.powerIn || !IsActive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ namespace Barotrauma.Items.Components
|
||||
/// </summary>
|
||||
public override float GetCurrentPowerConsumption(Connection connection = null)
|
||||
{
|
||||
if (connection != this.powerIn)
|
||||
if (connection != this.powerIn || !IsActive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Barotrauma.Items.Components
|
||||
public override float GetCurrentPowerConsumption(Connection connection = null)
|
||||
{
|
||||
//There shouldn't be other power connections to this
|
||||
if (connection != this.powerIn)
|
||||
if (connection != this.powerIn || !IsActive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,11 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
get
|
||||
{
|
||||
if (powerIn != null)
|
||||
if (PoweredByTinkering)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
else if (powerIn != null)
|
||||
{
|
||||
if (powerIn?.Grid != null) { return powerIn.Grid.Voltage; }
|
||||
}
|
||||
@@ -154,6 +158,22 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public bool PoweredByTinkering
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this is PowerContainer) { return false; }
|
||||
foreach (Repairable repairable in Item.Repairables)
|
||||
{
|
||||
if (repairable.IsTinkering && repairable.TinkeringPowersDevices)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, Serialize(true, IsPropertySaveable.Yes, description: "Can the item be damaged by electomagnetic pulses.")]
|
||||
public bool VulnerableToEMP
|
||||
{
|
||||
@@ -459,19 +479,12 @@ namespace Barotrauma.Items.Components
|
||||
if (powered.powerIn != null && powered.powerOut != powered.powerIn)
|
||||
{
|
||||
//Get the new load for the connection
|
||||
float currLoad;
|
||||
if (powered.Item.GetComponent<Repairable>() is Repairable repairable && repairable.IsTinkering && repairable.TinkeringPowersDevices && !(powered is PowerContainer))
|
||||
{
|
||||
currLoad = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
currLoad = powered.GetCurrentPowerConsumption(powered.powerIn);
|
||||
}
|
||||
float currLoad = powered.GetCurrentPowerConsumption(powered.powerIn);
|
||||
|
||||
//If its a load update its grid load
|
||||
if (currLoad >= 0)
|
||||
{
|
||||
if (powered.PoweredByTinkering) { currLoad = 0.0f; }
|
||||
powered.CurrPowerConsumption = currLoad;
|
||||
if (powered.powerIn.Grid != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user