diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 85f9116f6a..88ba318881 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -711,11 +711,13 @@ public class UnitType extends UnlockableContent{ //assume slight range margin float margin = 4f; + boolean skipWeapons = !weapons.contains(w -> !w.useAttackRange); + //set up default range if(range < 0){ range = Float.MAX_VALUE; for(Weapon weapon : weapons){ - if(!weapon.useAttackRange) continue; + if(!weapon.useAttackRange && skipWeapons) continue; range = Math.min(range, weapon.range() - margin); maxRange = Math.max(maxRange, weapon.range() - margin); @@ -726,7 +728,7 @@ public class UnitType extends UnlockableContent{ maxRange = Math.max(0f, range); for(Weapon weapon : weapons){ - if(!weapon.useAttackRange) continue; + if(!weapon.useAttackRange && skipWeapons) continue; maxRange = Math.max(maxRange, weapon.range() - margin); }