This commit is contained in:
Anuken
2021-06-10 18:51:49 -04:00
parent 35be671d86
commit 9e8e0709b5
27 changed files with 131 additions and 109 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ jobs:
git clone --depth=1 --branch=master https://github.com/Anuken/MindustryBuilds ../MindustryBuilds git clone --depth=1 --branch=master https://github.com/Anuken/MindustryBuilds ../MindustryBuilds
cd ../MindustryBuilds cd ../MindustryBuilds
echo "Updating version to ${RELEASE_VERSION:1}" echo "Updating version to ${RELEASE_VERSION:1}"
echo versionName=6-fdroid-${RELEASE_VERSION:1}$'\n'versionCode=${RELEASE_VERSION:1} > version_fdroid.txt echo versionName=6-fdroid-${RELEASE_VERSION:1}$'\n'versionCode=${GITHUB_RUN_NUMBER} > version_fdroid.txt
git add . git add .
git commit -m "Updating to build ${RELEASE_VERSION:1}" git commit -m "Updating to build ${RELEASE_VERSION:1}"
git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds
Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 114 B

+13 -16
View File
@@ -494,24 +494,20 @@ public class Blocks implements ContentList{
wall = sporeWall; wall = sporeWall;
}}; }};
metalFloor = new MetalFloor("metal-floor"){{ metalFloor = new Floor("metal-floor", 0);
variants = 0; metalFloorDamaged = new Floor("metal-floor-damaged", 3);
attributes.set(Attribute.water, -1f);
}};
metalFloorDamaged = new MetalFloor("metal-floor-damaged", 3); metalFloor2 = new Floor("metal-floor-2", 0);
metalFloor3 = new Floor("metal-floor-3", 0);
metalFloor4 = new Floor("metal-floor-4", 0);
metalFloor5 = new Floor("metal-floor-5", 0);
metalFloor2 = new MetalFloor("metal-floor-2"); darkPanel1 = new Floor("dark-panel-1", 0);
metalFloor3 = new MetalFloor("metal-floor-3"); darkPanel2 = new Floor("dark-panel-2", 0);
metalFloor4 = new MetalFloor("metal-floor-4"); darkPanel3 = new Floor("dark-panel-3", 0);
metalFloor5 = new MetalFloor("metal-floor-5"); darkPanel4 = new Floor("dark-panel-4", 0);
darkPanel5 = new Floor("dark-panel-5", 0);
darkPanel1 = new MetalFloor("dark-panel-1"); darkPanel6 = new Floor("dark-panel-6", 0);
darkPanel2 = new MetalFloor("dark-panel-2");
darkPanel3 = new MetalFloor("dark-panel-3");
darkPanel4 = new MetalFloor("dark-panel-4");
darkPanel5 = new MetalFloor("dark-panel-5");
darkPanel6 = new MetalFloor("dark-panel-6");
darkMetal = new StaticWall("dark-metal"); darkMetal = new StaticWall("dark-metal");
@@ -757,6 +753,7 @@ public class Blocks implements ContentList{
outputLiquid = new LiquidStack(Liquids.slag, 2f); outputLiquid = new LiquidStack(Liquids.slag, 2f);
craftTime = 10f; craftTime = 10f;
hasLiquids = hasPower = true; hasLiquids = hasPower = true;
drawer = new DrawLiquid();
consumes.power(1f); consumes.power(1f);
consumes.item(Items.scrap, 1); consumes.item(Items.scrap, 1);
+10 -3
View File
@@ -18,6 +18,7 @@ public class MapRenderer implements Disposable{
private IndexedRenderer[][] chunks; private IndexedRenderer[][] chunks;
private IntSet updates = new IntSet(); private IntSet updates = new IntSet();
private IntSet delayedUpdates = new IntSet(); private IntSet delayedUpdates = new IntSet();
private TextureRegion clearEditor;
private int width, height; private int width, height;
public void resize(int width, int height){ public void resize(int width, int height){
@@ -45,6 +46,7 @@ public class MapRenderer implements Disposable{
public void draw(float tx, float ty, float tw, float th){ public void draw(float tx, float ty, float tw, float th){
Draw.flush(); Draw.flush();
clearEditor = Core.atlas.find("clear-editor");
updates.each(i -> render(i % width, i / width)); updates.each(i -> render(i % width, i / width));
updates.clear(); updates.clear();
@@ -80,6 +82,7 @@ public class MapRenderer implements Disposable{
} }
public void updateAll(){ public void updateAll(){
clearEditor = Core.atlas.find("clear-editor");
for(int x = 0; x < width; x++){ for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){ for(int y = 0; y < height; y++){
render(x, y); render(x, y);
@@ -103,7 +106,7 @@ public class MapRenderer implements Disposable{
boolean center = tile.isCenter(); boolean center = tile.isCenter();
if(wall != Blocks.air && wall.synthetic()){ if(wall != Blocks.air && wall.synthetic()){
region = !Core.atlas.isFound(wall.editorIcon()) || !center ? Core.atlas.find("clear-editor") : wall.editorIcon(); region = !wall.editorIcon().found() || !center ? clearEditor : wall.editorIcon();
float width = region.width * Draw.scl, height = region.height * Draw.scl; float width = region.width * Draw.scl, height = region.height * Draw.scl;
@@ -124,13 +127,17 @@ public class MapRenderer implements Disposable{
mesh.setColor(team.color); mesh.setColor(team.color);
region = Core.atlas.find("block-border-editor"); region = Core.atlas.find("block-border-editor");
}else if(!wall.synthetic() && wall != Blocks.air && center){ }else if(!wall.synthetic() && wall != Blocks.air && center){
region = !Core.atlas.isFound(wall.editorIcon()) ? Core.atlas.find("clear-editor") : wall.editorIcon(); region = !wall.editorIcon().found() ?
clearEditor : wall.variants > 0 ?
wall.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, wall.editorVariantRegions().length - 1)] :
wall.editorIcon();
offsetX = tilesize / 2f - region.width / 2f * Draw.scl; offsetX = tilesize / 2f - region.width / 2f * Draw.scl;
offsetY = tilesize / 2f - region.height / 2f * Draw.scl; offsetY = tilesize / 2f - region.height / 2f * Draw.scl;
}else if(wall == Blocks.air && !tile.overlay().isAir()){ }else if(wall == Blocks.air && !tile.overlay().isAir()){
region = tile.overlay().editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)]; region = tile.overlay().editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)];
}else{ }else{
region = Core.atlas.find("clear-editor"); region = clearEditor;
} }
float width = region.width * Draw.scl, height = region.height * Draw.scl; float width = region.width * Draw.scl, height = region.height * Draw.scl;
@@ -907,7 +907,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
public void draw(){ public void draw(){
Draw.rect(block.region, x, y, block.rotate ? rotdeg() : 0); if(block.variants == 0){
Draw.rect(block.region, x, y, block.rotate ? rotdeg() : 0);
}else{
Draw.rect(block.variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, block.variantRegions.length - 1))], x, y, block.rotate ? rotdeg() : 0);
}
drawTeamTop(); drawTeamTop();
} }
@@ -149,7 +149,7 @@ public class PlanetRenderer implements Disposable{
public void renderTransparent(Planet planet){ public void renderTransparent(Planet planet){
if(!planet.visible()) return; if(!planet.visible()) return;
if(planet.isLandable() && planet == this.planet){ if(planet.hasGrid() && planet == this.planet){
renderSectors(planet); renderSectors(planet);
} }
@@ -707,6 +707,11 @@ public class ContentParser{
node.objectives.addAll(parser.readValue(Objective[].class, research.get("objectives"))); node.objectives.addAll(parser.readValue(Objective[].class, research.get("objectives")));
} }
//all items have a produce requirement unless already specified
if(object instanceof Item i && !node.objectives.contains(o -> o instanceof Produce p && p.content == i)){
node.objectives.add(new Produce(i));
}
//remove old node from parent //remove old node from parent
if(node.parent != null){ if(node.parent != null){
node.parent.children.remove(node); node.parent.children.remove(node);
+2 -1
View File
@@ -127,7 +127,8 @@ public class Planet extends UnlockableContent{
sectors.get(index).preset = preset; sectors.get(index).preset = preset;
} }
public boolean isLandable(){ /** @return whether this planet has a sector grid to select. */
public boolean hasGrid(){
return grid != null && generator != null && sectors.size > 0; return grid != null && generator != null && sectors.size > 0;
} }
@@ -5,7 +5,6 @@ import mindustry.core.GameState.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -31,7 +30,7 @@ public class GameOverDialog extends BaseDialog{
} }
void rebuild(){ void rebuild(){
title.setText(state.isCampaign() ? "@sector.curlost" : "@gameover"); title.setText(state.isCampaign() ? Core.bundle.format("sector.lost", state.getSector().name()) : "@gameover");
buttons.clear(); buttons.clear();
cont.clear(); cont.clear();
@@ -593,7 +593,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
} }
if(planets.planet.isLandable()){ if(planets.planet.hasGrid()){
hovered = planets.planet.getSector(planets.cam.getMouseRay(), PlanetRenderer.outlineRad); hovered = planets.planet.getSector(planets.cam.getMouseRay(), PlanetRenderer.outlineRad);
}else{ }else{
hovered = selected = null; hovered = selected = null;
@@ -322,7 +322,7 @@ public class HudFragment extends Fragment{
} }
return max == 0f ? 0f : val / max; return max == 0f ? 0f : val / max;
}).blink(Color.white).outline(new Color(0, 0, 0, 0.6f), 7f)).grow()) }).blink(Color.white).outline(new Color(0, 0, 0, 0.6f), 7f)).grow())
.fillX().width(320f).height(60f).name("boss").visible(() -> state.rules.waves && state.boss() != null).padTop(7).row(); .fillX().width(320f).height(60f).name("boss").visible(() -> state.rules.waves && state.boss() != null && !(mobile && Core.graphics.isPortrait())).padTop(7).row();
t.table(Styles.black3, p -> p.margin(4).label(() -> hudText).style(Styles.outlineLabel)).touchable(Touchable.disabled).with(p -> p.visible(() -> { t.table(Styles.black3, p -> p.margin(4).label(() -> hudText).style(Styles.outlineLabel)).touchable(Touchable.disabled).with(p -> p.visible(() -> {
p.color.a = Mathf.lerpDelta(p.color.a, Mathf.num(showHudText), 0.2f); p.color.a = Mathf.lerpDelta(p.color.a, Mathf.num(showHudText), 0.2f);
+28 -4
View File
@@ -46,6 +46,7 @@ public class Block extends UnlockableContent{
public boolean outputsPayload = false; public boolean outputsPayload = false;
public boolean acceptsPayload = false; public boolean acceptsPayload = false;
public boolean outputFacing = true; public boolean outputFacing = true;
public boolean noSideBlend = false;
public boolean acceptsItems = false; public boolean acceptsItems = false;
public int itemCapacity = 10; public int itemCapacity = 10;
@@ -77,6 +78,8 @@ public class Block extends UnlockableContent{
public boolean solidifes; public boolean solidifes;
/** whether this is rotateable */ /** whether this is rotateable */
public boolean rotate; public boolean rotate;
/** number of different variant regions to use */
public int variants = 0;
/** whether to draw a rotation arrow - this does not apply to lines of blocks */ /** whether to draw a rotation arrow - this does not apply to lines of blocks */
public boolean drawArrow = true; public boolean drawArrow = true;
/** for static blocks only: if true, tile data() is saved in world data. */ /** for static blocks only: if true, tile data() is saved in world data. */
@@ -239,11 +242,11 @@ public class Block extends UnlockableContent{
public ObjectMap<Class<?>, Cons2> configurations = new ObjectMap<>(); public ObjectMap<Class<?>, Cons2> configurations = new ObjectMap<>();
protected TextureRegion[] generatedIcons; protected TextureRegion[] generatedIcons;
protected TextureRegion[] variantRegions, editorVariantRegions; protected TextureRegion[] editorVariantRegions;
public TextureRegion region, editorIcon; public TextureRegion region, editorIcon;
public @Load("@-team") TextureRegion teamRegion; public @Load("@-team") TextureRegion teamRegion;
public TextureRegion[] teamRegions; public TextureRegion[] teamRegions, variantRegions;
protected static final Seq<Tile> tempTiles = new Seq<>(); protected static final Seq<Tile> tempTiles = new Seq<>();
protected static final Seq<Building> tempTileEnts = new Seq<>(); protected static final Seq<Building> tempTileEnts = new Seq<>();
@@ -263,7 +266,11 @@ public class Block extends UnlockableContent{
if(tile.build != null){ if(tile.build != null){
tile.build.draw(); tile.build.draw();
}else{ }else{
Draw.rect(region, tile.drawx(), tile.drawy()); if(variants == 0){
Draw.rect(region, tile.drawx(), tile.drawy());
}else{
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.drawx(), tile.drawy());
}
} }
} }
@@ -587,7 +594,8 @@ public class Block extends UnlockableContent{
protected TextureRegion[] icons(){ protected TextureRegion[] icons(){
//use team region in vanilla team blocks //use team region in vanilla team blocks
return teamRegion.found() && minfo.mod == null ? new TextureRegion[]{region, teamRegions[Team.sharded.id]} : new TextureRegion[]{region}; TextureRegion r = variants > 0 ? Core.atlas.find(name + "1") : region;
return teamRegion.found() && minfo.mod == null ? new TextureRegion[]{r, teamRegions[Team.sharded.id]} : new TextureRegion[]{r};
} }
public TextureRegion[] getGeneratedIcons(){ public TextureRegion[] getGeneratedIcons(){
@@ -830,6 +838,15 @@ public class Block extends UnlockableContent{
for(Team team : Team.all){ for(Team team : Team.all){
teamRegions[team.id] = teamRegion.found() ? Core.atlas.find(name + "-team-" + team.name, teamRegion) : teamRegion; teamRegions[team.id] = teamRegion.found() ? Core.atlas.find(name + "-team-" + team.name, teamRegion) : teamRegion;
} }
if(variants != 0){
variantRegions = new TextureRegion[variants];
for(int i = 0; i < variants; i++){
variantRegions[i] = Core.atlas.find(name + (i + 1));
}
region = variantRegions[0];
}
} }
@Override @Override
@@ -846,6 +863,13 @@ public class Block extends UnlockableContent{
mapColor.set(image.get(image.width/2, image.height/2)); mapColor.set(image.get(image.width/2, image.height/2));
} }
if(variants > 0){
for(int i = 0; i < variants; i++){
String rname = name + (i + 1);
packer.add(PageType.editor, "editor-" + rname, Core.atlas.getPixmap(rname));
}
}
Pixmap last = null; Pixmap last = null;
var gen = icons(); var gen = icons();
@@ -15,8 +15,6 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class Wall extends Block{ public class Wall extends Block{
public int variants = 0;
/** Lighting chance. -1 to disable */ /** Lighting chance. -1 to disable */
public float lightningChance = -1f; public float lightningChance = -1f;
public float lightningDamage = 20f; public float lightningDamage = 20f;
@@ -51,20 +49,6 @@ public class Wall extends Block{
} }
} }
@Override
public void load(){
super.load();
if(variants != 0){
variantRegions = new TextureRegion[variants];
for(int i = 0; i < variants; i++){
variantRegions[i] = Core.atlas.find(name + (i + 1));
}
region = variantRegions[0];
}
}
@Override @Override
public TextureRegion[] icons(){ public TextureRegion[] icons(){
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")}; return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
@@ -75,11 +59,7 @@ public class Wall extends Block{
@Override @Override
public void draw(){ public void draw(){
if(variants == 0){ super.draw();
Draw.rect(region, x, y);
}else{
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], x, y);
}
//draw flashing white overlay if enabled //draw flashing white overlay if enabled
if(flashHit){ if(flashHit){
@@ -8,6 +8,7 @@ public class ArmoredConveyor extends Conveyor{
public ArmoredConveyor(String name){ public ArmoredConveyor(String name){
super(name); super(name);
noSideBlend = true;
} }
@Override @Override
@@ -38,6 +38,7 @@ public class Duct extends Block implements Autotiler{
itemCapacity = 1; itemCapacity = 1;
noUpdateDisabled = true; noUpdateDisabled = true;
rotate = true; rotate = true;
noSideBlend = true;
envEnabled = Env.space | Env.terrestrial | Env.underwater; envEnabled = Env.space | Env.terrestrial | Env.underwater;
} }
@@ -12,7 +12,6 @@ import mindustry.entities.units.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.*; import mindustry.world.blocks.*;
import mindustry.world.blocks.distribution.Conveyor.*; import mindustry.world.blocks.distribution.Conveyor.*;
@@ -63,7 +62,7 @@ public class StackConveyor extends Block implements Autotiler{
return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock); return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock);
}else if(state == stateUnload){ //router mode }else if(state == stateUnload){ //router mode
return otherblock.acceptsItems && return otherblock.acceptsItems &&
(!(otherblock instanceof ArmoredConveyor) || lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock)) && (!otherblock.noSideBlend || lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock)) &&
(notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) || (notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) ||
(otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) && (otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) &&
!(world.build(otherx, othery) instanceof StackConveyorBuild s && s.state == stateUnload) && !(world.build(otherx, othery) instanceof StackConveyorBuild s && s.state == stateUnload) &&
@@ -20,8 +20,6 @@ import mindustry.world.blocks.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class Floor extends Block{ public class Floor extends Block{
/** number of different variant regions to use */
public int variants = 3;
/** edge fallback, used mainly for ores */ /** edge fallback, used mainly for ores */
public String edge = "stone"; public String edge = "stone";
/** Multiplies unit velocity by this when walked on. */ /** Multiplies unit velocity by this when walked on. */
@@ -76,6 +74,12 @@ public class Floor extends Block{
public Floor(String name){ public Floor(String name){
super(name); super(name);
variants = 3;
}
public Floor(String name, int variants){
super(name);
this.variants = variants;
} }
@Override @Override
@@ -85,7 +89,6 @@ public class Floor extends Block{
//load variant regions for drawing //load variant regions for drawing
if(variants > 0){ if(variants > 0){
variantRegions = new TextureRegion[variants]; variantRegions = new TextureRegion[variants];
for(int i = 0; i < variants; i++){ for(int i = 0; i < variants; i++){
variantRegions[i] = Core.atlas.find(name + (i + 1)); variantRegions[i] = Core.atlas.find(name + (i + 1));
} }
@@ -93,7 +96,6 @@ public class Floor extends Block{
variantRegions = new TextureRegion[1]; variantRegions = new TextureRegion[1];
variantRegions[0] = Core.atlas.find(name); variantRegions[0] = Core.atlas.find(name);
} }
int size = (int)(tilesize / Draw.scl); int size = (int)(tilesize / Draw.scl);
if(Core.atlas.has(name + "-edge")){ if(Core.atlas.has(name + "-edge")){
edges = Core.atlas.find(name + "-edge").split(size, size); edges = Core.atlas.find(name + "-edge").split(size, size);
@@ -130,19 +132,12 @@ public class Floor extends Block{
@Override @Override
public void createIcons(MultiPacker packer){ public void createIcons(MultiPacker packer){
super.createIcons(packer); super.createIcons(packer);
packer.add(PageType.editor, "editor-" + name, Core.atlas.getPixmap(fullIcon).crop()); packer.add(PageType.editor, "editor-" + name, Core.atlas.getPixmap(fullIcon));
if(blendGroup != this){ if(blendGroup != this){
return; return;
} }
if(variants > 0){
for(int i = 0; i < variants; i++){
String rname = name + (i + 1);
packer.add(PageType.editor, "editor-" + rname, Core.atlas.getPixmap(rname).crop());
}
}
PixmapRegion image = Core.atlas.getPixmap(icons()[0]); PixmapRegion image = Core.atlas.getPixmap(icons()[0]);
PixmapRegion edge = Core.atlas.getPixmap("edge-stencil"); PixmapRegion edge = Core.atlas.getPixmap("edge-stencil");
Pixmap result = new Pixmap(edge.width, edge.height); Pixmap result = new Pixmap(edge.width, edge.height);
@@ -1,19 +0,0 @@
package mindustry.world.blocks.environment;
import mindustry.world.meta.*;
/** Class for quickly defining a floor with no water and no variants. Offers no new functionality. */
public class MetalFloor extends Floor{
public MetalFloor(String name){
super(name);
variants = 0;
attributes.set(Attribute.water, -1);
}
public MetalFloor(String name, int variants){
super(name);
this.variants = variants;
attributes.set(Attribute.water, -1);
}
}
@@ -7,8 +7,6 @@ import mindustry.content.*;
import mindustry.world.*; import mindustry.world.*;
public class Prop extends Block{ public class Prop extends Block{
public int variants;
public Prop(String name){ public Prop(String name){
super(name); super(name);
breakable = true; breakable = true;
@@ -28,17 +26,4 @@ public class Prop extends Block{
public TextureRegion[] icons(){ public TextureRegion[] icons(){
return variants == 0 ? super.icons() : new TextureRegion[]{Core.atlas.find(name + "1")}; return variants == 0 ? super.icons() : new TextureRegion[]{Core.atlas.find(name + "1")};
} }
@Override
public void load(){
super.load();
if(variants > 0){
variantRegions = new TextureRegion[variants];
for(int i = 0; i < variants; i++){
variantRegions[i] = Core.atlas.find(name + (i + 1));
}
}
}
} }
@@ -174,6 +174,7 @@ public class LogicBlock extends Block{
public boolean active = true, valid; public boolean active = true, valid;
public int x, y; public int x, y;
public String name; public String name;
Building lastBuild;
public LogicLink(int x, int y, String name, boolean valid){ public LogicLink(int x, int y, String name, boolean valid){
this.x = x; this.x = x;
@@ -405,20 +406,22 @@ public class LogicBlock extends Block{
if(!l.active) continue; if(!l.active) continue;
boolean valid = validLink(world.build(l.x, l.y)); var cur = world.build(l.x, l.y);
if(valid != l.valid){
boolean valid = validLink(cur);
if(valid != l.valid || (l.lastBuild != null && l.lastBuild != cur)){
l.lastBuild = cur;
changed = true; changed = true;
l.valid = valid; l.valid = valid;
if(valid){ if(valid){
Building lbuild = world.build(l.x, l.y);
//this prevents conflicts //this prevents conflicts
l.name = ""; l.name = "";
//finds a new matching name after toggling //finds a new matching name after toggling
l.name = findLinkName(lbuild.block); l.name = findLinkName(cur.block);
//remove redundant links //remove redundant links
links.removeAll(o -> world.build(o.x, o.y) == lbuild && o != l); links.removeAll(o -> world.build(o.x, o.y) == cur && o != l);
//break to prevent concurrent modification //break to prevent concurrent modification
updates = true; updates = true;
@@ -0,0 +1,38 @@
package mindustry.world.draw;
import arc.*;
import arc.graphics.g2d.*;
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.production.*;
import mindustry.world.blocks.production.GenericCrafter.*;
public class DrawLiquid extends DrawBlock{
public TextureRegion liquid, top;
@Override
public void draw(GenericCrafterBuild build){
Draw.rect(build.block.region, build.x, build.y);
GenericCrafter type = (GenericCrafter)build.block;
if(type.outputLiquid != null && build.liquids.get(type.outputLiquid.liquid) > 0){
Drawf.liquid(liquid, build.x, build.y,
build.liquids.get(type.outputLiquid.liquid) / type.liquidCapacity,
type.outputLiquid.liquid.color
);
}
if(top.found()) Draw.rect(top, build.x, build.y);
}
@Override
public void load(Block block){
top = Core.atlas.find(block.name + "-top");
liquid = Core.atlas.find(block.name + "-liquid");
}
@Override
public TextureRegion[] icons(Block block){
return top.found() ? new TextureRegion[]{block.region, top} : new TextureRegion[]{block.region};
}
}
@@ -6,21 +6,23 @@ import mindustry.world.*;
import mindustry.world.blocks.production.GenericCrafter.*; import mindustry.world.blocks.production.GenericCrafter.*;
public class DrawRotator extends DrawBlock{ public class DrawRotator extends DrawBlock{
public TextureRegion rotator; public TextureRegion rotator, top;
@Override @Override
public void draw(GenericCrafterBuild build){ public void draw(GenericCrafterBuild build){
Draw.rect(build.block.region, build.x, build.y); Draw.rect(build.block.region, build.x, build.y);
Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f);
if(top.found()) Draw.rect(top, build.x, build.y);
} }
@Override @Override
public void load(Block block){ public void load(Block block){
rotator = Core.atlas.find(block.name + "-rotator"); rotator = Core.atlas.find(block.name + "-rotator");
top = Core.atlas.find(block.name + "-top");
} }
@Override @Override
public TextureRegion[] icons(Block block){ public TextureRegion[] icons(Block block){
return new TextureRegion[]{block.region, rotator}; return top.found() ? new TextureRegion[]{block.region, rotator, top} : new TextureRegion[]{block.region, rotator};
} }
} }
+1 -1
View File
@@ -101,7 +101,7 @@
}, },
{ {
"name": "Sakura", "name": "Sakura",
"address": ["160.16.207.141"] "address": ["160.16.207.141", "160.16.207.141:21527", "160.16.207.141:31587"]
}, },
{ {
"name": "MeowLand", "name": "MeowLand",
+1 -1
View File
@@ -220,7 +220,7 @@ public class Generators{
TextureRegion[] regions = block.getGeneratedIcons(); TextureRegion[] regions = block.getGeneratedIcons();
if(block instanceof Floor){ if(block.variants > 0){
for(TextureRegion region : block.variantRegions()){ for(TextureRegion region : block.variantRegions()){
GenRegion gen = (GenRegion)region; GenRegion gen = (GenRegion)region;
if(gen.path == null) continue; if(gen.path == null) continue;