Disabled flow fields for RTS / Removed pathfind command

This commit is contained in:
Anuken
2022-02-20 14:29:21 -05:00
parent 5e88c5d090
commit 672dfc8538
7 changed files with 13 additions and 27 deletions

View File

@@ -94,11 +94,14 @@ public class Pathfinder implements Runnable{
tiles[i] = packTile(tile, 0);
}
preloadPath(getField(state.rules.waveTeam, costGround, fieldCore));
if(state.rules.waveTeam.needsFlowField()){
preloadPath(getField(state.rules.waveTeam, costGround, fieldCore));
//preload water on naval maps
if(spawner.getSpawns().contains(t -> t.floor().isLiquid)){
preloadPath(getField(state.rules.waveTeam, costNaval, fieldCore));
}
//preload water on naval maps
if(spawner.getSpawns().contains(t -> t.floor().isLiquid)){
preloadPath(getField(state.rules.waveTeam, costNaval, fieldCore));
}
start();

View File

@@ -3,13 +3,9 @@ package mindustry.ai.types;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ai.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.logic.*;
import mindustry.world.*;
import static mindustry.Vars.*;
public class LogicAI extends AIController{
/** Minimum delay between item transfers. */
@@ -68,20 +64,6 @@ public class LogicAI extends AIController{
case approach -> {
moveTo(Tmp.v1.set(moveX, moveY), moveRad - 7f, 7);
}
case pathfind -> {
Building core = unit.closestEnemyCore();
if((core == null || !unit.within(core, unit.range() * 0.5f))){
boolean move = true;
if(state.rules.waves && unit.team == state.rules.defaultTeam){
Tile spawner = getClosestSpawner();
if(spawner != null && unit.within(spawner, state.rules.dropZoneRadius + 120f)) move = false;
}
if(move) pathfind(Pathfinder.fieldCore);
}
}
case stop -> {
unit.clearBuilding();
}

View File

@@ -110,6 +110,11 @@ public class Team implements Comparable<Team>{
return (state.rules.waves || state.rules.attackMode) && this == state.rules.waveTeam;
}
/** @return whether this team needs a flow field for "dumb" wave pathfinding. */
public boolean needsFlowField(){
return isAI() && !rules().rtsAi;
}
public boolean isEnemy(Team other){
return this != other;
}

View File

@@ -392,9 +392,6 @@ public class LExecutor{
case within -> {
exec.setnum(p4, unit.within(x1, y1, d1) ? 1 : 0);
}
case pathfind -> {
ai.control = type;
}
case target -> {
ai.posTarget.set(x1, y1);
ai.aimControl = type;

View File

@@ -6,7 +6,6 @@ public enum LUnitControl{
move("x", "y"),
approach("x", "y", "radius"),
boost("enable"),
pathfind,
target("x", "y", "shoot"),
targetp("unit", "shoot"),
itemDrop("to", "amount"),

View File

@@ -449,7 +449,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
Schematics.placeLaunchLoadout(spawnX, spawnY);
//all sectors are wave sectors
state.rules.waves = true;
state.rules.waves = false;
state.rules.showSpawns = true;
}
}