This commit is contained in:
Anuken
2020-11-20 12:53:09 -05:00
parent 1372fc4079
commit 06921b53be
@@ -76,6 +76,8 @@ public class TractorBeamTurret extends BaseTurret{
target = Units.closestEnemy(team, x, y, range, u -> u.checkTarget(targetAir, targetGround)); target = Units.closestEnemy(team, x, y, range, u -> u.checkTarget(targetAir, targetGround));
} }
Log.info(target);
//consume coolant //consume coolant
if(target != null && acceptCoolant){ if(target != null && acceptCoolant){
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount; float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
@@ -93,19 +95,22 @@ public class TractorBeamTurret extends BaseTurret{
coolant = 1f + (used * liquid.heatCapacity * coolantMultiplier); coolant = 1f + (used * liquid.heatCapacity * coolantMultiplier);
} }
any = false;
//look at target //look at target
if(target != null && target.within(this, range) && target.team() != team && target.type.flying && efficiency() > 0.01f){ if(target != null && target.within(this, range) && target.team() != team && target.type.flying && efficiency() > 0.02f){
if(!headless){ if(!headless){
control.sound.loop(shootSound, this, shootSoundVolume); control.sound.loop(shootSound, this, shootSoundVolume);
} }
any = true;
float dest = angleTo(target); float dest = angleTo(target);
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta()); rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
lastX = target.x; lastX = target.x;
lastY = target.y; lastY = target.y;
strength = Mathf.lerpDelta(strength, 1f, 0.1f); strength = Mathf.lerpDelta(strength, 1f, 0.1f);
//shoot when possible
if(Angles.within(rotation, dest, shootCone)){
if(damage > 0){ if(damage > 0){
target.damageContinuous(damage * efficiency()); target.damageContinuous(damage * efficiency());
} }
@@ -114,12 +119,10 @@ public class TractorBeamTurret extends BaseTurret{
target.apply(status, statusDuration); target.apply(status, statusDuration);
} }
//shoot when possible any = true;
if(Angles.within(rotation, dest, shootCone)){
target.impulse(Tmp.v1.set(this).sub(target).limit((force + (1f - target.dst(this) / range) * scaledForce) * efficiency() * timeScale)); target.impulse(Tmp.v1.set(this).sub(target).limit((force + (1f - target.dst(this) / range) * scaledForce) * efficiency() * timeScale));
} }
}else{ }else{
target = null;
strength = Mathf.lerpDelta(strength, 0, 0.1f); strength = Mathf.lerpDelta(strength, 0, 0.1f);
} }
} }