diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 76b1364afa..c242913966 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2177,6 +2177,7 @@ public class UnitTypes{ buildSpeed = 3f; rotateToBuilding = false; + range = maxRange = 180f; abilities.add(new EnergyFieldAbility(40f, 65f, 180f){{ statusDuration = 60f * 6f; diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index f6a463c41a..ebe4b35ff0 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -904,13 +904,11 @@ public class UnitType extends UnlockableContent implements Senseable{ //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 && skipWeapons) continue; + if(!weapon.useAttackRange) continue; range = Math.min(range, weapon.range() - margin); maxRange = Math.max(maxRange, weapon.range() - margin); @@ -921,7 +919,7 @@ public class UnitType extends UnlockableContent implements Senseable{ maxRange = Math.max(0f, range); for(Weapon weapon : weapons){ - if(!weapon.useAttackRange && skipWeapons) continue; + if(!weapon.useAttackRange) continue; maxRange = Math.max(maxRange, weapon.range() - margin); } @@ -932,8 +930,9 @@ public class UnitType extends UnlockableContent implements Senseable{ fogRadius = Math.max(58f * 3f, hitSize * 2f) / 8f; } - if(weapons.isEmpty()){ - range = maxRange = mineRange; + if(!weapons.contains(w -> w.useAttackRange)){ + if(range < 0 || range == Float.MAX_VALUE) range = mineRange; + if(maxRange < 0 || maxRange == Float.MAX_VALUE) maxRange = mineRange; } if(mechStride < 0){