Unfinished titan turret

This commit is contained in:
Anuken
2021-12-04 14:08:50 -05:00
parent 0f23fac963
commit 5103c95f2e
29 changed files with 168 additions and 25 deletions

View File

@@ -119,7 +119,7 @@ public class Blocks{
duo, scatter, scorch, hail, arc, wave, lancer, swarmer, salvo, fuse, ripple, cyclone, foreshadow, spectre, meltdown, segment, parallax, tsunami,
//turrets - erekir
breach, fracture, sublimate,
breach, fracture, sublimate, titan,
//units
commandCenter,
@@ -2271,7 +2271,7 @@ public class Blocks{
size = 4;
thrusterLength = 34/4f;
unitCapModifier = 20;
unitCapModifier = 16;
researchCostMultiplier = 0.07f;
}};
@@ -2280,12 +2280,12 @@ public class Blocks{
requirements(Category.effect, with(Items.beryllium, 7000, Items.graphite, 7000, Items.tungsten, 5000, Items.carbide, 5000));
unitType = UnitTypes.incite;
health = 14000;
health = 18000;
itemCapacity = 11000;
size = 5;
thrusterLength = 40/4f;
unitCapModifier = 30;
unitCapModifier = 24;
researchCostMultiplier = 0.11f;
}};
@@ -2294,12 +2294,12 @@ public class Blocks{
requirements(Category.effect, with(Items.beryllium, 11000, Items.graphite, 11000, Items.tungsten, 9000, Items.carbide, 10000));
unitType = UnitTypes.emanate;
health = 22000;
health = 30000;
itemCapacity = 16000;
size = 6;
thrusterLength = 48/4f;
unitCapModifier = 40;
unitCapModifier = 32;
researchCostMultiplier = 0.11f;
}};
@@ -2794,7 +2794,7 @@ public class Blocks{
//TODO tungsten support?
breach = new ItemTurret("breach"){{
requirements(Category.turret, with(Items.beryllium, 35, Items.silicon, 20), true);
requirements(Category.turret, with(Items.beryllium, 35, Items.silicon, 20));
ammo(
Items.beryllium, new BasicBulletType(7f, 32){{
width = 8f;
@@ -2847,7 +2847,7 @@ public class Blocks{
//TODO implementation; splash damage? shotgun? AA? I have no ideas
fracture = new ItemTurret("fracture"){{
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35), true);
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35));
ammo(
Items.tungsten, new BasicBulletType(5f, 20){{
velocityInaccuracy = 0.2f;
@@ -2891,7 +2891,7 @@ public class Blocks{
//TODO bad name
sublimate = new ContinuousTurret("sublimate"){{
//TODO requirements
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35), true);
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35));
draw = new DrawTurret("reinforced-"){{
liquidDraw = Liquids.ozone;
@@ -2899,7 +2899,9 @@ public class Blocks{
Color heatc = Color.valueOf("fa2859");
heatColor = heatc;
parts.addAll(new RegionPart("-back"){{
parts.addAll(
new RegionPart("-back"){{
useReload = false;
rotMove = 40f;
x = 22 / 4f;
y = -1f / 4f;
@@ -2908,6 +2910,7 @@ public class Blocks{
heatColor = heatc;
}},
new RegionPart("-front"){{
useReload = false;
rotMove = 40f;
x = 20 / 4f;
y = 17f / 4f;
@@ -2917,6 +2920,7 @@ public class Blocks{
heatColor = heatc;
}},
new RegionPart("-nozzle"){{
useReload = false;
moveX = 8f / 4f;
heatColor = Color.valueOf("f03b0e");
}});
@@ -2937,6 +2941,91 @@ public class Blocks{
size = 3;
}};
titan = new ItemTurret("titan"){{
//TODO requirements
requirements(Category.turret, with(Items.carbide, 120, Items.surgeAlloy, 80, Items.silicon, 80, Items.beryllium, 120));
ammo(
//TODO ammo types to be defined later
Items.fissileMatter, new ArtilleryBulletType(2f, 40, "shell"){{
//TODO FX; smoke, shockwave, not green bomb
hitEffect = new MultiEffect(Fx.titanExplosion, Fx.titanSmoke);
despawnEffect = Fx.none;
knockback = 1.5f;
lifetime = 140f;
height = 16f;
width = 14.2f;
ammoMultiplier = 4f;
splashDamageRadius = 60f;
splashDamage = 100f;
backColor = hitColor = trailColor = Pal.berylShot;
frontColor = Color.valueOf("f0ffde");
status = StatusEffects.blasted;
trailLength = 32;
trailWidth = 2.64f;
trailSinScl = 2.5f;
trailSinMag = 1f;
trailEffect = Fx.none;
trailColor = backColor;
despawnShake = 7f;
//TODO better shoot
shootEffect = Fx.shootTitan;
smokeEffect = Fx.shootSmokeTitan;
//does the trail need to shrink?
trailInterp = v -> Math.max(Mathf.slope(v), 0.8f);
shrinkX = 0.2f;
shrinkY = 0.1f;
}}
);
targetAir = false;
shootShake = 4f;
recoilAmount = 1f;
reloadTime = 60f * 2f;
shootLength = 7f;
rotateSpeed = 2.5f;
acceptCoolant = false;
draw = new DrawTurret("reinforced-"){{
Color heatc = Color.valueOf("f03b0e");
Interp in = Interp.pow2In;
parts.addAll(
new RegionPart("-barrel"){{
moveY = -5f;
heatColor = heatc;
mirror = false;
interp = in;
}},
new RegionPart("-side"){{
moveY = -1f;
rotMove = -40f;
moveX = 2f;
useReload = false;
under = true;
heatColor = Pal.berylShot.cpy().mul(1.1f);
useProgressHeat = true;
interp = Interp.pow2Out;
}}
);
}};
restitution = 0.02f;
shootWarmupSpeed = 0.08f;
outlineColor = Pal.darkOutline;
consumes.liquids(LiquidStack.with(Liquids.hydrogen, 1f / 60f));
range = 360f;
size = 3;
}};
//endregion
//region units

View File

@@ -339,6 +339,34 @@ public class Fx{
Lines.spikes(e.x, e.y, 1f + e.fin() * 6f, e.fout() * 4f, 6);
}),
titanExplosion = new Effect(30f, 160f, e -> {
color(Pal.berylShot);
stroke(e.fout() * 3f);
float circleRad = 6f + e.finpow() * 60f;
Lines.circle(e.x, e.y, circleRad);
Lines.spikes(e.x, e.y, circleRad + 6f, 32f * e.foutpow(), 10);
}),
titanSmoke = new Effect(300f, 300f, b -> {
float intensity = 3f;
color(Pal.berylShot, 0.7f);
for(int i = 0; i < 4; i++){
rand.setSeed(b.id*2 + i);
float lenScl = rand.random(0.5f, 1f);
int fi = i;
b.scaled(b.lifetime * lenScl, e -> {
randLenVectors(e.id + fi - 1, e.fin(Interp.pow10Out), (int)(2.9f * intensity), 22f * intensity, (x, y, in, out) -> {
float fout = e.fout(Interp.pow5Out) * rand.random(0.5f, 1f);
float rad = fout * ((2f + intensity) * 2.35f);
Fill.circle(e.x + x, e.y + y, rad);
Drawf.light(e.x + x, e.y + y, rad * 2.5f, Pal.berylShot, 0.5f);
});
});
}
}).layer(Layer.bullet - 4f),
greenBomb = new Effect(40f, 100f, e -> {
color(Pal.heal);
stroke(e.fout() * 2f);
@@ -1337,6 +1365,13 @@ public class Fx{
Drawf.tri(e.x, e.y, w, 5f * e.fout(), e.rotation + 180f);
}),
shootTitan = new Effect(10, e -> {
color(Pal.lightOrange, Pal.berylShot, e.fin());
float w = 1.3f + 10 * e.fout();
Drawf.tri(e.x, e.y, w, 35f * e.fout(), e.rotation);
Drawf.tri(e.x, e.y, w, 6f * e.fout(), e.rotation + 180f);
}),
shootBigSmoke = new Effect(17f, e -> {
color(Pal.lighterOrange, Color.lightGray, Color.gray, e.fin());
@@ -1353,6 +1388,17 @@ public class Fx{
});
}),
shootSmokeTitan = new Effect(70f, e -> {
rand.setSeed(e.id);
for(int i = 0; i < 13; i++){
v.trns(e.rotation + rand.range(30f), rand.random(e.finpow() * 40f));
e.scaled(e.lifetime * rand.random(0.3f, 1f), b -> {
color(Pal.berylShot, Pal.lightishGray, b.fin());
Fill.circle(e.x + v.x, e.y + v.y, b.fout() * 3.4f + 0.3f);
});
}
}),
regenParticle = new Effect(100f, e -> {
color(Pal.accent);

View File

@@ -140,6 +140,7 @@ public class BulletType extends Content implements Cloneable{
/** Any value <= 0 disables the trail. */
public int trailLength = -1;
public float trailWidth = 2f;
public float trailSinMag = 0f, trailSinScl = 3f;
/** Use a negative value to disable splash damage. */
public float splashDamageRadius = -1f;
@@ -396,7 +397,7 @@ public class BulletType extends Content implements Cloneable{
b.trail = new Trail(trailLength);
}
b.trail.length = trailLength;
b.trail.update(b.x, b.y, trailInterp.apply(b.fin()));
b.trail.update(b.x, b.y, trailInterp.apply(b.fin()) * (1f + (trailSinMag > 0 ? Mathf.absin(Time.time, trailSinScl, trailSinMag) : 0f)));
}
}

View File

@@ -35,7 +35,7 @@ public class ReloadTurret extends BaseTurret{
}
protected void updateCooling(){
if(reload < reloadTime){
if(reload < reloadTime && acceptCoolant){
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
Liquid liquid = liquids.current();

View File

@@ -296,6 +296,7 @@ public class Turret extends ReloadTurret{
wasShooting = false;
//TODO do not lerp
recoil = Mathf.lerpDelta(recoil, 0f, restitution);
heat = Mathf.lerpDelta(heat, 0f, cooldown);

View File

@@ -124,15 +124,18 @@ public class DrawTurret extends DrawBlock{
public TextureRegion[] outlines;
/** If true, turret reload is used as the measure of progress. Otherwise, warmup is used. */
public boolean useReload = false;
public boolean useReload = true;
/** If true, parts are mirrored across the turret. Requires -1 and -2 regions. */
public boolean mirror = true;
/** If true, an outline is drawn under the part. */
public boolean outline = true;
/** If true, the layer is overridden to be under the turret itself. */
public boolean under = false;
/** If true, the base + outline regions are drawn. Set to false for heat-only regions. */
public boolean drawRegion = true;
/** If true, progress is inverted. */
public boolean invert = false;
public boolean useProgressHeat = false;
public Interp interp = Interp.linear;
public float layer = -1;
public float outlineLayerOffset = -0.01f;
@@ -176,18 +179,18 @@ public class DrawTurret extends DrawBlock{
Draw.xscl = i == 0 ? 1 : -1;
if(outline){
if(outline && drawRegion){
Draw.z(prevZ + outlineLayerOffset);
Draw.rect(outlines[i], rx, ry, rot);
Draw.z(prevZ);
}
if(region.found()){
if(drawRegion && region.found()){
Draw.rect(region, rx, ry, rot);
}
if(heat.found()){
Drawf.additive(heat, heatColor.write(Tmp.c1).a(build.heat), rx, ry, rot, Layer.turretHeat);
Drawf.additive(heat, heatColor.write(Tmp.c1).a(useProgressHeat ? build.warmup() : build.heat), rx, ry, rot, Layer.turretHeat);
}
Draw.xscl = 1f;
@@ -200,19 +203,21 @@ public class DrawTurret extends DrawBlock{
public void load(Block block){
if(under) layer = Layer.turret - 0.0001f;
if(mirror){
regions = new TextureRegion[]{
if(drawRegion){
if(mirror){
regions = new TextureRegion[]{
Core.atlas.find(block.name + suffix + "1"),
Core.atlas.find(block.name + suffix + "2")
};
};
outlines = new TextureRegion[]{
outlines = new TextureRegion[]{
Core.atlas.find(block.name + suffix + "1-outline"),
Core.atlas.find(block.name + suffix + "2-outline")
};
}else{
regions = new TextureRegion[]{Core.atlas.find(block.name + suffix)};
outlines = new TextureRegion[]{Core.atlas.find(block.name + suffix + "-outline")};
};
}else{
regions = new TextureRegion[]{Core.atlas.find(block.name + suffix)};
outlines = new TextureRegion[]{Core.atlas.find(block.name + suffix + "-outline")};
}
}
heat = Core.atlas.find(block.name + suffix + "-heat");
@@ -220,7 +225,7 @@ public class DrawTurret extends DrawBlock{
@Override
public void getOutlines(Seq<TextureRegion> out){
if(outline){
if(outline && drawRegion){
out.addAll(regions);
}
}