Sublimate visuals, damage/length still broken
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-back-heat.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 423 B |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-front-heat.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-front1.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-front2.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-heat.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-liquid.png
Normal file
After Width: | Height: | Size: 232 B |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-nozzle-heat.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-nozzle1.png
Normal file
After Width: | Height: | Size: 542 B |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-nozzle2.png
Normal file
After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
core/assets-raw/sprites/blocks/turrets/sublimate-top.png
Normal file
After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.0 KiB |
@ -458,3 +458,4 @@
|
||||
63248=slag-incinerator|block-slag-incinerator-ui
|
||||
63247=phase-synthesizer|block-phase-synthesizer-ui
|
||||
63246=sublimate|block-sublimate-ui
|
||||
63245=reinforced-container|block-reinforced-container-ui
|
||||
|
@ -2693,13 +2693,31 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35), true);
|
||||
|
||||
draw = new DrawTurret("reinforced-"){{
|
||||
liquidDraw = Liquids.ozone;
|
||||
|
||||
Color heatc = Color.valueOf("fa2859");
|
||||
heatColor = heatc;
|
||||
|
||||
parts.addAll(new RegionPart("-back"){{
|
||||
outline = true;
|
||||
rotMove = 30f;
|
||||
offsetX = 29 / 4f;
|
||||
offsetY = -10f / 4f;
|
||||
originX = -8f / 4f;
|
||||
originY = 8f / 4f;
|
||||
rotMove = 40f;
|
||||
x = 22 / 4f;
|
||||
y = -1f / 4f;
|
||||
moveY = 6f / 4f;
|
||||
under = true;
|
||||
heatColor = heatc;
|
||||
}},
|
||||
new RegionPart("-front"){{
|
||||
rotMove = 40f;
|
||||
x = 20 / 4f;
|
||||
y = 17f / 4f;
|
||||
moveX = 1f;
|
||||
moveY = 1f;
|
||||
under = true;
|
||||
heatColor = heatc;
|
||||
}},
|
||||
new RegionPart("-nozzle"){{
|
||||
moveX = 8f / 4f;
|
||||
heatColor = Color.valueOf("f03b0e");
|
||||
}});
|
||||
}};
|
||||
outlineColor = Pal.darkOutline;
|
||||
@ -2711,7 +2729,7 @@ public class Blocks implements ContentList{
|
||||
shootType = new ContinuousFlameBulletType(){{
|
||||
length = range;
|
||||
}};
|
||||
shootLength = 9f;
|
||||
shootLength = 7f;
|
||||
size = 3;
|
||||
}};
|
||||
|
||||
|
@ -41,6 +41,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
public boolean pierceBuilding;
|
||||
/** Maximum # of pierced objects. */
|
||||
public int pierceCap = -1;
|
||||
/** Life fraction at which this bullet has the best range/damage/etc. Used for lasers and continuous turrets. */
|
||||
public float optimalLifeFract = 0f;
|
||||
/** Z layer to drawn on. */
|
||||
public float layer = Layer.bullet;
|
||||
/** Effect shown on direct hit. */
|
||||
|
@ -14,6 +14,7 @@ public class ContinuousBulletType extends BulletType{
|
||||
{
|
||||
speed = 0f;
|
||||
despawnEffect = Fx.none;
|
||||
shootEffect = Fx.none;
|
||||
lifetime = 16f;
|
||||
impact = true;
|
||||
keepVelocity = false;
|
||||
|
@ -9,13 +9,18 @@ import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
//TODO implement
|
||||
import static arc.graphics.g2d.Draw.*;
|
||||
|
||||
public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
public float fadeTime = 16f;
|
||||
public float lightStroke = 40f;
|
||||
public float width = 3.7f, oscScl = 1.2f, oscMag = 0.02f;
|
||||
public int divisions = 25;
|
||||
|
||||
public boolean drawFlare = true;
|
||||
public Color flareColor = Color.valueOf("e189f5");
|
||||
public float flareWidth = 3f, flareInnerScl = 0.5f, flareLength = 40f, flareInnerLenScl = 0.5f, flareLayer = Layer.bullet - 0.0001f, flareRotSpeed = 1.2f;
|
||||
public boolean rotateFlare = false;
|
||||
|
||||
/** Lengths, widths, ellipse panning, and offsets, all as fractions of the base width and length. Stored as an 'interleaved' array of values: LWPO1 LWPO2 LWPO3... */
|
||||
public float[] lengthWidthPanOffsets = {
|
||||
1.12f, 1.3f, 0.32f, 0f,
|
||||
@ -35,6 +40,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
}
|
||||
|
||||
{
|
||||
optimalLifeFract = 0.5f;
|
||||
length = 120f;
|
||||
hitEffect = Fx.hitBeam;
|
||||
hitSize = 4;
|
||||
@ -46,22 +52,38 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
float realLength = Damage.findLaserLength(b, length);
|
||||
float fout = Mathf.clamp(b.time > b.lifetime - fadeTime ? 1f - (b.time - (lifetime - fadeTime)) / fadeTime : 1f);
|
||||
float baseLen = realLength * fout;
|
||||
float mult = b.fslope();
|
||||
float maxLength = length * mult;
|
||||
float realLength = Damage.findLaserLength(b, maxLength);
|
||||
|
||||
float sin = Mathf.sin(Time.time, oscScl, oscMag);
|
||||
|
||||
for(int i = 0; i < colors.length; i++){
|
||||
Draw.color(colors[i].write(Tmp.c1).mul(0.9f).mul(1f + Mathf.absin(Time.time, 1f, 0.1f)));
|
||||
Drawf.flame(b.x, b.y, divisions, b.rotation(),
|
||||
baseLen * lengthWidthPanOffsets[i * 4] * (1f - sin),
|
||||
width * lengthWidthPanOffsets[i * 4 + 1] * fout * (1f + sin),
|
||||
realLength * lengthWidthPanOffsets[i * 4] * (1f - sin),
|
||||
width * lengthWidthPanOffsets[i * 4 + 1] * mult * (1f + sin),
|
||||
lengthWidthPanOffsets[i * 4 + 2],
|
||||
baseLen * lengthWidthPanOffsets[i * 4 + 3]
|
||||
realLength * lengthWidthPanOffsets[i * 4 + 3]
|
||||
);
|
||||
}
|
||||
|
||||
if(drawFlare){
|
||||
color(flareColor);
|
||||
Draw.z(flareLayer);
|
||||
|
||||
float angle = Time.time * flareRotSpeed + (rotateFlare ? b.rotation() : 0f);
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
Drawf.tri(b.x, b.y, flareWidth, flareLength * (mult + sin), i*90 + 45 + angle);
|
||||
}
|
||||
|
||||
color();
|
||||
for(int i = 0; i < 4; i++){
|
||||
Drawf.tri(b.x, b.y, flareWidth * flareInnerScl, flareLength * flareInnerLenScl * (mult + sin), i*90 + 45 + angle);
|
||||
}
|
||||
}
|
||||
|
||||
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, lightStroke, lightColor, 0.7f);
|
||||
Draw.reset();
|
||||
}
|
||||
|
@ -414,6 +414,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return Time.time;
|
||||
}
|
||||
|
||||
public float progress(){
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public BlockStatus status(){
|
||||
return cons.status();
|
||||
}
|
||||
|
@ -62,6 +62,17 @@ public class Drawf{
|
||||
points.add(Tmp.v1.x + baseX, Tmp.v1.y + baseY);
|
||||
}
|
||||
|
||||
public static void additive(TextureRegion region, Color color, float x, float y, float rotation, float layer){
|
||||
float pz = Draw.z();
|
||||
Draw.z(layer);
|
||||
Draw.color(color);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(region, x, y, rotation);
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
Draw.z(pz);
|
||||
}
|
||||
|
||||
public static void dashLine(Color color, float x, float y, float x2, float y2){
|
||||
int segments = (int)(Math.max(Math.abs(x - x2), Math.abs(y - y2)) / tilesize * 2);
|
||||
Lines.stroke(3f, Pal.gray);
|
||||
|
@ -38,6 +38,9 @@ public class Layer{
|
||||
//turrets
|
||||
turret = 50,
|
||||
|
||||
//special layer for turret additive blending heat stuff
|
||||
turretHeat = 50.1f,
|
||||
|
||||
//ground units
|
||||
groundUnit = 60,
|
||||
|
||||
|
@ -55,19 +55,19 @@ public class ContinuousTurret extends Turret{
|
||||
super.updateTile();
|
||||
|
||||
if(bullet != null){
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
|
||||
if(isShooting()){
|
||||
bullet.time = 0f;
|
||||
}
|
||||
|
||||
//check to see if bullet despawned
|
||||
if(bullet.owner != this || !bullet.isAdded()){
|
||||
if(bullet.owner != this || !bullet.isAdded() || bullet.type == null){
|
||||
bullet = null;
|
||||
}else{
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
|
||||
if(isShooting()){
|
||||
bullet.time = bullet.lifetime * bullet.type.optimalLifeFract * shootWarmup;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,13 @@ import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.consumers.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
/** A turret that fires a continuous beam with a delay between shots. Liquid coolant is required. */
|
||||
/** A turret that fires a continuous beam with a delay between shots. Liquid coolant is required. Yes, this class name is awful. */
|
||||
public class LaserTurret extends PowerTurret{
|
||||
public float firingMoveFract = 0.25f;
|
||||
public float shootDuration = 100f;
|
||||
@ -56,11 +55,15 @@ public class LaserTurret extends PowerTurret{
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
|
||||
if(!bullet.isAdded() || bullet.type == null){
|
||||
bullet = null;
|
||||
}
|
||||
|
||||
if(bulletLife > 0 && bullet != null){
|
||||
wasShooting = true;
|
||||
bullet.rotation(rotation);
|
||||
bullet.set(x + bulletOffset.x, y + bulletOffset.y);
|
||||
bullet.time = 0f;
|
||||
bullet.time = bullet.type.lifetime * bullet.type.optimalLifeFract;
|
||||
heat = 1f;
|
||||
recoil = recoilAmount;
|
||||
bulletLife -= Time.delta / Math.max(efficiency(), 0.00001f);
|
||||
@ -83,10 +86,8 @@ public class LaserTurret extends PowerTurret{
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
//reload reversed for laser turrets
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(1f - reload / reloadTime);
|
||||
return super.sense(sensor);
|
||||
public float progress(){
|
||||
return 1f - Mathf.clamp(reload / reloadTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class Turret extends ReloadTurret{
|
||||
public float ammoEjectBack = 1f;
|
||||
public float inaccuracy = 0f;
|
||||
public float velocityInaccuracy = 0f;
|
||||
public float shootWarmupSpeed = 3f / 60f;
|
||||
public float shootWarmupSpeed = 0.1f;
|
||||
public int shots = 1;
|
||||
public float spread = 4f;
|
||||
public float recoilAmount = 1f;
|
||||
@ -152,7 +152,7 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
draw.getRegionsToOutline(out);
|
||||
draw.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public static abstract class AmmoEntry{
|
||||
@ -233,11 +233,16 @@ public class Turret extends ReloadTurret{
|
||||
case shootX -> World.conv(targetPos.x);
|
||||
case shootY -> World.conv(targetPos.y);
|
||||
case shooting -> isShooting() ? 1 : 0;
|
||||
case progress -> Mathf.clamp(reload / reloadTime);
|
||||
case progress -> progress();
|
||||
default -> super.sense(sensor);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(reload / reloadTime);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
return (isControlled() ? unit.isShooting() : logicControlled() ? logicShooting : target != null);
|
||||
}
|
||||
@ -286,7 +291,7 @@ public class Turret extends ReloadTurret{
|
||||
if(!validateTarget()) target = null;
|
||||
|
||||
//TODO can be lerp instead, that's smoother
|
||||
shootWarmup = Mathf.approachDelta(shootWarmup, isActive() ? 1f : 0f, shootWarmupSpeed);
|
||||
shootWarmup = Mathf.lerpDelta(shootWarmup, isShooting() ? 1f : 0f, shootWarmupSpeed);
|
||||
|
||||
wasShooting = false;
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
drawer.getRegionsToOutline(out);
|
||||
drawer.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public class GenericCrafterBuild extends Building{
|
||||
@ -254,12 +254,17 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.progress) return Mathf.clamp(progress);
|
||||
if(sensor == LAccess.progress) return progress();
|
||||
//attempt to prevent wild total liquid fluctuation, at least for crafters
|
||||
if(sensor == LAccess.totalLiquids && outputLiquid != null) return liquids.get(outputLiquid.liquid);
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float progress(){
|
||||
return Mathf.clamp(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Item item){
|
||||
return itemCapacity;
|
||||
|
@ -23,7 +23,7 @@ public class DrawBlock{
|
||||
@Deprecated
|
||||
public void drawLight(GenericCrafterBuild build){}
|
||||
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
public void getRegionsToOutline(Block block, Seq<TextureRegion> out){
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ public class DrawMulti extends DrawBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
public void getRegionsToOutline(Block block, Seq<TextureRegion> out){
|
||||
for(var draw : drawers){
|
||||
draw.getRegionsToOutline(out);
|
||||
draw.getRegionsToOutline(block, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.blocks.defense.turrets.Turret.*;
|
||||
@ -18,7 +19,9 @@ public class DrawTurret extends DrawBlock{
|
||||
|
||||
public Seq<TurretPart> parts = new Seq<>();
|
||||
public String basePrefix = "";
|
||||
public TextureRegion base, liquid, top, heat, preview;
|
||||
/** Overrides the liquid to draw in the liquid region. */
|
||||
public @Nullable Liquid liquidDraw;
|
||||
public TextureRegion base, liquid, top, heat, preview, outline;
|
||||
|
||||
public DrawTurret(String basePrefix){
|
||||
this.basePrefix = basePrefix;
|
||||
@ -28,10 +31,13 @@ public class DrawTurret extends DrawBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRegionsToOutline(Seq<TextureRegion> out){
|
||||
public void getRegionsToOutline(Block block, Seq<TextureRegion> out){
|
||||
for(var part : parts){
|
||||
part.getOutlines(out);
|
||||
}
|
||||
if(preview.found()){
|
||||
out.add(block.region);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,14 +48,22 @@ public class DrawTurret extends DrawBlock{
|
||||
Draw.rect(base, build.x, build.y);
|
||||
Draw.color();
|
||||
|
||||
Draw.z(Layer.turret);
|
||||
Draw.z(Layer.turret - 0.02f);
|
||||
|
||||
Drawf.shadow(build.block.region, build.x + tb.recoilOffset.x - turret.elevation, build.y + tb.recoilOffset.y - turret.elevation, tb.drawrot());
|
||||
Drawf.shadow(preview, build.x + tb.recoilOffset.x - turret.elevation, build.y + tb.recoilOffset.y - turret.elevation, tb.drawrot());
|
||||
|
||||
Draw.z(Layer.turret);
|
||||
|
||||
drawTurret(turret, tb);
|
||||
drawHeat(turret, tb);
|
||||
|
||||
if(parts.size > 0){
|
||||
if(outline.found()){
|
||||
Draw.z(Layer.turret - 0.01f);
|
||||
Draw.rect(outline, build.x + tb.recoilOffset.x, build.y + tb.recoilOffset.y, tb.drawrot());
|
||||
Draw.z(Layer.turret);
|
||||
}
|
||||
|
||||
for(var part : parts){
|
||||
part.draw(tb);
|
||||
}
|
||||
@ -60,7 +74,8 @@ public class DrawTurret extends DrawBlock{
|
||||
Draw.rect(block.region, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot());
|
||||
|
||||
if(liquid.found()){
|
||||
Drawf.liquid(liquid, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.liquids.currentAmount() / block.liquidCapacity, build.liquids.current().color, build.drawrot());
|
||||
Liquid toDraw = liquidDraw == null ? build.liquids.current() : liquidDraw;
|
||||
Drawf.liquid(liquid, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.liquids.get(toDraw) / block.liquidCapacity, toDraw.color.write(Tmp.c1).a(1f), build.drawrot());
|
||||
}
|
||||
|
||||
if(top.found()){
|
||||
@ -71,11 +86,7 @@ public class DrawTurret extends DrawBlock{
|
||||
public void drawHeat(Turret block, TurretBuild build){
|
||||
if(build.heat <= 0.00001f || !heat.found()) return;
|
||||
|
||||
Draw.color(block.heatColor, build.heat);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(heat, build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot());
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
Drawf.additive(heat, block.heatColor.write(Tmp.c1).a(build.heat), build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot(), Layer.turretHeat);
|
||||
}
|
||||
|
||||
/** Load any relevant texture regions. */
|
||||
@ -84,6 +95,7 @@ public class DrawTurret extends DrawBlock{
|
||||
if(!(block instanceof Turret)) throw new ClassCastException("This drawer can only be used on turrets.");
|
||||
|
||||
preview = Core.atlas.find(block.name + "-preview", block.region);
|
||||
outline = Core.atlas.find(block.name + "-outline");
|
||||
liquid = Core.atlas.find(block.name + "-liquid");
|
||||
top = Core.atlas.find(block.name + "-top");
|
||||
heat = Core.atlas.find(block.name + "-heat");
|
||||
@ -107,16 +119,25 @@ public class DrawTurret extends DrawBlock{
|
||||
|
||||
public static class RegionPart extends TurretPart{
|
||||
public String suffix = "";
|
||||
public boolean mirror = true;
|
||||
public TextureRegion heat;
|
||||
public TextureRegion[] regions;
|
||||
public TextureRegion[] outlines;
|
||||
|
||||
public boolean outline = false;
|
||||
/** If true, turret reload is used as the measure of progress. Otherwise, warmup is used. */
|
||||
public boolean useReload = false;
|
||||
/** 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;
|
||||
public float layer = -1;
|
||||
public float outlineLayerOffset = -0.01f;
|
||||
public float rotation, rotMove;
|
||||
public float originX, originY;
|
||||
public float offsetX, offsetY, offsetMoveX, offsetMoveY;
|
||||
public float x, y, moveX, moveY;
|
||||
public float oscMag = 0f, oscScl = 7f;
|
||||
public boolean oscAbs = false;
|
||||
public Color heatColor = Pal.turretHeat.cpy();
|
||||
|
||||
public RegionPart(String region){
|
||||
this.suffix = region;
|
||||
@ -133,32 +154,38 @@ public class DrawTurret extends DrawBlock{
|
||||
}
|
||||
float prevZ = layer > 0 ? layer : z;
|
||||
|
||||
float progress = build.warmup();
|
||||
float progress = useReload ? build.progress() : build.warmup();
|
||||
if(oscMag > 0){
|
||||
progress += oscAbs ? Mathf.absin(oscScl, oscMag) : Mathf.sin(oscScl, oscMag);
|
||||
}
|
||||
|
||||
for(int i = 0; i < regions.length; i++){
|
||||
var region = regions[i];
|
||||
float sign = i == 1 ? -1 : 1;
|
||||
Tmp.v1.set((offsetX + offsetMoveX * progress) * sign, offsetY + offsetMoveY*progress).rotate(build.rotation - 90);
|
||||
Tmp.v1.set((x + moveX * progress) * sign, y + moveY * progress).rotate((build.rotation - 90));
|
||||
|
||||
float
|
||||
x = build.x + Tmp.v1.x,
|
||||
y = build.y + Tmp.v1.y,
|
||||
rot = (i == 0 ? rotation : 180f - rotation) + rotMove * progress * sign + build.rotation,
|
||||
ox = originX + region.width * Draw.scl/2f, oy = originY + region.height * Draw.scl/2f;
|
||||
rx = build.x + Tmp.v1.x + build.recoilOffset.x,
|
||||
ry = build.y + Tmp.v1.y + build.recoilOffset.y,
|
||||
rot = i * sign + rotMove * progress * sign + build.rotation - 90;
|
||||
|
||||
Draw.xscl = i == 0 ? 1 : -1;
|
||||
|
||||
if(outline){
|
||||
Draw.z(prevZ + outlineLayerOffset);
|
||||
|
||||
Draw.rect(outlines[i],
|
||||
x, y, region.width * Draw.scl, region.height * Draw.scl,
|
||||
ox, oy, rot);
|
||||
|
||||
Draw.rect(outlines[i], rx, ry, rot);
|
||||
Draw.z(prevZ);
|
||||
}
|
||||
|
||||
Draw.rect(region,
|
||||
x, y, region.width * Draw.scl, region.height * Draw.scl,
|
||||
ox, oy, rot);
|
||||
if(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);
|
||||
}
|
||||
|
||||
Draw.xscl = 1f;
|
||||
}
|
||||
|
||||
Draw.z(z);
|
||||
@ -166,6 +193,8 @@ public class DrawTurret extends DrawBlock{
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
if(under) layer = Layer.turret - 0.0001f;
|
||||
|
||||
if(mirror){
|
||||
regions = new TextureRegion[]{
|
||||
Core.atlas.find(block.name + suffix + "1"),
|
||||
@ -180,6 +209,8 @@ public class DrawTurret extends DrawBlock{
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,4 +24,4 @@ android.useAndroidX=true
|
||||
#used for slow jitpack builds; TODO see if this actually works
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
archash=f106eee2
|
||||
archash=916c5a77
|
||||
|
@ -288,7 +288,8 @@ public class Generators{
|
||||
|
||||
region.path.delete();
|
||||
|
||||
save(out, block.name);
|
||||
//
|
||||
save(out, region.name);
|
||||
}
|
||||
|
||||
if(!regions[0].found()){
|
||||
|