Pathfinding cleanup
Some checks failed
Validate Gradle Wrapper / Validation (push) Successful in 48s
Tests / runPush (push) Failing after 42s

This commit is contained in:
Anuken 2024-11-30 23:59:29 -05:00
parent c189d15983
commit b80c8762cc

View File

@ -4,7 +4,6 @@ import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.*;
import mindustry.ai.*;
import mindustry.entities.*;
import mindustry.game.*;
import mindustry.gen.*;
@ -127,7 +126,7 @@ public class AIController implements UnitController{
if(tile == null) return;
Tile targetTile = pathfinder.getTargetTile(tile, pathfinder.getField(unit.team, costType, pathTarget));
if(tile == targetTile || (costType == Pathfinder.costNaval && !targetTile.floor().isLiquid)) return;
if(tile == targetTile || !unit.canPass(targetTile.x, targetTile.y)) return;
unit.movePref(vec.trns(unit.angleTo(targetTile.worldx(), targetTile.worldy()), prefSpeed()));
}