Skip to content

Commit

Permalink
Remove redundant checks from RefuelingPump
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Oct 11, 2024
1 parent 1982f54 commit 4a3dcf1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Source/Pumps/RefuelingPump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,10 @@ private void FillAttachedTanks(double deltaTime)

foreach (var tank in tankDefs)
{
if (tank.maxAmount > 0 &&
tank.resource is PartResource r &&
if (tank.resource is PartResource r &&
PartResourceLibrary.Instance.GetDefinition(r.resourceName) is PartResourceDefinition d &&
tank.amount < tank.maxAmount &&
tank.fillable &&
r.flowMode != PartResource.FlowMode.None && r.flowState &&
d.resourceTransferMode == ResourceTransferMode.PUMP)
r.flowMode != PartResource.FlowMode.None && r.flowState)
{
double amount = Math.Min(deltaTime * pump_rate * tank.utilization, tank.maxAmount - tank.amount);

Expand All @@ -127,6 +124,7 @@ tank.resource is PartResource r &&
tank.part.TransferResource(r, amount, part);
}
}

foreach (var partResource in batteries)
{
if (partResource.flowMode != PartResource.FlowMode.None &&
Expand Down

0 comments on commit 4a3dcf1

Please sign in to comment.