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:
@@ -374,7 +374,7 @@ public class Damage{
|
||||
tmpUnit = null;
|
||||
|
||||
Units.nearbyEnemies(hitter.team, rect, e -> {
|
||||
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return;
|
||||
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround) || !e.targetable(hitter.team)) return;
|
||||
|
||||
e.hitbox(hitrect);
|
||||
Rect other = hitrect;
|
||||
@@ -468,7 +468,7 @@ public class Damage{
|
||||
/** Damages all entities and blocks in a radius that are enemies of the team. */
|
||||
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground, boolean scaled, Bullet source){
|
||||
Cons<Unit> cons = entity -> {
|
||||
if(entity.team == team || !entity.hittable() || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
|
||||
if(entity.team == team || !entity.checkTarget(air, ground) || !entity.hittable() || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f))){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user