Fixed Powered ItemComponents (not components deriving from Powered) never resetting their voltage after receiving power, causing them to stay powered indefinitely. Closes #247
This commit is contained in:
@@ -61,9 +61,9 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime, cam);
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|
||||||
currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
|
currPowerConsumption = Math.Abs(targetForce) / 100.0f * powerConsumption;
|
||||||
|
|
||||||
if (powerConsumption == 0.0f) voltage = 1.0f;
|
if (powerConsumption == 0.0f) voltage = 1.0f;
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
currPowerConsumption = powerConsumption;
|
currPowerConsumption = powerConsumption;
|
||||||
|
|
||||||
hasPower = voltage > minVoltage;
|
if (voltage > minVoltage)
|
||||||
|
|
||||||
if (hasPower)
|
|
||||||
{
|
{
|
||||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime, cam);
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|
||||||
CurrFlow = 0.0f;
|
CurrFlow = 0.0f;
|
||||||
currPowerConsumption = powerConsumption;
|
currPowerConsumption = powerConsumption;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
currPowerConsumption = powerConsumption;
|
currPowerConsumption = powerConsumption;
|
||||||
|
|
||||||
base.Update(deltaTime, cam);
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|
||||||
if (voltage >= minVoltage || powerConsumption <= 0.0f)
|
if (voltage >= minVoltage || powerConsumption <= 0.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (connection.IsPower) voltage = power;
|
if (connection.IsPower) voltage = power;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
protected void UpdateOnActiveEffects(float deltaTime)
|
||||||
{
|
{
|
||||||
if (currPowerConsumption == 0.0f)
|
if (currPowerConsumption == 0.0f)
|
||||||
{
|
{
|
||||||
@@ -121,6 +121,13 @@ namespace Barotrauma.Items.Components
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Update(float deltaTime, Camera cam)
|
||||||
|
{
|
||||||
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|
||||||
|
voltage = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime, cam);
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
light.ParentSub = item.Submarine;
|
light.ParentSub = item.Submarine;
|
||||||
|
|||||||
Reference in New Issue
Block a user