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!
|
//autofire: mobile only!
|
||||||
if(mobile){
|
if(mobile){
|
||||||
|
|
||||||
if(target == null){
|
if(target == null){
|
||||||
isShooting = false;
|
isShooting = false;
|
||||||
if(Settings.getBool("autotarget")){
|
if(Settings.getBool("autotarget")){
|
||||||
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
|
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
|
||||||
|
if(target != null){
|
||||||
|
setMineTile(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else if(target.isValid()){
|
}else if(target.isValid()){
|
||||||
//rotate toward and shoot the target
|
//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());
|
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> !u.isDead());
|
||||||
|
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
threads.run(() -> player.target = unit);
|
player.setMineTile(null);
|
||||||
|
player.target = unit;
|
||||||
}else{
|
}else{
|
||||||
Tile tile = world.tileWorld(x, y);
|
Tile tile = world.tileWorld(x, y);
|
||||||
if(tile != null) tile = tile.target();
|
if(tile != null) tile = tile.target();
|
||||||
|
|
||||||
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
if(tile != null && state.teams.areEnemies(player.getTeam(), tile.getTeam())){
|
||||||
TileEntity entity = tile.entity;
|
TileEntity entity = tile.entity;
|
||||||
threads.run(() -> player.target = entity);
|
player.setMineTile(null);
|
||||||
|
player.target = entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user