Fixed #2929
This commit is contained in:
@@ -3,9 +3,11 @@ package mindustry.entities;
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
@@ -308,20 +310,12 @@ 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){
|
||||
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 && other.data().unitCount > 0){
|
||||
nearby(other, x, y, width, height, cons);
|
||||
}
|
||||
Seq<TeamData> data = state.teams.present;
|
||||
for(int i = 0; i < data.size; i++){
|
||||
if(data.items[i].team != team){
|
||||
nearby(data.items[i].team, x, y, width, height, cons);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Iterates over all units that are enemies of this team. */
|
||||
|
||||
Reference in New Issue
Block a user