Latum mostly done
This commit is contained in:
@@ -2731,7 +2731,7 @@ public class Blocks{
|
||||
}};
|
||||
|
||||
shootY = 3f;
|
||||
reloadTime = 20f;
|
||||
reload = 20f;
|
||||
restitution = 0.03f;
|
||||
range = 110;
|
||||
shootCone = 15f;
|
||||
@@ -2751,7 +2751,7 @@ public class Blocks{
|
||||
Items.lead, Bullets.flakLead,
|
||||
Items.metaglass, Bullets.flakGlass
|
||||
);
|
||||
reloadTime = 18f;
|
||||
reload = 18f;
|
||||
range = 220f;
|
||||
size = 2;
|
||||
targetGround = false;
|
||||
@@ -2778,7 +2778,7 @@ public class Blocks{
|
||||
Items.pyratite, Bullets.pyraFlame
|
||||
);
|
||||
recoilAmount = 0f;
|
||||
reloadTime = 6f;
|
||||
reload = 6f;
|
||||
coolantMultiplier = 1.5f;
|
||||
range = 60f;
|
||||
shootCone = 50f;
|
||||
@@ -2797,7 +2797,7 @@ public class Blocks{
|
||||
Items.pyratite, Bullets.artilleryIncendiary
|
||||
);
|
||||
targetAir = false;
|
||||
reloadTime = 60f;
|
||||
reload = 60f;
|
||||
recoilAmount = 2f;
|
||||
range = 235f;
|
||||
inaccuracy = 1f;
|
||||
@@ -2818,7 +2818,7 @@ public class Blocks{
|
||||
);
|
||||
size = 2;
|
||||
recoilAmount = 0f;
|
||||
reloadTime = 3f;
|
||||
reload = 3f;
|
||||
inaccuracy = 5f;
|
||||
shootCone = 50f;
|
||||
liquidCapacity = 10f;
|
||||
@@ -2836,7 +2836,7 @@ public class Blocks{
|
||||
shoot.firstShotDelay = 40f;
|
||||
|
||||
recoilAmount = 2f;
|
||||
reloadTime = 80f;
|
||||
reload = 80f;
|
||||
cooldown = 0.03f;
|
||||
shootShake = 2f;
|
||||
shootEffect = Fx.lancerLaserShoot;
|
||||
@@ -2874,7 +2874,7 @@ public class Blocks{
|
||||
collidesAir = false;
|
||||
ammoMultiplier = 1f;
|
||||
}};
|
||||
reloadTime = 35f;
|
||||
reload = 35f;
|
||||
shootCone = 40f;
|
||||
rotateSpeed = 8f;
|
||||
targetAir = false;
|
||||
@@ -2920,7 +2920,7 @@ public class Blocks{
|
||||
}};
|
||||
|
||||
shootY = 7f;
|
||||
reloadTime = 30f;
|
||||
reload = 30f;
|
||||
inaccuracy = 10f;
|
||||
range = 240f;
|
||||
size = 2;
|
||||
@@ -2944,7 +2944,7 @@ public class Blocks{
|
||||
|
||||
size = 2;
|
||||
range = 190f;
|
||||
reloadTime = 31f;
|
||||
reload = 31f;
|
||||
restitution = 0.03f;
|
||||
ammoEjectBack = 3f;
|
||||
cooldown = 0.03f;
|
||||
@@ -2971,7 +2971,7 @@ public class Blocks{
|
||||
size = 2;
|
||||
shootLength = 5f;
|
||||
bulletDamage = 30f;
|
||||
reloadTime = 8f;
|
||||
reload = 8f;
|
||||
envEnabled |= Env.space;
|
||||
}};
|
||||
|
||||
@@ -2984,7 +2984,7 @@ public class Blocks{
|
||||
Liquids.oil, Bullets.heavyOilShot
|
||||
);
|
||||
size = 3;
|
||||
reloadTime = 3f;
|
||||
reload = 3f;
|
||||
shoot.shots = 2;
|
||||
velocityInaccuracy = 0.1f;
|
||||
inaccuracy = 4f;
|
||||
@@ -3001,7 +3001,7 @@ public class Blocks{
|
||||
fuse = new ItemTurret("fuse"){{
|
||||
requirements(Category.turret, with(Items.copper, 225, Items.graphite, 225, Items.thorium, 100));
|
||||
|
||||
reloadTime = 35f;
|
||||
reload = 35f;
|
||||
shootShake = 4f;
|
||||
range = 90f;
|
||||
recoilAmount = 5f;
|
||||
@@ -3054,7 +3054,7 @@ public class Blocks{
|
||||
size = 3;
|
||||
shoot.shots = 4;
|
||||
inaccuracy = 12f;
|
||||
reloadTime = 60f;
|
||||
reload = 60f;
|
||||
ammoEjectBack = 5f;
|
||||
ammoUseEffect = Fx.casing3Double;
|
||||
ammoPerShot = 2;
|
||||
@@ -3087,7 +3087,7 @@ public class Blocks{
|
||||
-3f, 0f, 0f,
|
||||
};
|
||||
}};
|
||||
reloadTime = 8f;
|
||||
reload = 8f;
|
||||
range = 200f;
|
||||
size = 3;
|
||||
recoilAmount = 3f;
|
||||
@@ -3124,7 +3124,7 @@ public class Blocks{
|
||||
maxAmmo = 40;
|
||||
ammoPerShot = 5;
|
||||
rotateSpeed = 2f;
|
||||
reloadTime = 200f;
|
||||
reload = 200f;
|
||||
ammoUseEffect = Fx.casing3Double;
|
||||
recoilAmount = 5f;
|
||||
restitution = 0.009f;
|
||||
@@ -3150,7 +3150,7 @@ public class Blocks{
|
||||
Items.pyratite, Bullets.standardIncendiaryBig,
|
||||
Items.thorium, Bullets.standardThoriumBig
|
||||
);
|
||||
reloadTime = 7f;
|
||||
reload = 7f;
|
||||
coolantMultiplier = 0.5f;
|
||||
restitution = 0.1f;
|
||||
ammoUseEffect = Fx.casing3;
|
||||
@@ -3179,7 +3179,7 @@ public class Blocks{
|
||||
size = 4;
|
||||
shootShake = 2f;
|
||||
range = 195f;
|
||||
reloadTime = 90f;
|
||||
reload = 90f;
|
||||
firingMoveFract = 0.5f;
|
||||
shootDuration = 230f;
|
||||
shootSound = Sounds.laserbig;
|
||||
@@ -3253,7 +3253,7 @@ public class Blocks{
|
||||
outlineColor = Pal.darkOutline;
|
||||
size = 3;
|
||||
envEnabled |= Env.space;
|
||||
reloadTime = 40f;
|
||||
reload = 40f;
|
||||
recoilAmount = 2f;
|
||||
restitution = 0.03f;
|
||||
range = 190;
|
||||
@@ -3380,7 +3380,7 @@ public class Blocks{
|
||||
targetAir = false;
|
||||
shootShake = 4f;
|
||||
recoilAmount = 1f;
|
||||
reloadTime = 60f * 2.3f;
|
||||
reload = 60f * 2.3f;
|
||||
shootY = 7f;
|
||||
rotateSpeed = 1.4f;
|
||||
minWarmup = 0.85f;
|
||||
@@ -3453,7 +3453,7 @@ public class Blocks{
|
||||
}});
|
||||
|
||||
|
||||
reloadTime = 9f;
|
||||
reload = 9f;
|
||||
shootY = 15f;
|
||||
rotateSpeed = 5f;
|
||||
shootCone = 30f;
|
||||
|
||||
@@ -2477,7 +2477,7 @@ public class UnitTypes{
|
||||
treadPullOffset = 5;
|
||||
speed = 0.7f;
|
||||
rotateSpeed = 2.6f;
|
||||
health = 800;
|
||||
health = 2000;
|
||||
armor = 7f;
|
||||
areaDamage = 8f;
|
||||
treadRects = new Rect[]{new Rect(17, 10, 19, 76)};
|
||||
@@ -2778,7 +2778,8 @@ public class UnitTypes{
|
||||
drag = 0.1f;
|
||||
hitSize = 14f;
|
||||
rotateSpeed = 3f;
|
||||
health = 700;
|
||||
health = 1100;
|
||||
armor = 5f;
|
||||
|
||||
legCount = 4;
|
||||
legLength = 14f;
|
||||
@@ -2793,28 +2794,70 @@ public class UnitTypes{
|
||||
|
||||
legMoveSpace = 1f;
|
||||
hovering = true;
|
||||
armor = 5f;
|
||||
|
||||
visualElevation = 0.2f;
|
||||
groundLayer = Layer.legUnit - 1f;
|
||||
|
||||
if(false)
|
||||
weapons.add(new Weapon("eruption"){{
|
||||
top = false;
|
||||
shootY = 3f;
|
||||
reload = 9f;
|
||||
ejectEffect = Fx.none;
|
||||
recoil = 1f;
|
||||
x = 7f;
|
||||
shootSound = Sounds.flame;
|
||||
for(int i = 0; i < 5; i++){
|
||||
int fi = i;
|
||||
parts.add(new RegionPart("-spine"){{
|
||||
y = 21f / 4f - 45f / 4f * fi / 4f;
|
||||
moveX = 21f / 4f + Mathf.slope(fi / 4f) * 1.25f;
|
||||
moveRot = 10f - fi * 14f;
|
||||
float fin = fi / 4f;
|
||||
progress = PartProgress.reload.inv().mul(1.3f).add(0.1f).sustain(fin * 0.34f, 0.14f, 0.14f);
|
||||
layerOffset = -0.001f;
|
||||
mirror = true;
|
||||
}});
|
||||
}
|
||||
|
||||
bullet = new LiquidBulletType(Liquids.slag){{
|
||||
damage = 13;
|
||||
speed = 2.5f;
|
||||
drag = 0.009f;
|
||||
shootEffect = Fx.shootSmall;
|
||||
lifetime = 57f;
|
||||
collidesAir = false;
|
||||
weapons.add(new Weapon("latum-weapon"){{
|
||||
x = 14f / 4f;
|
||||
y = 33f / 4f;
|
||||
reload = 30f;
|
||||
layerOffset = -0.002f;
|
||||
alternate = false;
|
||||
heatColor = Color.red;
|
||||
cooldownTime = 25f;
|
||||
smoothReloadSpeed = 0.15f;
|
||||
recoil = 2f;
|
||||
|
||||
bullet = new BasicBulletType(3.5f, 40){{
|
||||
backColor = trailColor = hitColor = Pal.techBlue;
|
||||
frontColor = Color.white;
|
||||
width = 7.5f;
|
||||
height = 10f;
|
||||
lifetime = 55f;
|
||||
trailWidth = 2f;
|
||||
trailLength = 4;
|
||||
shake = 0.5f;
|
||||
recoil = 0.1f;
|
||||
|
||||
trailEffect = Fx.missileTrail;
|
||||
trailParam = 1.8f;
|
||||
trailInterval = 8f;
|
||||
|
||||
hitEffect = despawnEffect = Fx.hitBulletColor;
|
||||
shootEffect = new MultiEffect(Fx.shootBigColor, Fx.hitLaserColor);
|
||||
smokeEffect = Fx.shootSmallSmoke;
|
||||
ammoMultiplier = 2;
|
||||
}};
|
||||
}});
|
||||
|
||||
weapons.add(new PointDefenseWeapon("latum-point-defense"){{
|
||||
x = 16f / 4f;
|
||||
y = -20f / 4f;
|
||||
reload = 10f;
|
||||
|
||||
targetInterval = 9f;
|
||||
targetSwitchInterval = 12f;
|
||||
recoil = 0.5f;
|
||||
|
||||
bullet = new BulletType(){{
|
||||
shootEffect = Fx.sparkShoot;
|
||||
hitEffect = Fx.pointHit;
|
||||
maxRange = 100f;
|
||||
damage = 30f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.entities.part;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
|
||||
public abstract class DrawPart{
|
||||
public static final PartParams params = new PartParams();
|
||||
@@ -88,6 +89,10 @@ public abstract class DrawPart{
|
||||
return p -> get(p) + amount;
|
||||
}
|
||||
|
||||
default PartProgress add(PartProgress other){
|
||||
return p -> get(p) + other.get(p);
|
||||
}
|
||||
|
||||
default PartProgress delay(float amount){
|
||||
return p -> (get(p) - amount) / (1f - amount);
|
||||
}
|
||||
@@ -96,6 +101,13 @@ public abstract class DrawPart{
|
||||
return p -> (get(p) - offset) / duration;
|
||||
}
|
||||
|
||||
default PartProgress sustain(float offset, float grow, float sustain){
|
||||
return p -> {
|
||||
float val = get(p) - offset;
|
||||
return Math.min(Math.max(val, 0f) / grow, (grow + sustain + grow - val) / grow);
|
||||
};
|
||||
}
|
||||
|
||||
default PartProgress shorten(float amount){
|
||||
return p -> get(p) / (1f - amount);
|
||||
}
|
||||
@@ -116,6 +128,10 @@ public abstract class DrawPart{
|
||||
return p -> Math.min(get(p), other.get(p));
|
||||
}
|
||||
|
||||
default PartProgress sin(float offset, float scl, float mag){
|
||||
return p -> get(p) + Mathf.sin(Time.time + offset, scl, mag);
|
||||
}
|
||||
|
||||
default PartProgress sin(float scl, float mag){
|
||||
return p -> get(p) + Mathf.sin(scl, mag);
|
||||
}
|
||||
|
||||
@@ -58,5 +58,7 @@ public class PointDefenseWeapon extends Weapon{
|
||||
bullet.shootEffect.at(shootX, shootY, rotation, color);
|
||||
bullet.hitEffect.at(target.x, target.y, color);
|
||||
shootSound.at(shootX, shootY, Mathf.random(0.9f, 1.1f));
|
||||
mount.recoil = recoil;
|
||||
mount.heat = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class LaserTurret extends PowerTurret{
|
||||
super.setStats();
|
||||
|
||||
stats.remove(Stat.booster);
|
||||
stats.add(Stat.input, StatValues.boosters(reloadTime, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
stats.add(Stat.input, StatValues.boosters(reload, coolant.amount, coolantMultiplier, false, this::consumesLiquid));
|
||||
}
|
||||
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
@@ -66,13 +66,13 @@ public class LaserTurret extends PowerTurret{
|
||||
wasShooting = true;
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
}else if(reload > 0){
|
||||
}else if(reloadCounter > 0){
|
||||
wasShooting = true;
|
||||
//TODO does not handle multi liquid req?
|
||||
Liquid liquid = liquids.current();
|
||||
float maxUsed = coolant.amount;
|
||||
float used = (cheating() ? maxUsed : Math.min(liquids.get(liquid), maxUsed)) * delta();
|
||||
reload -= used * liquid.heatCapacity * coolantMultiplier;
|
||||
reloadCounter -= used * liquid.heatCapacity * coolantMultiplier;
|
||||
liquids.remove(liquid, used);
|
||||
|
||||
if(Mathf.chance(0.06 * used)){
|
||||
@@ -83,7 +83,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return 1f - Mathf.clamp(reload / reloadTime);
|
||||
return 1f - Mathf.clamp(reloadCounter / reload);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,12 +97,12 @@ public class LaserTurret extends PowerTurret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(reload <= 0 && efficiency > 0 && !charging() && shootWarmup >= minWarmup){
|
||||
if(reloadCounter <= 0 && efficiency > 0 && !charging() && shootWarmup >= minWarmup){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
reload = reloadTime;
|
||||
reloadCounter = reload;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
super(name);
|
||||
|
||||
rotateSpeed = 20f;
|
||||
reloadTime = 30f;
|
||||
reload = 30f;
|
||||
|
||||
coolantMultiplier = 2f;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.reload, 60f / reloadTime, StatUnit.perSecond);
|
||||
stats.add(Stat.reload, 60f / reload, StatUnit.perSecond);
|
||||
}
|
||||
|
||||
public class PointDefenseBuild extends ReloadTurretBuild{
|
||||
@@ -76,10 +76,10 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
if(target != null && target.within(this, range) && target.team != team && target.type() != null && target.type().hittable){
|
||||
float dest = angleTo(target);
|
||||
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
|
||||
reload += edelta();
|
||||
reloadCounter += edelta();
|
||||
|
||||
//shoot when possible
|
||||
if(Angles.within(rotation, dest, shootCone) && reload >= reloadTime){
|
||||
if(Angles.within(rotation, dest, shootCone) && reloadCounter >= reload){
|
||||
if(target.damage() > bulletDamage){
|
||||
target.damage(target.damage() - bulletDamage);
|
||||
}else{
|
||||
@@ -92,7 +92,7 @@ public class PointDefenseTurret extends ReloadTurret{
|
||||
shootEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, color);
|
||||
hitEffect.at(target.x, target.y, color);
|
||||
shootSound.at(x + Tmp.v1.x, y + Tmp.v1.y, Mathf.random(0.9f, 1.1f));
|
||||
reload = 0;
|
||||
reloadCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ReloadTurret extends BaseTurret{
|
||||
public float reloadTime = 10f;
|
||||
public float reload = 10f;
|
||||
|
||||
public ReloadTurret(String name){
|
||||
super(name);
|
||||
@@ -18,25 +18,25 @@ public class ReloadTurret extends BaseTurret{
|
||||
super.setStats();
|
||||
|
||||
if(coolant != null){
|
||||
stats.add(Stat.booster, StatValues.boosters(reloadTime, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l)));
|
||||
stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l)));
|
||||
}
|
||||
}
|
||||
|
||||
public class ReloadTurretBuild extends BaseTurretBuild{
|
||||
public float reload;
|
||||
public float reloadCounter;
|
||||
|
||||
@Override
|
||||
public void created(){
|
||||
super.created();
|
||||
//for visual reasons, the turret does not need reloading when placed
|
||||
reload = reloadTime;
|
||||
reloadCounter = reload;
|
||||
}
|
||||
|
||||
protected void updateCooling(){
|
||||
if(reload < reloadTime && coolant != null && coolant.efficiency(this) > 0){
|
||||
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0){
|
||||
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : 1f;
|
||||
coolant.update(this);
|
||||
reload += coolant.amount * edelta() * capacity * coolantMultiplier;
|
||||
reloadCounter += coolant.amount * edelta() * capacity * coolantMultiplier;
|
||||
|
||||
if(Mathf.chance(0.06 * coolant.amount)){
|
||||
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Turret extends ReloadTurret{
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees);
|
||||
stats.add(Stat.reload, 60f / (reloadTime) * shoot.shots, StatUnit.perSecond);
|
||||
stats.add(Stat.reload, 60f / (reload) * shoot.shots, StatUnit.perSecond);
|
||||
stats.add(Stat.targetsAir, targetAir);
|
||||
stats.add(Stat.targetsGround, targetGround);
|
||||
if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot);
|
||||
@@ -180,7 +180,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
public float estimateDps(){
|
||||
if(!hasAmmo()) return 0f;
|
||||
return shoot.shots / reloadTime * 60f * peekAmmo().estimateDPS() * efficiency * timeScale;
|
||||
return shoot.shots / reload * 60f * peekAmmo().estimateDPS() * efficiency * timeScale;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,7 +252,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(reload / reloadTime);
|
||||
return Mathf.clamp(reloadCounter / reload);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
@@ -332,7 +332,7 @@ public class Turret extends ReloadTurret{
|
||||
updateReload();
|
||||
|
||||
if(hasAmmo()){
|
||||
if(Float.isNaN(reload)) reload = 0;
|
||||
if(Float.isNaN(reloadCounter)) reloadCounter = 0;
|
||||
|
||||
if(timer(timerTarget, targetInterval)){
|
||||
findTarget();
|
||||
@@ -451,20 +451,20 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
protected void updateReload(){
|
||||
float multiplier = hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
|
||||
reload += delta() * multiplier * baseReloadSpeed();
|
||||
reloadCounter += delta() * multiplier * baseReloadSpeed();
|
||||
|
||||
//cap reload for visual reasons
|
||||
reload = Math.min(reload, reloadTime);
|
||||
reloadCounter = Math.min(reloadCounter, reload);
|
||||
}
|
||||
|
||||
protected void updateShooting(){
|
||||
|
||||
if(reload >= reloadTime && !charging() && shootWarmup >= minWarmup){
|
||||
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
|
||||
BulletType type = peekAmmo();
|
||||
|
||||
shoot(type);
|
||||
|
||||
reload %= reloadTime;
|
||||
reloadCounter %= reload;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ public class Turret extends ReloadTurret{
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.f(reload);
|
||||
write.f(reloadCounter);
|
||||
write.f(rotation);
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ public class Turret extends ReloadTurret{
|
||||
super.read(read, revision);
|
||||
|
||||
if(revision >= 1){
|
||||
reload = read.f();
|
||||
reloadCounter = read.f();
|
||||
rotation = read.f();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user