Fix units that can't be hit being hit by some things. (#7391)

* Hittable check in checkTarget

* Remove hittable() and checkTarget() overlap

* Make PointBulletType abide collision types

There should probably be a thing for jsonable `buildingFilter`s, in the case that you want something that doesn't target blocks.

* PointBulletTypes should not be reflectable

* oop

* Use targettable instead of hittable

* targetable check for Damage#linecast

* targetable check for defenderAI

* I shot, and then I hit something, but it was some invisible thing in the way, so I guess I missed
This commit is contained in:
MEEPofFaith
2022-08-19 19:05:11 -07:00
committed by GitHub
parent b9e633a10e
commit 6ca54d4f6a
5 changed files with 8 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ public class DefenderAI extends AIController{
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
//Sort by max health and closer target.
var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f);
var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type && u.targetable(unit.team), (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f);
if(result != null) return result;
//return core if found