Fix randomWaveAI causing units to target untargetable blocks (#10870)
* Update Pathfinder.java * Update FlyingAI.java
This commit is contained in:
@@ -540,7 +540,7 @@ public class Pathfinder implements Runnable{
|
|||||||
if(!targets.isEmpty()){
|
if(!targets.isEmpty()){
|
||||||
boolean any = false;
|
boolean any = false;
|
||||||
for(Building other : targets){
|
for(Building other : targets){
|
||||||
if((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput){
|
if(((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput) && other.block.targetable){
|
||||||
out.add(other.tile.array());
|
out.add(other.tile.array());
|
||||||
any = true;
|
any = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class FlyingAI extends AIController{
|
|||||||
Building closest = null;
|
Building closest = null;
|
||||||
float cdist = 0f;
|
float cdist = 0f;
|
||||||
for(Building t : list){
|
for(Building t : list){
|
||||||
if((t.items != null && t.items.any()) || t.status() != BlockStatus.noInput){
|
if(((t.items != null && t.items.any()) || t.status() != BlockStatus.noInput) && t.block.targetable){
|
||||||
float dst = t.dst2(x, y);
|
float dst = t.dst2(x, y);
|
||||||
if(closest == null || dst < cdist){
|
if(closest == null || dst < cdist){
|
||||||
closest = t;
|
closest = t;
|
||||||
|
|||||||
Reference in New Issue
Block a user