Skip to content

Commit

Permalink
Fix wonky energy cap calculation
Browse files Browse the repository at this point in the history
Closes #19
  • Loading branch information
62832 committed Jun 1, 2024
1 parent df73916 commit 2906b7d
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public boolean canAcceptSource() {
@Override
public int getSource() {
var max = getMaxSource();
// shows up as full a lot sooner than it should, so that things stop sending unneeded power
// also, we use our own conversion so power units is AE
var earlyCap = sink.getExternalPowerDemand(PowerUnits.AE, Math.max(0, max - 1000 * AE_PER_SOURCE));
return (int) Math.min(max, max - (earlyCap / AE_PER_SOURCE) + 1000);
return (int) Math.min(max, max - (sink.getExternalPowerDemand(PowerUnits.AE, max) / AE_PER_SOURCE) + 1000);
}

@Override
Expand Down

0 comments on commit 2906b7d

Please sign in to comment.