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.filters)
|
||||||
importPackage(Packages.mindustry.maps.generators)
|
importPackage(Packages.mindustry.maps.generators)
|
||||||
importPackage(Packages.mindustry.maps.planet)
|
importPackage(Packages.mindustry.maps.planet)
|
||||||
|
importPackage(Packages.mindustry.net)
|
||||||
importPackage(Packages.mindustry.type)
|
importPackage(Packages.mindustry.type)
|
||||||
importPackage(Packages.mindustry.ui)
|
importPackage(Packages.mindustry.ui)
|
||||||
importPackage(Packages.mindustry.ui.dialogs)
|
importPackage(Packages.mindustry.ui.dialogs)
|
||||||
|
|||||||
@@ -251,9 +251,20 @@ public class Units{
|
|||||||
|
|
||||||
/** Iterates over all units that are enemies of this team. */
|
/** 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){
|
public static void nearbyEnemies(Team team, float x, float y, float width, float height, Cons<Unit> cons){
|
||||||
for(Team enemy : state.teams.enemiesOf(team)){
|
if(team.active()){
|
||||||
nearby(enemy, x, y, width, height, cons);
|
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. */
|
/** Iterates over all units that are enemies of this team. */
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.net.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.*;
|
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())
|
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()));
|
|| blacklist.contains(s -> type.getName().startsWith(base + "." + s + ".")) || nameBlacklist.contains(type.getSimpleName()));
|
||||||
|
classes.add(NetConnection.class);
|
||||||
|
|
||||||
classes.distinct();
|
classes.distinct();
|
||||||
classes.sortComparing(Class::getName);
|
classes.sortComparing(Class::getName);
|
||||||
ObjectSet<String> used = ObjectSet.with();
|
ObjectSet<String> used = ObjectSet.with();
|
||||||
@@ -53,12 +56,12 @@ public class ScriptMainGenerator{
|
|||||||
used.add(type.getPackage().getName());
|
used.add(type.getPackage().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.info("Imported @ packages.", used.size);
|
||||||
|
|
||||||
for(Class type : EventType.class.getClasses()){
|
for(Class type : EventType.class.getClasses()){
|
||||||
result.append("const ").append(type.getSimpleName()).append(" = ").append("Packages.").append(type.getName().replace('$', '.')).append("\n");
|
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());
|
new Fi("core/assets/scripts/global.js").writeString(result.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user