Make patrol stance pursue targets

This commit is contained in:
Anuken
2025-01-28 22:34:07 -05:00
parent 4cf9d54c3d
commit a7f38ac2a6
4 changed files with 19 additions and 6 deletions

View File

@@ -82,6 +82,15 @@ public class CommandAI extends AIController{
commandTarget(target, false);
}
//pursue the target for patrol, keeping the current position
if(stance == UnitStance.patrol && target != null && attackTarget == null){
//commanding a target overwrites targetPos, so add it to the queue
if(targetPos != null){
commandQueue.add(targetPos.cpy());
}
commandTarget(target, false);
}
//remove invalid targets
if(commandQueue.any()){
commandQueue.removeAll(e -> e instanceof Healthc h && !h.isValid());