Fixed ground units not targeting things properly
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user