Minor building optimization
This commit is contained in:
@@ -86,9 +86,9 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
|||||||
buildAlpha = Mathf.lerpDelta(buildAlpha, activelyBuilding() ? 1f : 0f, 0.15f);
|
buildAlpha = Mathf.lerpDelta(buildAlpha, activelyBuilding() ? 1f : 0f, 0.15f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//validate regardless of whether building is enabled.
|
validatePlans();
|
||||||
|
|
||||||
if(!updateBuilding || !canBuild()){
|
if(!updateBuilding || !canBuild()){
|
||||||
validatePlans();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,19 +99,18 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
|||||||
if(Float.isNaN(buildCounter) || Float.isInfinite(buildCounter)) buildCounter = 0f;
|
if(Float.isNaN(buildCounter) || Float.isInfinite(buildCounter)) buildCounter = 0f;
|
||||||
buildCounter = Math.min(buildCounter, 10f);
|
buildCounter = Math.min(buildCounter, 10f);
|
||||||
|
|
||||||
|
boolean instant = state.rules.instantBuild && state.rules.infiniteResources;
|
||||||
|
|
||||||
//random attempt to fix a freeze that only occurs on Android
|
//random attempt to fix a freeze that only occurs on Android
|
||||||
int maxPerFrame = state.rules.instantBuild ? plans.size : 10, count = 0;
|
int maxPerFrame = instant ? plans.size : 10, count = 0;
|
||||||
|
|
||||||
while((buildCounter >= 1 || state.rules.instantBuild) && count++ < maxPerFrame){
|
var core = core();
|
||||||
|
|
||||||
|
if((core == null && !infinite)) return;
|
||||||
|
|
||||||
|
while((buildCounter >= 1 || instant) && count++ < maxPerFrame && plans.size > 0){
|
||||||
buildCounter -= 1f;
|
buildCounter -= 1f;
|
||||||
|
|
||||||
validatePlans();
|
|
||||||
|
|
||||||
var core = core();
|
|
||||||
|
|
||||||
//nothing to build, or core doesn't exist
|
|
||||||
if(buildPlan() == null || (core == null && !infinite)) return;
|
|
||||||
|
|
||||||
//find the next build plan
|
//find the next build plan
|
||||||
if(plans.size > 1){
|
if(plans.size > 1){
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=137d14855f
|
archash=008e73aa33
|
||||||
|
|||||||
Reference in New Issue
Block a user