Unit stances for specific item mining

This commit is contained in:
Anuken 2025-04-25 15:44:49 -04:00
parent ca19d525c4
commit 847a201597
11 changed files with 113 additions and 26 deletions

View file

@ -54,6 +54,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
/** Used for dropping items. */
final static float playerSelectRange = mobile ? 17f : 11f;
final static float unitSelectRadScl = 1f;
final static Seq<UnitStance> stancesOut = new Seq<>();
final static IntSeq removed = new IntSeq();
final static IntSet intSet = new IntSet();
/** Maximum line length. */
@ -369,6 +370,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
ai.attackTarget = null;
}
unit.lastCommanded = player.coloredName();
//make sure its stance is valid
stancesOut.clear();
unit.type.getUnitStances(unit, stancesOut);
if(stancesOut.size > 0 && !stancesOut.contains(ai.stance)){
ai.stance = stancesOut.first();
}
}
}
}