Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2022-01-10 23:43:18 -05:00
8 changed files with 138 additions and 43 deletions
+5 -4
View File
@@ -31,7 +31,7 @@ public class BlockIndexer{
/** Stores all damaged tile entities by team. */
private Seq<Building>[] damagedTiles = new Seq[Team.all.length];
/** All ores available on this map. */
private ObjectSet<Item> allOres = new ObjectSet<>();
private ObjectIntMap<Item> allOres = new ObjectIntMap<>();
/** Stores teams that are present here as tiles. */
private Seq<Team> activeTeams = new Seq<>(Team.class);
/** Maps teams to a map of flagged tiles by flag. */
@@ -76,8 +76,6 @@ public class BlockIndexer{
var drop = tile.drop();
if(drop != null){
allOres.add(drop);
int qx = (tile.x / quadrantSize);
int qy = (tile.y / quadrantSize);
@@ -90,6 +88,7 @@ public class BlockIndexer{
ores[drop.id][qx][qy] = new IntSeq(false, 16);
}
ores[drop.id][qx][qy].add(tile.pos());
allOres.increment(drop);
}
}
}
@@ -148,9 +147,11 @@ public class BlockIndexer{
//when the drop can be mined, record the ore position
if(tile.block() == Blocks.air && !seq.contains(pos)){
seq.add(pos);
allOres.increment(drop);
}else{
//otherwise, it likely became blocked, remove it (even if it wasn't there)
seq.removeValue(pos);
allOres.increment(drop, -1);
}
}
@@ -175,7 +176,7 @@ public class BlockIndexer{
/** @return whether this item is present on this map. */
public boolean hasOre(Item item){
return allOres.contains(item);
return allOres.get(item) > 0;
}
/** Returns all damaged tiles by team. */