Turrets target blocks / Added core no-build radius

This commit is contained in:
Anuken
2018-08-15 14:13:50 -04:00
parent 0267cb4006
commit c98fcbd795
8 changed files with 51 additions and 11 deletions

View File

@@ -53,6 +53,9 @@ public class Predict{
* See {@link #intercept(float, float, float, float, float, float, float)}.
*/
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
if(vec.set(dst.getVelocity().sub(src.getVelocity())).isZero()){
return vresult.set(dst.getX(), dst.getY());
}
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.getVelocity().x - src.getVelocity().x, dst.getVelocity().x - src.getVelocity().y, v);
}

View File

@@ -147,11 +147,14 @@ public class Units{
}
}
/**
* Returns the closest target enemy. First, units are checked, then tile entities.
*/
/**Returns the closest target enemy. First, units are checked, then tile entities.*/
public static TargetTrait getClosestTarget(Team team, float x, float y, float range){
Unit unit = getClosestEnemy(team, x, y, range, u -> true);
return getClosestTarget(team, x, y, range, u -> true);
}
/**Returns the closest target enemy. First, units are checked, then tile entities.*/
public static TargetTrait getClosestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred){
Unit unit = getClosestEnemy(team, x, y, range, unitPred);
if(unit != null){
return unit;
}else{