mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-05-28 17:06:34 +03:00
Pathfinder bugfixes
This commit is contained in:
@@ -24,6 +24,7 @@ import static mindustry.ai.Pathfinder.*;
|
||||
public class ControlPathfinder implements Runnable{
|
||||
private static final int wallImpassableCap = 1_000_000;
|
||||
private static final int solidCap = 7000;
|
||||
private static boolean initialized;
|
||||
|
||||
public static boolean showDebug;
|
||||
|
||||
@@ -213,7 +214,11 @@ public class ControlPathfinder implements Runnable{
|
||||
LongSeq[][] portalConnections = new LongSeq[4][];
|
||||
}
|
||||
|
||||
static{
|
||||
//this method is not run in a static initializer because it must only happen after Pathfinder registers its events, which means it should happen in the ControlPathfinder constructor
|
||||
static void checkEvents(){
|
||||
if(initialized) return;
|
||||
initialized = true;
|
||||
|
||||
Events.on(ResetEvent.class, event -> controlPath.stop());
|
||||
|
||||
Events.on(WorldLoadEvent.class, event -> {
|
||||
@@ -331,6 +336,10 @@ public class ControlPathfinder implements Runnable{
|
||||
}
|
||||
}
|
||||
|
||||
public ControlPathfinder(){
|
||||
checkEvents();
|
||||
}
|
||||
|
||||
public void updateTile(Tile tile){
|
||||
tile.getLinkedTiles(this::updateSingleTile);
|
||||
}
|
||||
@@ -477,6 +486,11 @@ public class ControlPathfinder implements Runnable{
|
||||
//share portals with the other cluster
|
||||
portals = cluster.portals[direction] = other.portals[(direction + 2) % 4];
|
||||
|
||||
//apparently this is somehow possible...?
|
||||
if(portals == null){
|
||||
portals = cluster.portals[direction] = other.portals[(direction + 2) % 4] = new IntSeq();
|
||||
}
|
||||
|
||||
//clear the portals, they're being recalculated now
|
||||
portals.clear();
|
||||
}
|
||||
@@ -1490,7 +1504,7 @@ public class ControlPathfinder implements Runnable{
|
||||
long lastInvalidCheck = Time.millis() + invalidateCheckInterval;
|
||||
|
||||
while(true){
|
||||
if(net.client()) return;
|
||||
if(net.client() || invalidated) return;
|
||||
try{
|
||||
if(state.isPlaying()){
|
||||
queue.run();
|
||||
@@ -1577,6 +1591,7 @@ public class ControlPathfinder implements Runnable{
|
||||
if(!invalidated){
|
||||
Log.err(e);
|
||||
}else{
|
||||
//This pathfinder is done, don't bother doing any tasks
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RtsAI{
|
||||
static final Seq<Unit> squad = new Seq<>(false), stack = new Seq<>();
|
||||
static final IntSet used = new IntSet();
|
||||
static final IntSet assignedTargets = new IntSet(), invalidTarget = new IntSet();
|
||||
static final float squadRadius = 50f;
|
||||
static final float squadRadius = 60f;
|
||||
static final int timeUpdate = 0, timerSpawn = 1, maxTargetsChecked = 15;
|
||||
|
||||
//in order of priority??
|
||||
|
||||
@@ -508,7 +508,7 @@ public class NetServer implements ApplicationListener{
|
||||
data.stream = new ByteArrayInputStream(stream.toByteArray());
|
||||
player.con.sendStream(data);
|
||||
|
||||
debug("Packed @ bytes of world data.", stream.size());
|
||||
debug("Packed @ bytes of world data to @ (@ / @)", stream.size(), player.name, player.con.address, player.uuid());
|
||||
}
|
||||
|
||||
public void addPacketHandler(String type, Cons2<Player, String> handler){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.graphics;
|
||||
|
||||
import arc.*;
|
||||
import arc.assets.loaders.TextureLoader.*;
|
||||
import arc.files.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
@@ -302,11 +303,12 @@ public class Shaders{
|
||||
public SpaceShader(String frag){
|
||||
super(frag);
|
||||
|
||||
Core.assets.load("sprites/space.png", Texture.class).loaded = t -> {
|
||||
texture = t;
|
||||
texture.setFilter(TextureFilter.linear);
|
||||
texture.setWrap(TextureWrap.mirroredRepeat);
|
||||
};
|
||||
Core.assets.load("sprites/space.png", Texture.class, new TextureParameter(){{
|
||||
magFilter = TextureFilter.linear;
|
||||
minFilter = TextureFilter.mipMapLinearLinear;
|
||||
wrapU = wrapV = TextureWrap.mirroredRepeat;
|
||||
genMipMaps = true;
|
||||
}}).loaded = t -> texture = t;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,4 +26,4 @@ org.gradle.caching=true
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
android.enableR8.fullMode=false
|
||||
archash=12e519832d
|
||||
archash=23264f9514
|
||||
|
||||
Reference in New Issue
Block a user