Breach turret done / DrawTurret & reload fixes
This commit is contained in:
@@ -2767,7 +2767,7 @@ public class Blocks{
|
||||
consumes.add(new ConsumeCoolant(0.5f)).update(false);
|
||||
}};
|
||||
|
||||
//TODO tungsten?
|
||||
//TODO tungsten support?
|
||||
breach = new ItemTurret("breach"){{
|
||||
requirements(Category.turret, with(Items.beryllium, 35, Items.silicon, 20), true);
|
||||
ammo(
|
||||
@@ -2783,7 +2783,21 @@ public class Blocks{
|
||||
frontColor = Color.white;
|
||||
trailWidth = 1.5f;
|
||||
trailLength = 10;
|
||||
//TODO different effect?
|
||||
hitEffect = despawnEffect = Fx.hitBulletColor;
|
||||
}},
|
||||
Items.tungsten, new BasicBulletType(6.6f, 46){{
|
||||
width = 9f;
|
||||
height = 14f;
|
||||
shootEffect = Fx.tungstenSpark;
|
||||
smokeEffect = Fx.shootBigSmoke;
|
||||
ammoMultiplier = 1;
|
||||
reloadMultiplier = 1.4f;
|
||||
pierce = true;
|
||||
pierceBuilding = true;
|
||||
hitColor = backColor = trailColor = Pal.tungstenShot;
|
||||
frontColor = Color.white;
|
||||
trailWidth = 1.6f;
|
||||
trailLength = 10;
|
||||
hitEffect = despawnEffect = Fx.hitBulletColor;
|
||||
}}
|
||||
);
|
||||
|
||||
@@ -1392,6 +1392,16 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
//TODO just make it properly colored...
|
||||
tungstenSpark = new Effect(23f, e -> {
|
||||
color(Color.white, Pal.tungstenShot, e.fin());
|
||||
stroke(e.fout() * 1.1f + 0.5f);
|
||||
|
||||
randLenVectors(e.id, 5, 28f * e.fin(), e.rotation, 10f, (x, y) -> {
|
||||
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 5f + 0.5f);
|
||||
});
|
||||
}),
|
||||
|
||||
shootPayloadDriver = new Effect(30f, e -> {
|
||||
color(Pal.accent);
|
||||
Lines.stroke(0.5f + 0.5f*e.fout());
|
||||
|
||||
@@ -117,6 +117,7 @@ public class Pal{
|
||||
logicUnits = Color.valueOf("c7b59d"),
|
||||
|
||||
berylShot = Color.valueOf("b1dd7e"),
|
||||
tungstenShot = Color.valueOf("768a9a"),
|
||||
|
||||
plasticBurn = Color.valueOf("e9ead3"),
|
||||
|
||||
|
||||
@@ -95,13 +95,18 @@ public class ContinuousTurret extends Turret{
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReload(){
|
||||
//continuous turrets don't have a concept of reload, they are always firing when possible
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateShooting(){
|
||||
if(bullet != null){
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && (consValid() || cheating()) && !charging){
|
||||
if((consValid() || cheating()) && !charging){
|
||||
BulletType type = peekAmmo();
|
||||
shoot(type);
|
||||
}
|
||||
|
||||
@@ -90,6 +90,11 @@ public class LaserTurret extends PowerTurret{
|
||||
return 1f - Mathf.clamp(reload / reloadTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReload(){
|
||||
//updated in updateTile() depending on coolant
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateShooting(){
|
||||
if(bulletLife > 0 && bullet != null){
|
||||
|
||||
@@ -27,6 +27,13 @@ public class ReloadTurret extends BaseTurret{
|
||||
public class ReloadTurretBuild extends BaseTurretBuild{
|
||||
public float reload;
|
||||
|
||||
@Override
|
||||
public void created(){
|
||||
super.created();
|
||||
//for visual reasons, the turret does not need reloading when placed
|
||||
reload = reloadTime;
|
||||
}
|
||||
|
||||
protected void updateCooling(){
|
||||
if(reload < reloadTime){
|
||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||
|
||||
@@ -309,6 +309,9 @@ public class Turret extends ReloadTurret{
|
||||
logicControlTime -= Time.delta;
|
||||
}
|
||||
|
||||
//turret always reloads regardless of whether it's targeting something
|
||||
updateReload();
|
||||
|
||||
if(hasAmmo()){
|
||||
if(Float.isNaN(reload)) rotation = 0;
|
||||
|
||||
@@ -412,8 +415,15 @@ public class Turret extends ReloadTurret{
|
||||
return ammo.size > 0 && ammo.peek().amount >= ammoPerShot;
|
||||
}
|
||||
|
||||
protected void updateReload(){
|
||||
float multiplier = hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
|
||||
reload += delta() * multiplier * baseReloadSpeed();
|
||||
|
||||
//cap reload for visual reasons
|
||||
reload = Math.min(reload, reloadTime);
|
||||
}
|
||||
|
||||
protected void updateShooting(){
|
||||
reload += delta() * peekAmmo().reloadMultiplier * baseReloadSpeed();
|
||||
|
||||
if(reload >= reloadTime && !charging){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
@@ -131,6 +131,9 @@ public class DrawTurret extends DrawBlock{
|
||||
public boolean outline = true;
|
||||
/** If true, the layer is overridden to be under the turret itself. */
|
||||
public boolean under = false;
|
||||
/** If true, progress is inverted. */
|
||||
public boolean invert = false;
|
||||
public Interp interp = Interp.linear;
|
||||
public float layer = -1;
|
||||
public float outlineLayerOffset = -0.01f;
|
||||
public float rotation, rotMove;
|
||||
@@ -154,10 +157,12 @@ public class DrawTurret extends DrawBlock{
|
||||
}
|
||||
float prevZ = layer > 0 ? layer : z;
|
||||
|
||||
float progress = useReload ? build.progress() : build.warmup();
|
||||
if(oscMag > 0){
|
||||
progress += oscAbs ? Mathf.absin(oscScl, oscMag) : Mathf.sin(oscScl, oscMag);
|
||||
}
|
||||
float progress = useReload ? 1f - build.progress() : build.warmup();
|
||||
|
||||
if(oscMag > 0) progress += oscAbs ? Mathf.absin(oscScl, oscMag) : Mathf.sin(oscScl, oscMag);
|
||||
if(invert) progress = 1f - progress;
|
||||
|
||||
progress = interp.apply(progress);
|
||||
|
||||
for(int i = 0; i < regions.length; i++){
|
||||
var region = regions[i];
|
||||
|
||||
Reference in New Issue
Block a user