I have spent far too much time redrawing this stupid sprite
This commit is contained in:
@@ -17,7 +17,6 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
public LaserTurret(String name){
|
||||
super(name);
|
||||
canOverdrive = false;
|
||||
|
||||
consumes.add(new ConsumeCoolant(0.01f)).update(false);
|
||||
coolantMultiplier = 1f;
|
||||
@@ -25,7 +24,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
consumes.powerCond(powerUse, entity -> ((LaserTurretBuild)entity).bullet != null || ((LaserTurretBuild)entity).target != null);
|
||||
consumes.powerCond(powerUse, (LaserTurretBuild entity) -> entity.bullet != null || entity.target != null);
|
||||
super.init();
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ public class LaserTurret extends PowerTurret{
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
bullet.time(0f);
|
||||
bullet.time = 0f;
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
bulletLife -= Time.delta / Math.max(efficiency(), 0.00001f);
|
||||
@@ -66,7 +65,7 @@ public class LaserTurret extends PowerTurret{
|
||||
Liquid liquid = liquids.current();
|
||||
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
|
||||
|
||||
float used = (cheating() ? maxUsed : Math.min(liquids.get(liquid), maxUsed)) * Time.delta;
|
||||
float used = (cheating() ? maxUsed : Math.min(liquids.get(liquid), maxUsed)) * delta();
|
||||
reload -= used * liquid.heatCapacity * coolantMultiplier;
|
||||
liquids.remove(liquid, used);
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.Interp.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
/** Not standalone. */
|
||||
public class DrawParticlesIn extends DrawBlock{
|
||||
public Color color = Color.valueOf("f2d585");
|
||||
|
||||
public float alpha = 0.5f;
|
||||
public int particles = 30;
|
||||
public float particleLife = 70f, particleRad = 7f, particleSize = 3f, fadeMargin = 0.4f, rotateScl = 3f;
|
||||
public Interp particleInterp = new PowIn(1.5f);
|
||||
public Interp particleSizeInterp = Interp.slope;
|
||||
public Blending blending = Blending.normal;
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
|
||||
if(build.warmup() > 0f){
|
||||
|
||||
float a = alpha * build.warmup();
|
||||
Draw.blend(blending);
|
||||
Draw.color(color);
|
||||
|
||||
float base = (Time.time / particleLife);
|
||||
rand.setSeed(build.id);
|
||||
for(int i = 0; i < particles; i++){
|
||||
float fin = (rand.random(1f) + base) % 1f, fout = 1f - fin;
|
||||
float angle = rand.random(360f) + (Time.time / rotateScl) % 360f;
|
||||
float len = particleRad * particleInterp.apply(fout);
|
||||
Draw.alpha(a * (1f - Mathf.curve(fin, 1f - fadeMargin)));
|
||||
Fill.circle(
|
||||
build.x + Angles.trnsx(angle, len),
|
||||
build.y + Angles.trnsy(angle, len),
|
||||
particleSize * particleSizeInterp.apply(fin) * build.warmup()
|
||||
);
|
||||
}
|
||||
|
||||
Draw.blend();
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user