Potentially fixed targeting issues
This commit is contained in:
@@ -143,7 +143,7 @@ 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){
|
public static TargetTrait getClosestTarget(Team team, float x, float y, float range){
|
||||||
return getClosestTarget(team, x, y, range, u -> true);
|
return getClosestTarget(team, x, y, range, u -> !u.isDead() && u.isAdded());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Returns the closest target enemy. First, units are checked, then tile entities.*/
|
/**Returns the closest target enemy. First, units are checked, then tile entities.*/
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
/** Check and assign targets for a specific position. */
|
/** Check and assign targets for a specific position. */
|
||||||
void checkTargets(float x, float y){
|
void checkTargets(float x, float y){
|
||||||
synchronized(Entities.entityLock){
|
synchronized(Entities.entityLock){
|
||||||
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> true);
|
Unit unit = Units.getClosestEnemy(player.getTeam(), x, y, 20f, u -> !u.isDead() && u.isAdded());
|
||||||
|
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
threads.run(() -> player.target = unit);
|
threads.run(() -> player.target = unit);
|
||||||
|
|||||||
Reference in New Issue
Block a user