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