Sublimate visuals, damage/length still broken
This commit is contained in:
@@ -55,19 +55,19 @@ public class ContinuousTurret extends Turret{
|
||||
super.updateTile();
|
||||
|
||||
if(bullet != null){
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
|
||||
if(isShooting()){
|
||||
bullet.time = 0f;
|
||||
}
|
||||
|
||||
//check to see if bullet despawned
|
||||
if(bullet.owner != this || !bullet.isAdded()){
|
||||
if(bullet.owner != this || !bullet.isAdded() || bullet.type == null){
|
||||
bullet = null;
|
||||
}else{
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
|
||||
if(isShooting()){
|
||||
bullet.time = bullet.lifetime * bullet.type.optimalLifeFract * shootWarmup;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.consumers.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
/** A turret that fires a continuous beam with a delay between shots. Liquid coolant is required. */
|
||||
/** A turret that fires a continuous beam with a delay between shots. Liquid coolant is required. Yes, this class name is awful. */
|
||||
public class LaserTurret extends PowerTurret{
|
||||
public float firingMoveFract = 0.25f;
|
||||
public float shootDuration = 100f;
|
||||
@@ -56,11 +55,15 @@ public class LaserTurret extends PowerTurret{
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
|
||||
if(!bullet.isAdded() || bullet.type == null){
|
||||
bullet = null;
|
||||
}
|
||||
|
||||
if(bulletLife > 0 && bullet != null){
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
bullet.time = 0f;
|
||||
bullet.time = bullet.type.lifetime * bullet.type.optimalLifeFract;
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
bulletLife -= Time.delta / Math.max(efficiency(), 0.00001f);
|
||||
@@ -83,10 +86,8 @@ public class LaserTurret extends PowerTurret{
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
//reload reversed for laser turrets
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reload / reloadTime);
|
||||
return super.sense(sensor);
|
||||
public float progress(){
|
||||
return 1f - Mathf.clamp(reload / reloadTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Turret extends ReloadTurret{
|
||||
public float ammoEjectBack = 1f;
|
||||
public float inaccuracy = 0f;
|
||||
public float velocityInaccuracy = 0f;
|
||||
public float shootWarmupSpeed = 3f / 60f;
|
||||
public float shootWarmupSpeed = 0.1f;
|
||||
public int shots = 1;
|
||||
public float spread = 4f;
|
||||
public float recoilAmount = 1f;
|
||||
@@ -152,7 +152,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
draw.getRegionsToOutline(out);
|
||||
draw.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public static abstract class AmmoEntry{
|
||||
@@ -233,11 +233,16 @@ public class Turret extends ReloadTurret{
|
||||
case shootX -> World.conv(targetPos.x);
|
||||
case shootY -> World.conv(targetPos.y);
|
||||
case shooting -> isShooting() ? 1 : 0;
|
||||
case progress -> Mathf.clamp(reload / reloadTime);
|
||||
case progress -> progress();
|
||||
default -> super.sense(sensor);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(reload / reloadTime);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
return (isControlled() ? unit.isShooting() : logicControlled() ? logicShooting : target != null);
|
||||
}
|
||||
@@ -286,7 +291,7 @@ public class Turret extends ReloadTurret{
|
||||
if(!validateTarget()) target = null;
|
||||
|
||||
//TODO can be lerp instead, that's smoother
|
||||
shootWarmup = Mathf.approachDelta(shootWarmup, isActive() ? 1f : 0f, shootWarmupSpeed);
|
||||
shootWarmup = Mathf.lerpDelta(shootWarmup, isShooting() ? 1f : 0f, shootWarmupSpeed);
|
||||
|
||||
wasShooting = false;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
drawer.getRegionsToOutline(out);
|
||||
drawer.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public class GenericCrafterBuild extends Building{
|
||||
@@ -254,12 +254,17 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(progress);
|
||||
if(sensor == LAccess.progress) return progress();
|
||||
//attempt to prevent wild total liquid fluctuation, at least for crafters
|
||||
if(sensor == LAccess.totalLiquids && outputLiquid != null) return liquids.get(outputLiquid.liquid);
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Item item){
|
||||
return itemCapacity;
|
||||
|
||||
Reference in New Issue
Block a user