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:
@@ -30,7 +30,7 @@ public class FlakBulletType extends BasicBulletType{
|
||||
if(b.time >= flakDelay && b.fdata >= 0 && b.timer(2, flakInterval)){
|
||||
Units.nearbyEnemies(b.team, Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> {
|
||||
//fdata < 0 means it's primed to explode
|
||||
if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround) || !unit.type.targetable) return;
|
||||
if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround) || !unit.targetable(b.team)) return;
|
||||
|
||||
if(unit.within(b, explodeRange + unit.hitSize/2f)){
|
||||
//mark as primed
|
||||
|
||||
@@ -16,6 +16,7 @@ public class PointBulletType extends BulletType{
|
||||
scaleLife = true;
|
||||
lifetime = 100f;
|
||||
collides = false;
|
||||
reflectable = false;
|
||||
keepVelocity = false;
|
||||
backMove = false;
|
||||
}
|
||||
@@ -42,7 +43,7 @@ public class PointBulletType extends BulletType{
|
||||
float range = 1f;
|
||||
|
||||
Units.nearbyEnemies(b.team, px - range, py - range, range*2f, range*2f, e -> {
|
||||
if(e.dead()) return;
|
||||
if(e.dead() || !e.checkTarget(collidesAir, collidesGround) || !e.hittable()) return;
|
||||
|
||||
e.hitbox(Tmp.r1);
|
||||
if(!Tmp.r1.contains(px, py)) return;
|
||||
@@ -56,7 +57,7 @@ public class PointBulletType extends BulletType{
|
||||
|
||||
if(result != null){
|
||||
b.collision(result, px, py);
|
||||
}else{
|
||||
}else if(collidesTiles){
|
||||
Building build = Vars.world.buildWorld(px, py);
|
||||
if(build != null && build.team != b.team){
|
||||
build.collision(b);
|
||||
|
||||
Reference in New Issue
Block a user