diff --git a/core/src/mindustry/ai/ControlPathfinder.java b/core/src/mindustry/ai/ControlPathfinder.java index 1853fe865b..34cafe959b 100644 --- a/core/src/mindustry/ai/ControlPathfinder.java +++ b/core/src/mindustry/ai/ControlPathfinder.java @@ -430,7 +430,7 @@ public class ControlPathfinder{ int rayPathIndex = -1; IntSeq result = new IntSeq(); - float raycastTimer; + volatile float raycastTimer; PathfindQueue frontier = new PathfindQueue(); //node index -> node it came from @@ -451,7 +451,7 @@ public class ControlPathfinder{ void update(long maxUpdateNs){ if(curId != lastId){ - clear(); + clear(true); } lastId = curId; @@ -459,10 +459,7 @@ public class ControlPathfinder{ if(Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){ lastTime = Time.millis(); lastWorldUpdate = worldUpdateId; - pathIndex = 0; - rayPathIndex = -1; - result.clear(); - clear(); + clear(false); } if(done) return; @@ -512,8 +509,12 @@ public class ControlPathfinder{ } lastTime = Time.millis(); + raycastTimer = 9999f; result.clear(); + pathIndex = 0; + rayPathIndex = -1; + if(foundEnd){ int cur = goal; while(cur != start){ @@ -549,7 +550,7 @@ public class ControlPathfinder{ result.size = output + 1; } - void clear(){ + void clear(boolean resetCurrent){ done = false; frontier = new PathfindQueue(20); @@ -565,8 +566,11 @@ public class ControlPathfinder{ frontier.add(start, 0); foundEnd = false; - result.clear(); lastDestination.set(destination); + + if(resetCurrent){ + result.clear(); + } } } } diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index f8d8effa58..8b55e3c24c 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2934,7 +2934,7 @@ public class UnitTypes{ unitSpawned = new MissileUnitType("quell-missile"){{ speed = 3.8f; - maxRange = 15f; + maxRange = 6f; lifetime = 60f * 1.2f; outlineColor = Pal.darkOutline; health = 45; @@ -3393,10 +3393,6 @@ public class UnitTypes{ ); }}; - //payloadDrone = new UnitType("payload-drone"){{ - - //}}; - //endregion } } diff --git a/core/src/mindustry/type/unit/MissileUnitType.java b/core/src/mindustry/type/unit/MissileUnitType.java index 393b0960d6..adc20ad0d0 100644 --- a/core/src/mindustry/type/unit/MissileUnitType.java +++ b/core/src/mindustry/type/unit/MissileUnitType.java @@ -30,7 +30,7 @@ public class MissileUnitType extends UnitType{ speed = 4f; lifetime = 60f * 1.7f; rotateSpeed = 2.5f; - range = 15f; + range = 6f; targetPriority = -1f; outlineColor = Pal.darkOutline; //TODO weapon configs, etc?