Fixed mobile mining/targeting conflict
This commit is contained in:
@@ -714,11 +714,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
//autofire: mobile only!
|
||||
if(mobile){
|
||||
|
||||
if(target == null){
|
||||
isShooting = false;
|
||||
if(Settings.getBool("autotarget")){
|
||||
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
|
||||
if(target != null){
|
||||
setMineTile(null);
|
||||
}
|
||||
}
|
||||
}else if(target.isValid()){
|
||||
//rotate toward and shoot the target
|
||||
|
||||
@@ -86,14 +86,16 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> !u.isDead());
|
||||
|
||||
if(unit != null){
|
||||
threads.run(() -> player.target = unit);
|
||||
player.setMineTile(null);
|
||||
player.target = unit;
|
||||
}else{
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile != null) tile = tile.target();
|
||||
|
||||
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
||||
TileEntity entity = tile.entity;
|
||||
threads.run(() -> player.target = entity);
|
||||
player.setMineTile(null);
|
||||
player.target = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user