Turret instant reload fix

This commit is contained in:
Anuken
2022-05-14 23:28:15 -04:00
parent bc65e63654
commit 67344ffd7d
3 changed files with 6 additions and 8 deletions
@@ -25,13 +25,6 @@ public class ReloadTurret extends BaseTurret{
public class ReloadTurretBuild extends BaseTurretBuild{
public float reloadCounter;
@Override
public void created(){
super.created();
//for visual reasons, the turret does not need reloading when placed; however, it should not be *fully* reloaded, so firing will not occur
reloadCounter = reload - 0.0001f;
}
protected void updateCooling(){
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0 && efficiency > 0){
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : 1f;
@@ -200,6 +200,8 @@ public class Turret extends ReloadTurret{
public float curRecoil, heat, logicControlTime = -1;
public float shootWarmup;
public int totalShots;
//turrets need to shoot once for 'visual reload' to be valid, otherwise they seem stuck at reload 0 when placed.
public boolean visualReloadValid;
public boolean logicShooting = false;
public @Nullable Posc target;
public Vec2 targetPos = new Vec2();
@@ -491,6 +493,7 @@ public class Turret extends ReloadTurret{
protected void updateShooting(){
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
visualReloadValid = true;
BulletType type = peekAmmo();
shoot(type);