- camera follows the closest sub
- WIP "respawn shuttle" - submarine size affects its mass - electricity fixes
This commit is contained in:
@@ -113,7 +113,7 @@ namespace Barotrauma.Items.Components
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
float chargeRate = (float)(Math.Sqrt(charge / capacity));
|
||||
//float gridPower = 0.0f;
|
||||
float gridPower = 0.0f;
|
||||
float gridLoad = 0.0f;
|
||||
|
||||
//if (item.linkedTo.Count == 0) return;
|
||||
@@ -126,7 +126,8 @@ namespace Barotrauma.Items.Components
|
||||
PowerTransfer pt = c2.Item.GetComponent<PowerTransfer>();
|
||||
if (pt == null || !pt.IsActive) continue;
|
||||
|
||||
gridLoad += pt.PowerLoad;
|
||||
gridLoad += pt.PowerLoad;
|
||||
gridPower -= pt.CurrPowerConsumption;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,27 +172,21 @@ namespace Barotrauma.Items.Components
|
||||
// -maxOutput * chargeRate,
|
||||
// 0.1f);
|
||||
|
||||
if (outputVoltage < 1.0f)
|
||||
if (gridPower < gridLoad)
|
||||
{
|
||||
// CurrPowerOutput = MathHelper.Lerp(
|
||||
//CurrPowerOutput, Math.Min(maxOutput * chargeRate, gridLoad), 0.05f);
|
||||
|
||||
CurrPowerOutput = MathHelper.Lerp(
|
||||
CurrPowerOutput, Math.Min(maxOutput * chargeRate, gridLoad), 0.05f);
|
||||
CurrPowerOutput,
|
||||
Math.Min(maxOutput * chargeRate, gridLoad - (gridLoad * outputVoltage)),
|
||||
0.05f);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrPowerOutput = MathHelper.Lerp(CurrPowerOutput, 0.0f, 0.05f);
|
||||
}
|
||||
|
||||
CurrPowerOutput = MathHelper.Lerp(
|
||||
CurrPowerOutput,
|
||||
Math.Min(maxOutput * chargeRate, gridLoad - (gridLoad * outputVoltage)),
|
||||
0.05f);
|
||||
|
||||
|
||||
|
||||
//powerConsumption = MathHelper.Lerp(
|
||||
// powerConsumption,
|
||||
// -Math.Min(maxOutput * chargeRate, gridLoad - (power)),
|
||||
// 0.1f);
|
||||
|
||||
//powerConsumption = Math.Min(powerConsumption, 0.0f);
|
||||
Charge -= CurrPowerOutput / 3600.0f;
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace Barotrauma.Items.Components
|
||||
pt.powerLoad += (fullLoad - pt.powerLoad) / inertia;
|
||||
pt.currPowerConsumption += (-fullPower - pt.currPowerConsumption) / inertia;
|
||||
pt.Item.SendSignal(0, "", "power", fullPower / Math.Max(fullLoad, 1.0f));
|
||||
pt.Item.SendSignal(0, "", "power_out", fullPower / Math.Max(fullLoad, 1.0f));
|
||||
|
||||
//damage the item if voltage is too high
|
||||
//(except if running as a client)
|
||||
@@ -117,7 +118,6 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (!c.IsPower) continue;
|
||||
|
||||
|
||||
var recipients = c.Recipients;
|
||||
|
||||
foreach (Connection recipient in recipients)
|
||||
@@ -138,7 +138,7 @@ namespace Barotrauma.Items.Components
|
||||
PowerContainer powerContainer = powered as PowerContainer;
|
||||
if (powerTransfer != null)
|
||||
{
|
||||
if (powerTransfer.updateTimer>0) continue;
|
||||
//if (powerTransfer.updateTimer>0) continue;
|
||||
powerTransfer.CheckJunctions(deltaTime);
|
||||
}
|
||||
else if (powerContainer != null)
|
||||
|
||||
Reference in New Issue
Block a user