impact drill progress
This commit is contained in:
@@ -6,6 +6,7 @@ import arc.struct.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.entities.effect.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
@@ -1602,13 +1603,13 @@ public class Blocks implements ContentList{
|
||||
//TODO should be crusher or something
|
||||
impactDrill = new BurstDrill("impact-drill"){{
|
||||
requirements(Category.production, with(Items.silicon, 60, Items.beryllium, 90, Items.graphite, 50));
|
||||
drillTime = 60f * 10f;
|
||||
drillTime = 60f * 12f;
|
||||
size = 4;
|
||||
drawRim = false;
|
||||
hasPower = true;
|
||||
tier = 6;
|
||||
drillEffect = Fx.mineHuge;
|
||||
itemCapacity = 30;
|
||||
drillEffect = new MultiEffect(Fx.mineImpact, Fx.drillSteam);
|
||||
shake = 4f;
|
||||
itemCapacity = 40;
|
||||
|
||||
consumes.power(3f);
|
||||
consumes.liquid(Liquids.water, 0.2f);
|
||||
|
||||
@@ -952,6 +952,22 @@ public class Fx{
|
||||
}
|
||||
}),
|
||||
|
||||
drillSteam = new Effect(220f, e -> {
|
||||
|
||||
float length = 3f + e.finpow() * 20f;
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < 13; i++){
|
||||
v.trns(rand.random(360f), rand.random(length));
|
||||
float sizer = rand.random(1.3f, 3.7f);
|
||||
|
||||
e.scaled(e.lifetime * rand.random(0.5f, 1f), b -> {
|
||||
color(Color.gray, b.fslope() * 0.93f);
|
||||
|
||||
Fill.circle(e.x + v.x, e.y + v.y, sizer + b.fslope() * 1.2f);
|
||||
});
|
||||
}
|
||||
}).startDelay(30f),
|
||||
|
||||
vapor = new Effect(110f, e -> {
|
||||
color(e.color);
|
||||
alpha(e.fout());
|
||||
@@ -1840,6 +1856,29 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
mineImpact = new Effect(90, e -> {
|
||||
color(e.color, Color.lightGray, e.fin());
|
||||
randLenVectors(e.id, 12, 5f + e.finpow() * 22f, (x, y) -> {
|
||||
Fill.square(e.x + x, e.y + y, e.fout() * 2.5f + 0.5f, 45);
|
||||
});
|
||||
|
||||
color(Pal.redLight);
|
||||
|
||||
e.scaled(50f, b -> {
|
||||
stroke(b.fout() * 1.5f);
|
||||
|
||||
randLenVectors(e.id, 12, 4f + b.finpow() * 40f, (x, y) -> {
|
||||
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), b.fout() * 5 + 1f);
|
||||
});
|
||||
});
|
||||
|
||||
e.scaled(30f, b -> {
|
||||
Lines.stroke(5f * b.fout());
|
||||
Lines.circle(e.x, e.y, b.finpow() * 28f);
|
||||
});
|
||||
|
||||
}),
|
||||
|
||||
payloadReceive = new Effect(30, e -> {
|
||||
color(Color.white, Pal.accent, e.fin());
|
||||
randLenVectors(e.id, 12, 7f + e.fin() * 13f, (x, y) -> {
|
||||
|
||||
@@ -282,10 +282,11 @@ public class Drawf{
|
||||
|
||||
/** Draws a sprite that should be light-wise correct, when rotated. Provided sprite must be symmetrical in shape. */
|
||||
public static void spinSprite(TextureRegion region, float x, float y, float r){
|
||||
float a = Draw.getColor().a;
|
||||
r = Mathf.mod(r, 90f);
|
||||
Draw.rect(region, x, y, r);
|
||||
Draw.alpha(r / 90f);
|
||||
Draw.alpha(r / 90f*a);
|
||||
Draw.rect(region, x, y, r - 90f);
|
||||
Draw.alpha(1f);
|
||||
Draw.alpha(a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,5 +121,7 @@ public class Pal{
|
||||
|
||||
muddy = Color.valueOf("432722"),
|
||||
|
||||
redLight = Color.valueOf("feb380"),
|
||||
|
||||
vent = Color.valueOf("6b4e4e");
|
||||
}
|
||||
|
||||
@@ -107,15 +107,15 @@ public class ImpactReactor extends PowerGenerator{
|
||||
public void draw(){
|
||||
Draw.rect(bottomRegion, x, y);
|
||||
|
||||
Draw.blend(Blending.additive);
|
||||
for(int i = 0; i < plasmaRegions.length; i++){
|
||||
float r = size * tilesize - 3f + Mathf.absin(Time.time, 2f + i * 1f, 5f - i * 0.5f);
|
||||
|
||||
Draw.color(plasma1, plasma2, (float)i / plasmaRegions.length);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time, 2f + i * 2f, 0.3f + i * 0.05f)) * warmup);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(plasmaRegions[i], x, y, r, r, Time.time * (12 + i * 6f) * warmup);
|
||||
Draw.blend();
|
||||
}
|
||||
Draw.blend();
|
||||
|
||||
Draw.color();
|
||||
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.graphics.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
|
||||
public class BurstDrill extends Drill{
|
||||
public int outputAmount = 5;
|
||||
public float shake = 2f;
|
||||
public Interp speedCurve = Interp.pow2In;
|
||||
|
||||
public @Load("@-top-invert") TextureRegion topInvertRegion;
|
||||
public @Load("@-arrow") TextureRegion arrowRegion;
|
||||
public @Load("@-arrow-blur") TextureRegion arrowBlurRegion;
|
||||
public float invertTime = 80f;
|
||||
public float arrowSpacing = 4f;
|
||||
public Color arrowColor = Color.valueOf("feb380");
|
||||
//public @Load(value = "impact-reactor-plasma-#", length = 4) TextureRegion[] plasmaRegions;
|
||||
//public Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b");
|
||||
|
||||
public BurstDrill(String name){
|
||||
super(name);
|
||||
@@ -15,9 +29,18 @@ public class BurstDrill extends Drill{
|
||||
hardnessDrillMultiplier = 0f;
|
||||
//generally at center
|
||||
drillEffectRnd = 0f;
|
||||
drillEffect = Fx.shockwave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, topRegion};
|
||||
}
|
||||
|
||||
public class BurstDrillBuild extends DrillBuild{
|
||||
//used so the lights don't fade out immediately
|
||||
public float smoothProgress = 0f;
|
||||
public float invertTime = 0f;
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
@@ -25,33 +48,46 @@ public class BurstDrill extends Drill{
|
||||
return;
|
||||
}
|
||||
|
||||
if(invertTime > 0f) invertTime -= delta() / invertTime;
|
||||
|
||||
if(timer(timerDump, dumpTime)){
|
||||
dump(items.has(dominantItem) ? dominantItem : null);
|
||||
}
|
||||
|
||||
if(items.total() <= itemCapacity - outputAmount && dominantItems > 0 && consValid()){
|
||||
smoothProgress = Mathf.lerpDelta(smoothProgress, progress / (drillTime - 20f), 0.1f);
|
||||
|
||||
if(items.total() <= itemCapacity - dominantItems && dominantItems > 0 && consValid()){
|
||||
warmup = Mathf.approachDelta(warmup, progress / drillTime, 0.01f);
|
||||
|
||||
float speed = efficiency();
|
||||
|
||||
timeDrilled += speed;
|
||||
timeDrilled += speedCurve.apply(progress / drillTime) * speed;
|
||||
|
||||
lastDrillSpeed = dominantItems / drillTime * speed;
|
||||
progress += delta() * dominantItems * speed;
|
||||
lastDrillSpeed = 1f / drillTime * speed;
|
||||
progress += delta() * speed;
|
||||
}else{
|
||||
warmup = Mathf.approachDelta(warmup, 0f, 0.01f);
|
||||
lastDrillSpeed = 0f;
|
||||
return;
|
||||
}
|
||||
|
||||
if(dominantItems > 0 && progress >= drillTime && items.total() < itemCapacity){
|
||||
for(int i = 0; i < outputAmount; i++){
|
||||
for(int i = 0; i < dominantItems; i++){
|
||||
offload(dominantItem);
|
||||
}
|
||||
|
||||
invertTime = 1f;
|
||||
Effect.shake(shake, shake, this);
|
||||
progress %= drillTime;
|
||||
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConsume(){
|
||||
return items.total() <= itemCapacity - dominantItems && enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
@@ -65,8 +101,51 @@ public class BurstDrill extends Drill{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed);
|
||||
/*
|
||||
Draw.blend(Blending.additive);
|
||||
for(int i = 0; i < plasmaRegions.length; i++){
|
||||
float r = size * tilesize - 3f + Mathf.absin(timeDrilled, 2f + i * 1f, 5f - i * 0.5f);
|
||||
|
||||
Draw.color(plasma1, plasma2, (float)i / plasmaRegions.length);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time, 2f + i * 2f, 0.3f + i * 0.05f)) * Interp.pow4In.apply(warmup));
|
||||
Draw.rect(plasmaRegions[i], x, y, r, r, timeDrilled * 3f * (12 + i * 2f));
|
||||
}
|
||||
Draw.blend();
|
||||
Draw.color();*/
|
||||
|
||||
//Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed);
|
||||
Draw.rect(topRegion, x, y);
|
||||
if(invertTime > 0){
|
||||
Draw.alpha(Interp.pow3Out.apply(invertTime));
|
||||
Draw.rect(topInvertRegion, x, y);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
float z = Draw.z();
|
||||
|
||||
float fract = smoothProgress;
|
||||
int arrows = 3;
|
||||
Draw.color(arrowColor);
|
||||
for(int i = 0; i < 4; i++){
|
||||
for(int j = 0; j < arrows; j++){
|
||||
float arrowFract = (arrows - 1 - j);
|
||||
float a = Mathf.clamp(fract * arrows - arrowFract);
|
||||
Tmp.v1.trns(i * 90 + 45, j * arrowSpacing);
|
||||
|
||||
Draw.z(z);
|
||||
Draw.color(Color.valueOf("6e7080"), arrowColor, a);
|
||||
Draw.rect(arrowRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90);
|
||||
|
||||
Draw.color(arrowColor);
|
||||
|
||||
Draw.z(z + 0.001f);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.alpha(Mathf.pow(a, 10f));
|
||||
Draw.rect(arrowBlurRegion, x + Tmp.v1.x, y + Tmp.v1.y, i * 90);
|
||||
Draw.blend();
|
||||
}
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user