Fixed certain teams not attacking other units
This commit is contained in:
@@ -79,6 +79,7 @@ importPackage(Packages.mindustry.maps)
|
||||
importPackage(Packages.mindustry.maps.filters)
|
||||
importPackage(Packages.mindustry.maps.generators)
|
||||
importPackage(Packages.mindustry.maps.planet)
|
||||
importPackage(Packages.mindustry.net)
|
||||
importPackage(Packages.mindustry.type)
|
||||
importPackage(Packages.mindustry.ui)
|
||||
importPackage(Packages.mindustry.ui.dialogs)
|
||||
|
||||
@@ -251,9 +251,20 @@ public class Units{
|
||||
|
||||
/** Iterates over all units that are enemies of this team. */
|
||||
public static void nearbyEnemies(Team team, float x, float y, float width, float height, Cons<Unit> cons){
|
||||
for(Team enemy : state.teams.enemiesOf(team)){
|
||||
nearby(enemy, x, y, width, height, cons);
|
||||
if(team.active()){
|
||||
for(Team enemy : state.teams.enemiesOf(team)){
|
||||
nearby(enemy, x, y, width, height, cons);
|
||||
}
|
||||
}else{
|
||||
//inactive teams have no cache, check everything
|
||||
//TODO cache all teams with units OR blocks
|
||||
for(Team other : Team.all){
|
||||
if(other != team && teamIndex.count(other) > 0){
|
||||
nearby(other, x, y, width, height, cons);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Iterates over all units that are enemies of this team. */
|
||||
|
||||
Reference in New Issue
Block a user