Removed DoubleTurret, merged functionality

This commit is contained in:
Anuken
2020-03-17 11:02:10 -04:00
parent 2c7ff64511
commit 08488857da
3 changed files with 23 additions and 48 deletions
@@ -1,40 +0,0 @@
package mindustry.world.blocks.defense.turrets;
import arc.math.*;
import mindustry.entities.bullet.*;
import mindustry.world.meta.*;
import static mindustry.Vars.tilesize;
public class DoubleTurret extends ItemTurret{
public float shotWidth = 2f;
public DoubleTurret(String name){
super(name);
shots = 2;
}
@Override
public void setStats(){
super.setStats();
stats.remove(BlockStat.reload);
stats.add(BlockStat.reload, 60f / reloadTime, StatUnit.none);
}
public class DoubleTurretEntity extends ItemTurretEntity{
@Override
protected void shoot(BulletType ammo){
shotCount++;
heat = 1f;
int i = Mathf.signs[shotCount % 2];
tr.trns(rotation - 90, shotWidth * i, size * tilesize / 2);
bullet(ammo, rotation + Mathf.range(inaccuracy));
effects();
useAmmo();
}
}
}
@@ -44,6 +44,7 @@ public abstract class Turret extends Block{
public float shootCone = 8f;
public float shootShake = 0f;
public float xRand = 0f;
public boolean alternate = false;
public boolean targetAir = true;
public boolean targetGround = true;
@@ -122,7 +123,7 @@ public abstract class Turret extends Block{
public float rotation = 90;
public float recoil = 0f;
public float heat;
public int shotCount;
public int shotCounter;
public Posc target;
@Override
@@ -251,12 +252,22 @@ public abstract class Turret extends Block{
recoil = recoilAmount;
heat = 1f;
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
if(alternate){
float i = (shotCounter % shots) - shots/2f + (((shots+1)%2) / 2f);
Log.info(i);
for(int i = 0; i < shots; i++){
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2f) * spread);
tr.trns(rotation - 90, spread * i + Mathf.range(xRand), size * tilesize / 2);
bullet(type, rotation + Mathf.range(inaccuracy));
}else{
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
for(int i = 0; i < shots; i++){
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2f) * spread);
}
}
shotCounter++;
effects();
useAmmo();
}