* Fix #6949 * No point in calculating if it already does no damage Also don't show damage stat if it deals no damage. Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -16,7 +16,7 @@ import mindustry.graphics.*;
|
|||||||
import mindustry.logic.*;
|
import mindustry.logic.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.defense.turrets.Turret.*;
|
import mindustry.world.blocks.defense.turrets.BaseTurret.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
@@ -277,7 +277,7 @@ public class RtsAI{
|
|||||||
float extraRadius = 50f;
|
float extraRadius = 50f;
|
||||||
|
|
||||||
for(var turret : Vars.indexer.getEnemy(data.team, BlockFlag.turret)){
|
for(var turret : Vars.indexer.getEnemy(data.team, BlockFlag.turret)){
|
||||||
if(turret instanceof TurretBuild t && Intersector.distanceSegmentPoint(fromX, fromY, x, y, t.x, t.y) <= t.range() + extraRadius){
|
if(turret instanceof BaseTurretBuild t && Intersector.distanceSegmentPoint(fromX, fromY, x, y, t.x, t.y) <= t.range() + extraRadius){
|
||||||
health[0] += t.health;
|
health[0] += t.health;
|
||||||
dps[0] += t.estimateDps();
|
dps[0] += t.estimateDps();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,5 +83,9 @@ public class BaseTurret extends Block{
|
|||||||
public void drawSelect(){
|
public void drawSelect(){
|
||||||
Drawf.dashCircle(x, y, range(), team.color);
|
Drawf.dashCircle(x, y, range(), team.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float estimateDps(){
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class TractorBeamTurret extends BaseTurret{
|
|||||||
|
|
||||||
stats.add(Stat.targetsAir, targetAir);
|
stats.add(Stat.targetsAir, targetAir);
|
||||||
stats.add(Stat.targetsGround, targetGround);
|
stats.add(Stat.targetsGround, targetGround);
|
||||||
stats.add(Stat.damage, damage * 60f, StatUnit.perSecond);
|
if(damage > 0) stats.add(Stat.damage, damage * 60f, StatUnit.perSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,6 +137,12 @@ public class TractorBeamTurret extends BaseTurret{
|
|||||||
return super.shouldConsume() && target != null;
|
return super.shouldConsume() && target != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float estimateDps(){
|
||||||
|
if(!any || damage <= 0) return 0f;
|
||||||
|
return damage * 60f * efficiency * coolantMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.rect(baseRegion, x, y);
|
Draw.rect(baseRegion, x, y);
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ public class Turret extends ReloadTurret{
|
|||||||
public float heatReq;
|
public float heatReq;
|
||||||
public float[] sideHeat = new float[4];
|
public float[] sideHeat = new float[4];
|
||||||
|
|
||||||
|
@Override
|
||||||
public float estimateDps(){
|
public float estimateDps(){
|
||||||
if(!hasAmmo()) return 0f;
|
if(!hasAmmo()) return 0f;
|
||||||
return shoot.shots / reload * 60f * (peekAmmo() == null ? 0f : peekAmmo().estimateDPS()) * potentialEfficiency * timeScale;
|
return shoot.shots / reload * 60f * (peekAmmo() == null ? 0f : peekAmmo().estimateDPS()) * potentialEfficiency * timeScale;
|
||||||
|
|||||||
Reference in New Issue
Block a user