mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-10 18:57:39 +07:00
Fixed certain teams not attacking other units
This commit is contained in:
parent
09e34da880
commit
c483ae2c23
@ -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. */
|
||||
|
@ -11,6 +11,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.net.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
@ -41,6 +42,8 @@ public class ScriptMainGenerator{
|
||||
|
||||
classes.removeAll(type -> type.isSynthetic() || type.isAnonymousClass() || type.getCanonicalName() == null || Modifier.isPrivate(type.getModifiers())
|
||||
|| blacklist.contains(s -> type.getName().startsWith(base + "." + s + ".")) || nameBlacklist.contains(type.getSimpleName()));
|
||||
classes.add(NetConnection.class);
|
||||
|
||||
classes.distinct();
|
||||
classes.sortComparing(Class::getName);
|
||||
ObjectSet<String> used = ObjectSet.with();
|
||||
@ -53,12 +56,12 @@ public class ScriptMainGenerator{
|
||||
used.add(type.getPackage().getName());
|
||||
}
|
||||
|
||||
Log.info("Imported @ packages.", used.size);
|
||||
|
||||
for(Class type : EventType.class.getClasses()){
|
||||
result.append("const ").append(type.getSimpleName()).append(" = ").append("Packages.").append(type.getName().replace('$', '.')).append("\n");
|
||||
}
|
||||
|
||||
//Log.info(result);
|
||||
|
||||
new Fi("core/assets/scripts/global.js").writeString(result.toString());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user