Fixed ground units not targeting things properly

This commit is contained in:
Anuken
2018-07-02 21:47:26 -04:00
parent 9130302c93
commit e66c95fc76
2 changed files with 1 additions and 7 deletions

View File

@@ -114,22 +114,16 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
}
public void targetClosestAllyFlag(BlockFlag flag){
if(target != null) return;
Tile target = Geometry.findClosest(x, y, world.indexer().getAllied(team, flag));
if (target != null) this.target = target.entity;
}
public void targetClosestEnemyFlag(BlockFlag flag){
if(target != null) return;
Tile target = Geometry.findClosest(x, y, world.indexer().getEnemy(team, flag));
if (target != null) this.target = target.entity;
}
public void targetClosest(){
if(target != null) return;
target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange());
}

View File

@@ -219,7 +219,7 @@ public abstract class GroundUnit extends BaseUnit {
TileEntity core = getClosestEnemyCore();
float dst = core == null ? 0 :distanceTo(core);
if(core != null && inventory.hasAmmo() && dst < inventory.getAmmo().getRange()){
if(core != null && inventory.hasAmmo() && dst < inventory.getAmmo().getRange()/1.1f){
target = core;
}else {
retarget(() -> targetClosest());