From 11e3f85242de597c03b3c969026f960b409506ff Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sun, 21 Aug 2022 14:09:47 -0700 Subject: [PATCH] Fix more things that hit non-hittable units (#7408) * hittable check for EMP * hittable check for Damage#status * why push if don't get hit --- core/src/mindustry/entities/Damage.java | 2 +- core/src/mindustry/entities/bullet/EmpBulletType.java | 2 +- core/src/mindustry/entities/comp/UnitComp.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index 563d9048b8..705b9d26c7 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -440,7 +440,7 @@ public class Damage{ /** Applies a status effect to all enemy units in a range. */ public static void status(Team team, float x, float y, float radius, StatusEffect effect, float duration, boolean air, boolean ground){ Cons cons = entity -> { - if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){ + if(entity.team == team || !entity.checkTarget(air, ground) || !entity.hittable() || !entity.within(x, y, radius)){ return; } diff --git a/core/src/mindustry/entities/bullet/EmpBulletType.java b/core/src/mindustry/entities/bullet/EmpBulletType.java index 8f793c4e50..6306d81b7a 100644 --- a/core/src/mindustry/entities/bullet/EmpBulletType.java +++ b/core/src/mindustry/entities/bullet/EmpBulletType.java @@ -48,7 +48,7 @@ public class EmpBulletType extends BasicBulletType{ if(hitUnits){ Units.nearbyEnemies(b.team, x, y, radius, other -> { - if(other.team != b.team){ + if(other.team != b.team && other.hittable()){ var absorber = Damage.findAbsorber(b.team, x, y, other.x, other.y); if(absorber != null){ return; diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 43fa80e2c7..0009e06ca7 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -470,7 +470,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f) * dragMultiplier * state.rules.dragMultiplier; //apply knockback based on spawns - if(team != state.rules.waveTeam && state.hasSpawns() && (!net.client() || isLocal())){ + if(team != state.rules.waveTeam && state.hasSpawns() && (!net.client() || isLocal()) && hittable()){ float relativeSize = state.rules.dropZoneRadius + hitSize/2f + 1f; for(Tile spawn : spawner.getSpawns()){ if(within(spawn.worldx(), spawn.worldy(), relativeSize)){