From 7b759d41df2954fcdb0316f3ca3fb4b3851d9784 Mon Sep 17 00:00:00 2001 From: BalaM314 <71201189+BalaM314@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:10:47 +0530 Subject: [PATCH] Disable leg damage on disarmed units (#9755) * Disable leg damage on disarmed units * import * Disable crush damage from disarmed units --- core/src/mindustry/entities/comp/LegsComp.java | 3 ++- core/src/mindustry/entities/comp/TankComp.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/comp/LegsComp.java b/core/src/mindustry/entities/comp/LegsComp.java index 34b3cc3506..32ddc9b09f 100644 --- a/core/src/mindustry/entities/comp/LegsComp.java +++ b/core/src/mindustry/entities/comp/LegsComp.java @@ -24,6 +24,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ @Import float x, y, rotation, speedMultiplier; @Import UnitType type; @Import Team team; + @Import boolean disarmed; transient Leg[] legs = {}; transient float totalLength; @@ -191,7 +192,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ } } - if(type.legSplashDamage > 0){ + if(type.legSplashDamage > 0 && !disarmed){ Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true); } } diff --git a/core/src/mindustry/entities/comp/TankComp.java b/core/src/mindustry/entities/comp/TankComp.java index 986a17cb56..afd4076ff5 100644 --- a/core/src/mindustry/entities/comp/TankComp.java +++ b/core/src/mindustry/entities/comp/TankComp.java @@ -18,7 +18,7 @@ import static mindustry.Vars.*; @Component abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec{ @Import float x, y, hitSize, rotation, speedMultiplier; - @Import boolean hovering; + @Import boolean hovering, disarmed; @Import UnitType type; @Import Team team; @@ -62,7 +62,7 @@ abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec } //TODO should this apply to the player team(s)? currently PvE due to balancing - if(type.crushDamage > 0 && (walked || deltaLen() >= 0.01f) && t != null && t.build != null && t.build.team != team + if(type.crushDamage > 0 && !disarmed && (walked || deltaLen() >= 0.01f) && t != null && t.build != null && t.build.team != team //damage radius is 1 tile smaller to prevent it from just touching walls as it passes && Math.max(Math.abs(dx), Math.abs(dy)) <= r - 1){