This commit is contained in:
Anuken
2019-08-30 16:39:40 -04:00
172 changed files with 6795 additions and 5599 deletions
@@ -24,7 +24,7 @@ public class BlockIndexer{
private final static int quadrantSize = 16;
/** Set of all ores that are being scanned. */
private final ObjectSet<Item> scanOres = ObjectSet.with(Item.getAllOres().toArray(Item.class));
private final ObjectSet<Item> scanOres = new ObjectSet<>();
private final ObjectSet<Item> itemSet = new ObjectSet<>();
/** Stores all ore quadtrants on the map. */
private ObjectMap<Item, ObjectSet<Tile>> ores;
@@ -57,6 +57,8 @@ public class BlockIndexer{
});
Events.on(WorldLoadEvent.class, event -> {
scanOres.clear();
scanOres.addAll(Item.getAllOres());
damagedTiles = new ObjectSet[Team.all.length];
flagMap = new ObjectSet[Team.all.length][BlockFlag.all.length];
@@ -15,8 +15,7 @@ import io.anuke.mindustry.world.Pos;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockFlag;
import static io.anuke.mindustry.Vars.state;
import static io.anuke.mindustry.Vars.world;
import static io.anuke.mindustry.Vars.*;
public class Pathfinder{
private static final long maxUpdate = Time.millisToNanos(4);
@@ -116,7 +115,7 @@ public class Pathfinder{
path.lastSearchTime = Time.millis();
//add all targets to the frontier
for(Tile other : world.indexer.getEnemy(team, BlockFlag.target)){
for(Tile other : indexer.getEnemy(team, BlockFlag.target)){
path.weights[other.x][other.y] = 0;
path.searches[other.x][other.y] = (short)path.search;
path.frontier.addFirst(other.pos());