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