Cleanup, optimization

This commit is contained in:
Anuken
2020-05-01 16:35:18 -04:00
parent 3101fc8056
commit 135b87fdb2
20 changed files with 138 additions and 154 deletions

View File

@@ -2,13 +2,17 @@ package mindustry.async;
import arc.*;
import arc.struct.*;
import mindustry.*;
import mindustry.game.EventType.*;
import java.util.concurrent.*;
public class AsyncLogic{
//all processes to be executed each frame
private Array<AsyncProcess> processes = Array.with(new PhysicsProcess(), new CollisionProcess());
private Array<AsyncProcess> processes = Array.with(
new PhysicsProcess(),
Vars.teamIndex = new TeamIndexProcess()
);
//futures to be awaited
private Array<Future<?>> futures = new Array<>();
@@ -46,7 +50,9 @@ public class AsyncLogic{
//submit all tasks
for(AsyncProcess p : processes){
futures.add(executor.submit(p::process));
if(p.shouldProcess()){
futures.add(executor.submit(p::process));
}
}
}