Preload naval paths on liquid spawns

This commit is contained in:
Anuken
2020-12-30 19:35:23 -05:00
parent f5410c5712
commit 727b47dba5
4 changed files with 11 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class Pathfinder implements Runnable{
private static final long maxUpdate = Time.millisToNanos(6);
private static final long maxUpdate = Time.millisToNanos(7);
private static final int updateFPS = 60;
private static final int updateInterval = 1000 / updateFPS;
private static final int impassable = -1;
@@ -37,7 +37,7 @@ public class Pathfinder implements Runnable{
public static final int
costGround = 0,
costLegs = 1,
costWater = 2;
costNaval = 2;
public static final Seq<PathCost> costTypes = Seq.with(
//ground
@@ -90,6 +90,11 @@ public class Pathfinder implements Runnable{
preloadPath(getField(state.rules.waveTeam, costGround, fieldCore));
//preload water on naval maps
if(spawner.getSpawns().contains(t -> t.floor().isLiquid)){
preloadPath(getField(state.rules.waveTeam, costNaval, fieldCore));
}
start();
});

View File

@@ -48,8 +48,8 @@ public class FormationAI extends AIController implements FormationMember{
Vec2 realtarget = vec.set(target).add(leader.vel.x, leader.vel.y);
float speed = unit.realSpeed() * unit.floorSpeedMultiplier();
unit.approach(Mathf.arrive(unit.x, unit.y, realtarget.x, realtarget.y, unit.vel, 0f, 0.01f, speed, 1f));
float speed = unit.realSpeed() * unit.floorSpeedMultiplier() * Time.delta;
unit.approach(Mathf.arrive(unit.x, unit.y, realtarget.x, realtarget.y, unit.vel, speed, 0f, speed, 1f).scl(1f / Time.delta));
if(unit.canMine() && leader.canMine()){
if(leader.mineTile != null && unit.validMine(leader.mineTile)){