Laser turret behavior changes
This commit is contained in:
@@ -120,7 +120,6 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||||||
drag(type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f));
|
drag(type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f));
|
||||||
|
|
||||||
//apply knockback based on spawns
|
//apply knockback based on spawns
|
||||||
//TODO move elsewhere
|
|
||||||
if(team() != state.rules.waveTeam){
|
if(team() != state.rules.waveTeam){
|
||||||
float relativeSize = state.rules.dropZoneRadius + bounds()/2f + 1f;
|
float relativeSize = state.rules.dropZoneRadius + bounds()/2f + 1f;
|
||||||
for(Tile spawn : spawner.getSpawns()){
|
for(Tile spawn : spawner.getSpawns()){
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ public class LaserTurret extends PowerTurret{
|
|||||||
coolantMultiplier = 1f;
|
coolantMultiplier = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
consumes.powerCond(powerUse, entity -> ((LaserTurretEntity)entity).bullet != null || ((LaserTurretEntity)entity).target != null);
|
||||||
|
super.init();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
@@ -49,7 +55,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
bullet.time(0f);
|
bullet.time(0f);
|
||||||
heat = 1f;
|
heat = 1f;
|
||||||
recoil = recoilAmount;
|
recoil = recoilAmount;
|
||||||
bulletLife -= Time.delta();
|
bulletLife -= Time.delta() / Math.max(efficiency(), 0.00001f);
|
||||||
if(bulletLife <= 0f){
|
if(bulletLife <= 0f){
|
||||||
bullet = null;
|
bullet = null;
|
||||||
}
|
}
|
||||||
@@ -62,19 +68,19 @@ public class LaserTurret extends PowerTurret{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reload >= reloadTime && (consValid() || tile.isEnemyCheat())){
|
if(reload <= 0 && (consValid() || tile.isEnemyCheat())){
|
||||||
BulletType type = peekAmmo();
|
BulletType type = peekAmmo();
|
||||||
|
|
||||||
shoot(type);
|
shoot(type);
|
||||||
|
|
||||||
reload = 0f;
|
reload = reloadTime;
|
||||||
}else{
|
}else{
|
||||||
Liquid liquid = liquids().current();
|
Liquid liquid = liquids().current();
|
||||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||||
|
|
||||||
float used = baseReloadSpeed() * (tile.isEnemyCheat() ? maxUsed : Math.min(liquids().get(liquid), maxUsed * Time.delta())) * liquid.heatCapacity * coolantMultiplier;
|
float used = (tile.isEnemyCheat() ? maxUsed * Time.delta() : Math.min(liquids.get(liquid), maxUsed * Time.delta())) * liquid.heatCapacity * coolantMultiplier;
|
||||||
reload += used;
|
reload -= used;
|
||||||
liquids().remove(liquid, used);
|
liquids.remove(liquid, used);
|
||||||
|
|
||||||
if(Mathf.chance(0.06 * used)){
|
if(Mathf.chance(0.06 * used)){
|
||||||
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
||||||
@@ -84,7 +90,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void turnToTarget(float targetRot){
|
protected void turnToTarget(float targetRot){
|
||||||
rotation = Angles.moveToward(rotation, targetRot, rotatespeed * delta() * (bulletLife > 0f ? firingMoveFract : 1f));
|
rotation = Angles.moveToward(rotation, targetRot, efficiency() * rotatespeed * delta() * (bulletLife > 0f ? firingMoveFract : 1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user