Skip to content

Commit

Permalink
[WorkNet] Move "ready" check to before time calcs
Browse files Browse the repository at this point in the history
For each catch-up pass, there's only one opportunity, so any sinks that
aren't ready will miss out on their share of time. This gets Rodger's 3h
test working.
  • Loading branch information
taniwha committed Jul 7, 2022
1 parent a646a7a commit 7076f21
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Workshop/VesselWorkNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,18 @@ bool CatchUpBacklog ()
if (ResourceScenario.Instance == null) {
return true;
}
for (int i = 0; i < protoSinks.Count; i++) {
var ps = protoSinks[i];
if (ps.isActive) {
if (!sinks[i].ready) {
return true;
}
}
}

double currentTime = Planetarium.GetUniversalTime ();
double delta = currentTime - lastUpdate;
//Debug.Log ($"[ELVesselWorkNet] CatchUpBacklog: {delta}");
delta = Math.Min (delta, ResourceUtilities.GetMaxDeltaTime ());
lastUpdate += delta;

Expand All @@ -241,9 +250,6 @@ bool CatchUpBacklog ()
for (int i = 0; i < protoSinks.Count; i++) {
var ps = protoSinks[i];
if (ps.isActive) {
if (!sinks[i].ready) {
continue;
}
ps.CatchUpBacklog (sinks[i], work);
}
}
Expand Down

0 comments on commit 7076f21

Please sign in to comment.