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
+8 -4
View File
@@ -1329,7 +1329,7 @@ public class Blocks implements ContentList{
//endregion //endregion
//region turrets //region turrets
duo = new DoubleTurret("duo"){{ duo = new ItemTurret("duo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 35), true); requirements(Category.turret, ItemStack.with(Items.copper, 35), true);
ammo( ammo(
Items.copper, Bullets.standardCopper, Items.copper, Bullets.standardCopper,
@@ -1337,6 +1337,10 @@ public class Blocks implements ContentList{
Items.pyratite, Bullets.standardIncendiary, Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming Items.silicon, Bullets.standardHoming
); );
spread = 4f;
shots = 2;
alternate = true;
reloadTime = 20f; reloadTime = 20f;
restitution = 0.03f; restitution = 0.03f;
range = 100; range = 100;
@@ -1605,7 +1609,7 @@ public class Blocks implements ContentList{
health = 145 * size * size; 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)); requirements(Category.turret, ItemStack.with(Items.copper, 350, Items.graphite, 300, Items.surgealloy, 250, Items.plastanium, 175, Items.thorium, 250));
ammo( ammo(
Items.graphite, Bullets.standardDenseBig, Items.graphite, Bullets.standardDenseBig,
@@ -1619,8 +1623,8 @@ public class Blocks implements ContentList{
range = 200f; range = 200f;
inaccuracy = 3f; inaccuracy = 3f;
recoilAmount = 3f; recoilAmount = 3f;
xRand = 3f; spread = 8f;
shotWidth = 4f; alternate = true;
shootShake = 2f; shootShake = 2f;
shots = 2; shots = 2;
size = 4; size = 4;
@@ -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 shootCone = 8f;
public float shootShake = 0f; public float shootShake = 0f;
public float xRand = 0f; public float xRand = 0f;
public boolean alternate = false;
public boolean targetAir = true; public boolean targetAir = true;
public boolean targetGround = true; public boolean targetGround = true;
@@ -122,7 +123,7 @@ public abstract class Turret extends Block{
public float rotation = 90; public float rotation = 90;
public float recoil = 0f; public float recoil = 0f;
public float heat; public float heat;
public int shotCount; public int shotCounter;
public Posc target; public Posc target;
@Override @Override
@@ -251,12 +252,22 @@ public abstract class Turret extends Block{
recoil = recoilAmount; recoil = recoilAmount;
heat = 1f; 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++){ tr.trns(rotation - 90, spread * i + Mathf.range(xRand), size * tilesize / 2);
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2f) * spread); 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(); effects();
useAmmo(); useAmmo();
} }