Breach turret done / DrawTurret & reload fixes

This commit is contained in:
Anuken
2021-12-03 12:28:13 -05:00
parent 9c9d147b95
commit 61bb4d2dac
11 changed files with 65 additions and 8 deletions

View File

@@ -95,13 +95,18 @@ public class ContinuousTurret extends Turret{
return super.sense(sensor);
}
@Override
protected void updateReload(){
//continuous turrets don't have a concept of reload, they are always firing when possible
}
@Override
protected void updateShooting(){
if(bullet != null){
return;
}
if(reload <= 0 && (consValid() || cheating()) && !charging){
if((consValid() || cheating()) && !charging){
BulletType type = peekAmmo();
shoot(type);
}

View File

@@ -90,6 +90,11 @@ public class LaserTurret extends PowerTurret{
return 1f - Mathf.clamp(reload / reloadTime);
}
@Override
protected void updateReload(){
//updated in updateTile() depending on coolant
}
@Override
protected void updateShooting(){
if(bulletLife > 0 && bullet != null){

View File

@@ -27,6 +27,13 @@ public class ReloadTurret extends BaseTurret{
public class ReloadTurretBuild extends BaseTurretBuild{
public float reload;
@Override
public void created(){
super.created();
//for visual reasons, the turret does not need reloading when placed
reload = reloadTime;
}
protected void updateCooling(){
if(reload < reloadTime){
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;

View File

@@ -309,6 +309,9 @@ public class Turret extends ReloadTurret{
logicControlTime -= Time.delta;
}
//turret always reloads regardless of whether it's targeting something
updateReload();
if(hasAmmo()){
if(Float.isNaN(reload)) rotation = 0;
@@ -412,8 +415,15 @@ public class Turret extends ReloadTurret{
return ammo.size > 0 && ammo.peek().amount >= ammoPerShot;
}
protected void updateReload(){
float multiplier = hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
reload += delta() * multiplier * baseReloadSpeed();
//cap reload for visual reasons
reload = Math.min(reload, reloadTime);
}
protected void updateShooting(){
reload += delta() * peekAmmo().reloadMultiplier * baseReloadSpeed();
if(reload >= reloadTime && !charging){
BulletType type = peekAmmo();