Latum mostly done
This commit is contained in:
@@ -26,7 +26,7 @@ public class LaserTurret extends PowerTurret{
|
||||
super.setStats();
|
||||
|
||||
stats.remove(Stat.booster);
|
||||
stats.add(Stat.input, StatValues.boosters(reloadTime, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
stats.add(Stat.input, StatValues.boosters(reload, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
}
|
||||
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
@@ -66,13 +66,13 @@ public class LaserTurret extends PowerTurret{
|
||||
wasShooting = true;
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
}else if(reload > 0){
|
||||
}else if(reloadCounter > 0){
|
||||
wasShooting = true;
|
||||
//TODO does not handle multi liquid req?
|
||||
Liquid liquid = liquids.current();
|
||||
float maxUsed = coolant.amount;
|
||||
float used = (cheating() ? maxUsed : Math.min(liquids.get(liquid), maxUsed)) * delta();
|
||||
reload -= used * liquid.heatCapacity * coolantMultiplier;
|
||||
reloadCounter -= used * liquid.heatCapacity * coolantMultiplier;
|
||||
liquids.remove(liquid, used);
|
||||
|
||||
if(Mathf.chance(0.06 * used)){
|
||||
@@ -83,7 +83,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return 1f - Mathf.clamp(reload / reloadTime);
|
||||
return 1f - Mathf.clamp(reloadCounter / reload);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,12 +97,12 @@ public class LaserTurret extends PowerTurret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && efficiency > 0 && !charging() && shootWarmup >= minWarmup){
|
||||
if(reloadCounter <= 0 && efficiency > 0 && !charging() && shootWarmup >= minWarmup){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
reload = reloadTime;
|
||||
reloadCounter = reload;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
super(name);
|
||||
|
||||
rotateSpeed = 20f;
|
||||
reloadTime = 30f;
|
||||
reload = 30f;
|
||||
|
||||
coolantMultiplier = 2f;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.reload, 60f / reloadTime, StatUnit.perSecond);
|
||||
stats.add(Stat.reload, 60f / reload, StatUnit.perSecond);
|
||||
}
|
||||
|
||||
public class PointDefenseBuild extends ReloadTurretBuild{
|
||||
@@ -76,10 +76,10 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
if(target != null && target.within(this, range) && target.team != team && target.type() != null && target.type().hittable){
|
||||
float dest = angleTo(target);
|
||||
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
|
||||
reload += edelta();
|
||||
reloadCounter += edelta();
|
||||
|
||||
//shoot when possible
|
||||
if(Angles.within(rotation, dest, shootCone) && reload >= reloadTime){
|
||||
if(Angles.within(rotation, dest, shootCone) && reloadCounter >= reload){
|
||||
if(target.damage() > bulletDamage){
|
||||
target.damage(target.damage() - bulletDamage);
|
||||
}else{
|
||||
@@ -92,7 +92,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
shootEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, color);
|
||||
hitEffect.at(target.x, target.y, color);
|
||||
shootSound.at(x + Tmp.v1.x, y + Tmp.v1.y, Mathf.random(0.9f, 1.1f));
|
||||
reload = 0;
|
||||
reloadCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ReloadTurret extends BaseTurret{
|
||||
public float reloadTime = 10f;
|
||||
public float reload = 10f;
|
||||
|
||||
public ReloadTurret(String name){
|
||||
super(name);
|
||||
@@ -18,25 +18,25 @@ public class ReloadTurret extends BaseTurret{
|
||||
super.setStats();
|
||||
|
||||
if(coolant != null){
|
||||
stats.add(Stat.booster, StatValues.boosters(reloadTime, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l)));
|
||||
stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l)));
|
||||
}
|
||||
}
|
||||
|
||||
public class ReloadTurretBuild extends BaseTurretBuild{
|
||||
public float reload;
|
||||
public float reloadCounter;
|
||||
|
||||
@Override
|
||||
public void created(){
|
||||
super.created();
|
||||
//for visual reasons, the turret does not need reloading when placed
|
||||
reload = reloadTime;
|
||||
reloadCounter = reload;
|
||||
}
|
||||
|
||||
protected void updateCooling(){
|
||||
if(reload < reloadTime && coolant != null && coolant.efficiency(this) > 0){
|
||||
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0){
|
||||
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : 1f;
|
||||
coolant.update(this);
|
||||
reload += coolant.amount * edelta() * capacity * coolantMultiplier;
|
||||
reloadCounter += coolant.amount * edelta() * capacity * coolantMultiplier;
|
||||
|
||||
if(Mathf.chance(0.06 * coolant.amount)){
|
||||
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Turret extends ReloadTurret{
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees);
|
||||
stats.add(Stat.reload, 60f / (reloadTime) * shoot.shots, StatUnit.perSecond);
|
||||
stats.add(Stat.reload, 60f / (reload) * shoot.shots, StatUnit.perSecond);
|
||||
stats.add(Stat.targetsAir, targetAir);
|
||||
stats.add(Stat.targetsGround, targetGround);
|
||||
if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot);
|
||||
@@ -180,7 +180,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
public float estimateDps(){
|
||||
if(!hasAmmo()) return 0f;
|
||||
return shoot.shots / reloadTime * 60f * peekAmmo().estimateDPS() * efficiency * timeScale;
|
||||
return shoot.shots / reload * 60f * peekAmmo().estimateDPS() * efficiency * timeScale;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,7 +252,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(reload / reloadTime);
|
||||
return Mathf.clamp(reloadCounter / reload);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
@@ -332,7 +332,7 @@ public class Turret extends ReloadTurret{
|
||||
updateReload();
|
||||
|
||||
if(hasAmmo()){
|
||||
if(Float.isNaN(reload)) reload = 0;
|
||||
if(Float.isNaN(reloadCounter)) reloadCounter = 0;
|
||||
|
||||
if(timer(timerTarget, targetInterval)){
|
||||
findTarget();
|
||||
@@ -451,20 +451,20 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
protected void updateReload(){
|
||||
float multiplier = hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
|
||||
reload += delta() * multiplier * baseReloadSpeed();
|
||||
reloadCounter += delta() * multiplier * baseReloadSpeed();
|
||||
|
||||
//cap reload for visual reasons
|
||||
reload = Math.min(reload, reloadTime);
|
||||
reloadCounter = Math.min(reloadCounter, reload);
|
||||
}
|
||||
|
||||
protected void updateShooting(){
|
||||
|
||||
if(reload >= reloadTime && !charging() && shootWarmup >= minWarmup){
|
||||
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
reload %= reloadTime;
|
||||
reloadCounter %= reload;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ public class Turret extends ReloadTurret{
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.f(reload);
|
||||
write.f(reloadCounter);
|
||||
write.f(rotation);
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ public class Turret extends ReloadTurret{
|
||||
super.read(read, revision);
|
||||
|
||||
if(revision >= 1){
|
||||
reload = read.f();
|
||||
reloadCounter = read.f();
|
||||
rotation = read.f();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user