mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-26 06:27:22 +07:00
Minor pathfinding tweaks
This commit is contained in:
parent
fc8eac4048
commit
026e7501c1
@ -64,8 +64,17 @@ public class ControlPathfinder{
|
||||
start();
|
||||
});
|
||||
|
||||
//only update the world when a solid block is removed or placed, everything else doesn't matter
|
||||
Events.on(TilePreChangeEvent.class, e -> {
|
||||
if(e.tile.solid()){
|
||||
worldUpdateId ++;
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(TileChangeEvent.class, e -> {
|
||||
worldUpdateId ++;
|
||||
if(e.tile.solid()){
|
||||
worldUpdateId ++;
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(ResetEvent.class, event -> stop());
|
||||
@ -447,7 +456,7 @@ public class ControlPathfinder{
|
||||
lastId = curId;
|
||||
|
||||
//re-do everything when world updates
|
||||
if(Time.timeSinceMillis(lastTime) > 1000 * 2 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){
|
||||
if(Time.timeSinceMillis(lastTime) > 1000 * 3 && (worldUpdateId != lastWorldUpdate || !destination.epsilonEquals(lastDestination, 2f))){
|
||||
lastTime = Time.millis();
|
||||
lastWorldUpdate = worldUpdateId;
|
||||
pathIndex = 0;
|
||||
|
@ -280,7 +280,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
//validate commanding units
|
||||
selectedUnits.removeAll(u -> !u.isCommandable());
|
||||
selectedUnits.removeAll(u -> !u.isCommandable() || !u.isValid());
|
||||
|
||||
if(!scene.hasMouse() && !locked){
|
||||
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
||||
|
Loading…
Reference in New Issue
Block a user