Disperse turret mostly done

This commit is contained in:
Anuken 2022-02-11 20:08:59 -05:00
parent 64cb5c5879
commit e8c277d7b8
26 changed files with 79 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View File

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

View File

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 795 B

View File

@ -3215,11 +3215,11 @@ public class Blocks{
}};
titan = new ItemTurret("titan"){{
requirements(Category.turret, with(Items.carbide, 250, Items.surgeAlloy, 160, Items.silicon, 300, Items.beryllium, 400));
requirements(Category.turret, with(Items.carbide, 100, Items.tungsten, 250, Items.silicon, 300, Items.beryllium, 400));
ammo(
//TODO 1 more ammo type, decide on base type
Items.fissileMatter, new ArtilleryBulletType(2.5f, 300, "shell"){{
Items.carbide, new ArtilleryBulletType(2.5f, 300, "shell"){{
hitEffect = new MultiEffect(Fx.titanExplosion, Fx.titanSmoke);
despawnEffect = Fx.none;
knockback = 2f;
@ -3228,6 +3228,7 @@ public class Blocks{
width = 17f;
splashDamageRadius = 65f;
splashDamage = 250f;
scaledSplashDamage = true;
backColor = hitColor = trailColor = Color.valueOf("ea8878").lerp(Color.valueOf("feb380"), 0.5f);
frontColor = Color.white;
ammoMultiplier = 1f;
@ -3255,7 +3256,9 @@ public class Blocks{
recoilAmount = 1f;
reloadTime = 60f * 3f;
shootLength = 7f;
rotateSpeed = 2.5f;
rotateSpeed = 1.4f;
minWarmup = 0.85f;
shootWarmupSpeed = 0.07f;
coolantUsage = 30f / 60f;
coolantOverride = Liquids.water;
@ -3263,14 +3266,14 @@ public class Blocks{
draw = new DrawTurret("reinforced-"){{
parts.addAll(
new RegionPart("-barrel"){{
progress = PartProgress.warmup.curve(Interp.pow2In);
progress = PartProgress.reload.curve(Interp.pow2In);
moveY = -5f * 4f / 3f;
heatColor = Color.valueOf("f03b0e");
mirror = false;
}},
new RegionPart("-side"){{
heatProgress = PartProgress.warmup;
progress = PartProgress.warmup.curve(Interp.pow2Out);
progress = PartProgress.warmup;
mirror = true;
moveX = 2f * 4f / 3f;
moveY = -0.5f;
@ -3294,13 +3297,11 @@ public class Blocks{
}};
disperse = new ItemTurret("disperse"){{
requirements(Category.turret, with(Items.carbide, 250, Items.surgeAlloy, 160, Items.silicon, 300, Items.beryllium, 400));
requirements(Category.turret, with(Items.carbide, 50, Items.oxide, 150, Items.silicon, 200, Items.beryllium, 350));
ammo(Items.scrap, new BasicBulletType(){{
damage = 50;
damage = 40;
speed = 8.5f;
//width = 11f;
//height = 19f;
width = height = 16;
shrinkY = 0.3f;
backSprite = "large-bomb-back";
@ -3309,27 +3310,24 @@ public class Blocks{
collidesGround = false;
collidesTiles = false;
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootBigSmoke2;
smokeEffect = Fx.shootSmokeDisperse;
frontColor = trailColor = Color.white;
backColor = Color.valueOf("869cbe");
//trailInterval = 3;
trailChance = 0.44f;
lifetime = 34f;
rotationOffset = 90f;
trailRotation = true;
trailEffect = Fx.disperseTrail;
//spin = 360f;
hitEffect = despawnEffect = Fx.hitBulletColor;
//controversial
//homingDelay = 10f;
//homingPower = 0.01f;
hitEffect = despawnEffect = Fx.hitBulletColor;
}});
//TODO bullet.
//recoilAmount = 1f;
reloadTime = 9f;
shootLength = 15f;
rotateSpeed = 5f;
@ -3339,7 +3337,33 @@ public class Blocks{
coolantOverride = Liquids.water;
draw = new DrawTurret("reinforced-"){{
parts.add(new RegionPart("-side"){{
mirror = true;
under = true;
moveX = 1.75f;
moveY = -0.5f;
}});
parts.add(new RegionPart("-mid"){{
under = true;
moveY = -1f;
progress = PartProgress.reload;
heatProgress = PartProgress.reload.add(0.25f).min(PartProgress.warmup);
heatColor = Color.sky.cpy().a(0.9f);
}});
parts.add(new RegionPart("-blade"){{
heatProgress = PartProgress.warmup;
heatColor = Color.sky.cpy().a(0.9f);
mirror = true;
under = true;
moveY = 1f;
//lame
moveX = 0.5f;
//wackier variant
moveX = 1.5f;
moveRot = 8;
}});
}};
unitFilter = u -> !u.spawnedByCore;
@ -3347,10 +3371,10 @@ public class Blocks{
alternate = true;
widthSpread = true;
targetGround = false;
spread = 4.6f;
spread = 4.7f;
inaccuracy = 8f;
restitution = 0.1f;
restitution = 0.11f;
shootWarmupSpeed = 0.08f;
outlineColor = Pal.darkOutline;

View File

@ -196,6 +196,10 @@ public class ErekirTechTree{
node(titan, () -> {
});
node(disperse, () -> {
});
});
});

View File

@ -1496,6 +1496,14 @@ public class Fx{
});
}),
shootSmokeDisperse = new Effect(25f, e -> {
color(Pal.lightOrange, Color.white, Color.gray, e.fin());
randLenVectors(e.id, 9, e.finpow() * 29f, e.rotation, 18f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2.2f + 0.1f);
});
}),
shootSmokeTris = new Effect(30f, e -> {
color(Color.white, e.color, e.fin());

View File

@ -3041,7 +3041,7 @@ public class UnitTypes{
speed = 4.5f;
maxRange = 80f;
outlineColor = Pal.darkOutline;
health = 45;
health = 70;
homingDelay = 10f;
lowAltitude = true;
engineSize = 3f;

View File

@ -146,13 +146,13 @@ public class RegionPart extends DrawPart{
//TODO l/r
if(mirror && turretShading){
regions = new TextureRegion[]{
Core.atlas.find(realName + "1"),
Core.atlas.find(realName + "2")
Core.atlas.find(realName + "-r"),
Core.atlas.find(realName + "-l")
};
outlines = new TextureRegion[]{
Core.atlas.find(realName + "1-outline"),
Core.atlas.find(realName + "2-outline")
Core.atlas.find(realName + "-r-outline"),
Core.atlas.find(realName + "-l-outline")
};
}else{
regions = new TextureRegion[]{Core.atlas.find(realName)};

View File

@ -44,6 +44,7 @@ public class ModsDialog extends BaseDialog{
private BaseDialog browser;
private Table browserTable;
private float scoll = 0f;
public ModsDialog(){
super("@mods");
@ -314,7 +315,7 @@ public class ModsDialog extends BaseDialog{
cont.pane(table1 -> {
pane[0] = table1.margin(10f).top();
rebuild.get("");
}).scrollX(false);
}).scrollX(false).update(s -> scoll = s.getScrollY()).get().setScrollYForce(scoll);
}else{
cont.table(Styles.black6, t -> t.add("@mods.none")).height(80f);
}

View File

@ -109,7 +109,7 @@ public class ContinuousTurret extends Turret{
return;
}
if(cons.canConsume() && !charging){
if(cons.canConsume() && !charging && shootWarmup >= minWarmup){
shoot(peekAmmo());
}
}

View File

@ -95,7 +95,7 @@ public class LaserTurret extends PowerTurret{
return;
}
if(reload <= 0 && (consValid() || cheating()) && !charging){
if(reload <= 0 && (consValid() || cheating()) && !charging && shootWarmup >= minWarmup){
BulletType type = peekAmmo();
shoot(type);

View File

@ -49,6 +49,7 @@ public class Turret extends ReloadTurret{
//visuals
public float ammoEjectBack = 1f;
public float shootWarmupSpeed = 0.1f;
public boolean linearWarmup = false;
public float recoilAmount = 1f;
public float restitution = 0.02f;
public float cooldown = 0.02f;
@ -83,6 +84,8 @@ public class Turret extends ReloadTurret{
public float xRand = 0f;
/** Currently used for artillery only. */
public float minRange = 0f;
/** Minimum warmup needed to fire. */
public float minWarmup = 0f;
/** Ticks between shots if shots > 1. */
public float burstSpacing = 0;
/** An inflexible and terrible idea. */
@ -334,8 +337,12 @@ public class Turret extends ReloadTurret{
public void updateTile(){
if(!validateTarget()) target = null;
//TODO make it approach instead and add interp curves to parts
shootWarmup = Mathf.lerpDelta(shootWarmup, isShooting() && cons.canConsume() ? 1f : 0f, shootWarmupSpeed);
float warmupTarget = isShooting() && cons.canConsume() ? 1f : 0f;
if(linearWarmup){
shootWarmup = Mathf.approachDelta(shootWarmup, warmupTarget, shootWarmupSpeed);
}else{
shootWarmup = Mathf.lerpDelta(shootWarmup, warmupTarget, shootWarmupSpeed);
}
wasShooting = false;
@ -486,7 +493,7 @@ public class Turret extends ReloadTurret{
protected void updateShooting(){
if(reload >= reloadTime && !charging){
if(reload >= reloadTime && !charging && shootWarmup >= minWarmup){
BulletType type = peekAmmo();
shoot(type);

View File

@ -36,7 +36,10 @@ public class DrawTurret extends DrawBlock{
part.getOutlines(out);
}
if(preview.found()){
out.add(block.region);
out.add(preview);
if(block.region.found()){
out.add(block.region);
}
}
}
@ -75,7 +78,9 @@ public class DrawTurret extends DrawBlock{
}
public void drawTurret(Turret block, TurretBuild build){
Draw.rect(block.region, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot());
if(block.region.found()){
Draw.rect(block.region, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot());
}
if(liquid.found()){
Liquid toDraw = liquidDraw == null ? build.liquids.current() : liquidDraw;