mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 14:32:06 -08:00
Minor building optimization
This commit is contained in:
parent
8aa7e8b930
commit
eddcd8fc6d
2 changed files with 11 additions and 12 deletions
|
|
@ -86,9 +86,9 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
|||
buildAlpha = Mathf.lerpDelta(buildAlpha, activelyBuilding() ? 1f : 0f, 0.15f);
|
||||
}
|
||||
|
||||
//validate regardless of whether building is enabled.
|
||||
validatePlans();
|
||||
|
||||
if(!updateBuilding || !canBuild()){
|
||||
validatePlans();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -99,19 +99,18 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
|||
if(Float.isNaN(buildCounter) || Float.isInfinite(buildCounter)) buildCounter = 0f;
|
||||
buildCounter = Math.min(buildCounter, 10f);
|
||||
|
||||
boolean instant = state.rules.instantBuild && state.rules.infiniteResources;
|
||||
|
||||
//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;
|
||||
|
||||
validatePlans();
|
||||
|
||||
var core = core();
|
||||
|
||||
//nothing to build, or core doesn't exist
|
||||
if(buildPlan() == null || (core == null && !infinite)) return;
|
||||
|
||||
//find the next build plan
|
||||
if(plans.size > 1){
|
||||
int total = 0;
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||
#used for slow jitpack builds; TODO see if this actually works
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
archash=137d14855f
|
||||
archash=008e73aa33
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue