Cyanogen synthesis retexture
This commit is contained in:
@@ -23,6 +23,9 @@ import static mindustry.Vars.*;
|
||||
import static mindustry.type.Liquid.*;
|
||||
|
||||
public class Conduit extends LiquidBlock implements Autotiler{
|
||||
static final float rotatePad = 6, hpad = rotatePad / 2f / 4f;
|
||||
static final float[][] rotateOffsets = {{hpad, hpad}, {-hpad, hpad}, {-hpad, -hpad}, {hpad, -hpad}};
|
||||
|
||||
public final int timerFlow = timers++;
|
||||
|
||||
public Color botColor = Color.valueOf("565656");
|
||||
@@ -31,8 +34,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
public @Load(value = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions;
|
||||
public @Load("@-cap") TextureRegion capRegion;
|
||||
|
||||
public @Load(value = "conduit-liquid-r#1-gas-#2", lengths = {4, animationFrames}) TextureRegion[][] rotateGasRegions;
|
||||
public @Load(value = "conduit-liquid-r#1-liquid-#2", lengths = {4, animationFrames}) TextureRegion[][] rotateLiquidRegions;
|
||||
/** indices: [rotation] [fluid type] [frame] */
|
||||
public TextureRegion[][][] rotateRegions;
|
||||
|
||||
public boolean leaks = true;
|
||||
public @Nullable Block junctionReplacement, bridgeReplacement, rotBridgeReplacement;
|
||||
@@ -55,6 +58,44 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
if(bridgeReplacement == null || !(bridgeReplacement instanceof ItemBridge)) bridgeReplacement = Blocks.bridgeConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
rotateRegions = new TextureRegion[4][2][animationFrames];
|
||||
|
||||
if(renderer != null){
|
||||
float pad = rotatePad;
|
||||
var frames = renderer.getFluidFrames();
|
||||
|
||||
for(int rot = 0; rot < 4; rot++){
|
||||
for(int fluid = 0; fluid < 2; fluid++){
|
||||
for(int frame = 0; frame < animationFrames; frame++){
|
||||
TextureRegion base = frames[fluid][frame];
|
||||
TextureRegion result = new TextureRegion();
|
||||
result.set(base);
|
||||
|
||||
if(rot == 0){
|
||||
result.setX(result.getX() + pad);
|
||||
result.setHeight(result.height - pad);
|
||||
}else if(rot == 1){
|
||||
result.setWidth(result.width - pad);
|
||||
result.setHeight(result.height - pad);
|
||||
}else if(rot == 2){
|
||||
result.setWidth(result.width - pad);
|
||||
result.setY(result.getY() + pad);
|
||||
}else{
|
||||
result.setX(result.getX() + pad);
|
||||
result.setY(result.getY() + pad);
|
||||
}
|
||||
|
||||
rotateRegions[rot][fluid][frame] = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
int[] bits = getTiling(plan, list);
|
||||
@@ -138,17 +179,21 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
|
||||
int offset = yscl == -1 ? 3 : 0;
|
||||
|
||||
//TODO move out of conduit
|
||||
int frame = liquids.current().getAnimationFrame();
|
||||
TextureRegion liquidr =
|
||||
liquids.current().gas ?
|
||||
(bits == 1 ? rotateGasRegions[(rotation + offset) % 4][frame] : renderer.fluidFrames[1][frame]) :
|
||||
(bits == 1 ? rotateLiquidRegions[(rotation + offset) % 4][frame] : renderer.fluidFrames[0][frame]);
|
||||
int gas = liquids.current().gas ? 1 : 0;
|
||||
float ox = 0f, oy = 0f;
|
||||
int wrapRot = (rotation + offset) % 4;
|
||||
TextureRegion liquidr = bits == 1 ? rotateRegions[wrapRot][gas][frame] : renderer.fluidFrames[gas][frame];
|
||||
|
||||
if(bits == 1){
|
||||
ox = rotateOffsets[wrapRot][0];
|
||||
oy = rotateOffsets[wrapRot][1];
|
||||
}
|
||||
|
||||
//the drawing state machine sure was a great design choice with no downsides or hidden behavior!!!
|
||||
float xscl = Draw.xscl, yscl = Draw.yscl;
|
||||
Draw.scl(1f, 1f);
|
||||
Drawf.liquid(sliced(liquidr, slice), x, y, smoothLiquid, liquids.current().color.write(Tmp.c1).a(1f));
|
||||
Drawf.liquid(sliced(liquidr, slice), x + ox, y + oy, smoothLiquid, liquids.current().color.write(Tmp.c1).a(1f));
|
||||
Draw.scl(xscl, yscl);
|
||||
|
||||
Draw.rect(sliced(topRegions[bits], slice), x, y, angle);
|
||||
|
||||
@@ -50,6 +50,8 @@ public class LiquidBlock extends Block{
|
||||
float squishX = rightBorder + tilesize/2f - bounds, squishY = topBorder + tilesize/2f - bounds;
|
||||
float ox = 0f, oy = 0f;
|
||||
|
||||
if(squishX >= 8 || squishY >= 8) continue;
|
||||
|
||||
//cut out the parts that don't fit inside the padding
|
||||
if(squishX > 0){
|
||||
toDraw.setWidth(toDraw.width - squishX * 4f);
|
||||
|
||||
@@ -29,6 +29,8 @@ public class GenericCrafter extends Block{
|
||||
/** Liquid output directions, specified in the same order as outputLiquids. Use -1 to dump in every direction. Rotations are relative to block. */
|
||||
public int[] liquidOutputDirections = {-1};
|
||||
|
||||
/** if true, crafters with multiple liquid outputs will dump excess when there's still space for at least one liquid type */
|
||||
public boolean dumpExtraLiquid = true;
|
||||
public float craftTime = 80;
|
||||
public Effect craftEffect = Fx.none;
|
||||
public Effect updateEffect = Fx.none;
|
||||
@@ -109,6 +111,10 @@ public class GenericCrafter extends Block{
|
||||
outputLiquid = outputLiquids[0];
|
||||
}
|
||||
outputsLiquid = outputLiquids != null;
|
||||
|
||||
if(outputItems != null) hasItems = true;
|
||||
if(outputLiquids != null) hasLiquids = true;
|
||||
|
||||
super.init();
|
||||
}
|
||||
|
||||
@@ -169,11 +175,22 @@ public class GenericCrafter extends Block{
|
||||
}
|
||||
}
|
||||
if(outputLiquids != null){
|
||||
boolean allFull = true;
|
||||
for(var output : outputLiquids){
|
||||
if(liquids.get(output.liquid) >= liquidCapacity - 0.001f){
|
||||
return false;
|
||||
if(!dumpExtraLiquid){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
//if there's still space left, it's not full for all liquids
|
||||
allFull = false;
|
||||
}
|
||||
}
|
||||
|
||||
//if there is no space left for any liquid, it can't reproduce
|
||||
if(allFull){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
|
||||
@@ -29,16 +29,9 @@ public class HeatCrafter extends GenericCrafter{
|
||||
|
||||
bars.add("heat", (HeatCrafterBuild entity) ->
|
||||
new Bar(() ->
|
||||
Core.bundle.format("bar.heatpercent", (int)entity.heat),
|
||||
Core.bundle.format("bar.heatpercent", (int)entity.heat, (int)(entity.efficiencyScale() * 100)),
|
||||
() -> Pal.lightOrange,
|
||||
() -> entity.heat / heatRequirement));
|
||||
|
||||
//TODO unnecessary?
|
||||
bars.add("efficiency", (HeatCrafterBuild entity) ->
|
||||
new Bar(() ->
|
||||
Core.bundle.format("bar.efficiency", (int)(entity.efficiencyScale() * 100)),
|
||||
() -> Pal.ammo,
|
||||
entity::efficiencyScale));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user