This commit is contained in:
Anuken 2021-08-13 13:58:25 -04:00
parent 6e5ad304e4
commit 0e6d9ea933
3 changed files with 49 additions and 52 deletions

View File

@ -52,6 +52,7 @@ public class BaseAI{
}
public void update(){
if(data.team.rules().aiCoreSpawn && timer.get(timerSpawn, 60 * 2.5f) && data.hasCore()){
CoreBlock block = (CoreBlock)data.core().block;
int coreUnits = Groups.unit.count(u -> u.team == data.team && u.type == block.unitType);
@ -90,6 +91,7 @@ public class BaseAI{
}else{
var field = pathfinder.getField(state.rules.waveTeam, Pathfinder.costGround, Pathfinder.fieldCore);
if(field.weights != null){
int[][] weights = field.weights;
for(int i = 0; i < pathStep; i++){
int minCost = Integer.MAX_VALUE;
@ -136,6 +138,7 @@ public class BaseAI{
}
}
}
}
//only schedule when there's something to build.
if(foundPath && data.blocks.isEmpty() && timer.get(timerStep, Mathf.lerp(20f, 4f, data.team.rules().aiTier))){

View File

@ -26,7 +26,6 @@ import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.graphics.g3d.*;
import mindustry.input.*;
import mindustry.io.legacy.*;
import mindustry.maps.*;
import mindustry.type.*;
import mindustry.ui.*;
@ -165,16 +164,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
return this;
}
//load legacy research
if(Core.settings.has("unlocks") && !Core.settings.has("junction-unlocked")){
Core.app.post(() -> {
ui.showCustomConfirm("@research", "@research.legacy", "@research.load", "@research.discard", () -> {
LegacyIO.readResearch();
Core.settings.remove("unlocks");
}, () -> Core.settings.remove("unlocks"));
});
}
rebuildButtons();
mode = look;
selected = hovered = launchSector = null;

View File

@ -143,10 +143,15 @@ public class UnitFactory extends UnitBlock{
@Override
public Object senseObject(LAccess sensor){
if(sensor == LAccess.config) return currentPlan == -1 ? null : plans.get(currentPlan).unit;
if(sensor == LAccess.progress) return Mathf.clamp(fraction());
return super.senseObject(sensor);
}
@Override
public double sense(LAccess sensor){
if(sensor == LAccess.progress) return Mathf.clamp(fraction());
return super.sense(sensor);
}
@Override
public void buildConfiguration(Table table){
Seq<UnitType> units = Seq.with(plans).map(u -> u.unit).filter(u -> u.unlockedNow() && !u.isBanned());