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

View File

@@ -1329,7 +1329,7 @@ public class Blocks implements ContentList{
//endregion
//region turrets
duo = new DoubleTurret("duo"){{
duo = new ItemTurret("duo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 35), true);
ammo(
Items.copper, Bullets.standardCopper,
@@ -1337,6 +1337,10 @@ public class Blocks implements ContentList{
Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming
);
spread = 4f;
shots = 2;
alternate = true;
reloadTime = 20f;
restitution = 0.03f;
range = 100;
@@ -1605,7 +1609,7 @@ public class Blocks implements ContentList{
health = 145 * size * size;
}};
spectre = new DoubleTurret("spectre"){{
spectre = new ItemTurret("spectre"){{
requirements(Category.turret, ItemStack.with(Items.copper, 350, Items.graphite, 300, Items.surgealloy, 250, Items.plastanium, 175, Items.thorium, 250));
ammo(
Items.graphite, Bullets.standardDenseBig,
@@ -1619,8 +1623,8 @@ public class Blocks implements ContentList{
range = 200f;
inaccuracy = 3f;
recoilAmount = 3f;
xRand = 3f;
shotWidth = 4f;
spread = 8f;
alternate = true;
shootShake = 2f;
shots = 2;
size = 4;

View File

@@ -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();
}
}
}

View File

@@ -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();
}