diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index f3e83da601..29dad558e5 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -47,7 +47,7 @@ jobs: git clone --depth=1 --branch=master https://github.com/Anuken/MindustryBuilds ../MindustryBuilds cd ../MindustryBuilds 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 commit -m "Updating to build ${RELEASE_VERSION:1}" git push https://Anuken:${{ secrets.API_TOKEN_GITHUB }}@github.com/Anuken/MindustryBuilds diff --git a/core/assets-raw/sprites/blocks/production/melter-liquid.png b/core/assets-raw/sprites/blocks/production/melter-liquid.png new file mode 100644 index 0000000000..19d66fa18a Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/melter-liquid.png differ diff --git a/core/assets-raw/sprites/blocks/production/pulverizer-rotator.png b/core/assets-raw/sprites/blocks/production/pulverizer-rotator.png index 72cd249d26..e89e5ed5e7 100644 Binary files a/core/assets-raw/sprites/blocks/production/pulverizer-rotator.png and b/core/assets-raw/sprites/blocks/production/pulverizer-rotator.png differ diff --git a/core/assets-raw/sprites/blocks/production/pulverizer-top.png b/core/assets-raw/sprites/blocks/production/pulverizer-top.png new file mode 100644 index 0000000000..6c2aa6d653 Binary files /dev/null and b/core/assets-raw/sprites/blocks/production/pulverizer-top.png differ diff --git a/core/assets-raw/sprites/blocks/production/pulverizer.png b/core/assets-raw/sprites/blocks/production/pulverizer.png index d10680f33c..bd07997cdf 100644 Binary files a/core/assets-raw/sprites/blocks/production/pulverizer.png and b/core/assets-raw/sprites/blocks/production/pulverizer.png differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 673c211684..9356c0586b 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -494,24 +494,20 @@ public class Blocks implements ContentList{ wall = sporeWall; }}; - metalFloor = new MetalFloor("metal-floor"){{ - variants = 0; - attributes.set(Attribute.water, -1f); - }}; + metalFloor = new Floor("metal-floor", 0); + metalFloorDamaged = new Floor("metal-floor-damaged", 3); - 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"); - metalFloor3 = new MetalFloor("metal-floor-3"); - metalFloor4 = new MetalFloor("metal-floor-4"); - metalFloor5 = new MetalFloor("metal-floor-5"); - - darkPanel1 = new MetalFloor("dark-panel-1"); - 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"); + darkPanel1 = new Floor("dark-panel-1", 0); + darkPanel2 = new Floor("dark-panel-2", 0); + darkPanel3 = new Floor("dark-panel-3", 0); + darkPanel4 = new Floor("dark-panel-4", 0); + darkPanel5 = new Floor("dark-panel-5", 0); + darkPanel6 = new Floor("dark-panel-6", 0); darkMetal = new StaticWall("dark-metal"); @@ -757,6 +753,7 @@ public class Blocks implements ContentList{ outputLiquid = new LiquidStack(Liquids.slag, 2f); craftTime = 10f; hasLiquids = hasPower = true; + drawer = new DrawLiquid(); consumes.power(1f); consumes.item(Items.scrap, 1); diff --git a/core/src/mindustry/editor/MapRenderer.java b/core/src/mindustry/editor/MapRenderer.java index abbd4baa1a..e5a0ce1c01 100644 --- a/core/src/mindustry/editor/MapRenderer.java +++ b/core/src/mindustry/editor/MapRenderer.java @@ -18,6 +18,7 @@ public class MapRenderer implements Disposable{ private IndexedRenderer[][] chunks; private IntSet updates = new IntSet(); private IntSet delayedUpdates = new IntSet(); + private TextureRegion clearEditor; private int width, 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){ Draw.flush(); + clearEditor = Core.atlas.find("clear-editor"); updates.each(i -> render(i % width, i / width)); updates.clear(); @@ -80,6 +82,7 @@ public class MapRenderer implements Disposable{ } public void updateAll(){ + clearEditor = Core.atlas.find("clear-editor"); for(int x = 0; x < width; x++){ for(int y = 0; y < height; y++){ render(x, y); @@ -103,7 +106,7 @@ public class MapRenderer implements Disposable{ boolean center = tile.isCenter(); 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; @@ -124,13 +127,17 @@ public class MapRenderer implements Disposable{ mesh.setColor(team.color); region = Core.atlas.find("block-border-editor"); }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; offsetY = tilesize / 2f - region.height / 2f * Draw.scl; }else if(wall == Blocks.air && !tile.overlay().isAir()){ region = tile.overlay().editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)]; }else{ - region = Core.atlas.find("clear-editor"); + region = clearEditor; } float width = region.width * Draw.scl, height = region.height * Draw.scl; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 8493610a4f..6c6bf1250d 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -907,7 +907,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } 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(); } diff --git a/core/src/mindustry/graphics/g3d/PlanetRenderer.java b/core/src/mindustry/graphics/g3d/PlanetRenderer.java index 3401ba8b3d..37c38e3833 100644 --- a/core/src/mindustry/graphics/g3d/PlanetRenderer.java +++ b/core/src/mindustry/graphics/g3d/PlanetRenderer.java @@ -149,7 +149,7 @@ public class PlanetRenderer implements Disposable{ public void renderTransparent(Planet planet){ if(!planet.visible()) return; - if(planet.isLandable() && planet == this.planet){ + if(planet.hasGrid() && planet == this.planet){ renderSectors(planet); } diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 6738257d79..6862b1a540 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -707,6 +707,11 @@ public class ContentParser{ 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 if(node.parent != null){ node.parent.children.remove(node); diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index 20968951f9..ce92bf0ca1 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -127,7 +127,8 @@ public class Planet extends UnlockableContent{ 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; } diff --git a/core/src/mindustry/ui/dialogs/GameOverDialog.java b/core/src/mindustry/ui/dialogs/GameOverDialog.java index 083e49c116..32e593ea0e 100644 --- a/core/src/mindustry/ui/dialogs/GameOverDialog.java +++ b/core/src/mindustry/ui/dialogs/GameOverDialog.java @@ -5,7 +5,6 @@ import mindustry.core.GameState.*; import mindustry.game.EventType.*; import mindustry.game.*; import mindustry.type.*; -import mindustry.ui.*; import static mindustry.Vars.*; @@ -31,7 +30,7 @@ public class GameOverDialog extends BaseDialog{ } void rebuild(){ - title.setText(state.isCampaign() ? "@sector.curlost" : "@gameover"); + title.setText(state.isCampaign() ? Core.bundle.format("sector.lost", state.getSector().name()) : "@gameover"); buttons.clear(); cont.clear(); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 1e671c43b1..f9a838b9e1 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -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); }else{ hovered = selected = null; diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 79dcf85e40..9cb5d850e0 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -322,7 +322,7 @@ public class HudFragment extends Fragment{ } return max == 0f ? 0f : val / max; }).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(() -> { p.color.a = Mathf.lerpDelta(p.color.a, Mathf.num(showHudText), 0.2f); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index bcee08544e..11eb6b3bef 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -46,6 +46,7 @@ public class Block extends UnlockableContent{ public boolean outputsPayload = false; public boolean acceptsPayload = false; public boolean outputFacing = true; + public boolean noSideBlend = false; public boolean acceptsItems = false; public int itemCapacity = 10; @@ -77,6 +78,8 @@ public class Block extends UnlockableContent{ public boolean solidifes; /** whether this is rotateable */ 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 */ public boolean drawArrow = true; /** for static blocks only: if true, tile data() is saved in world data. */ @@ -239,11 +242,11 @@ public class Block extends UnlockableContent{ public ObjectMap, Cons2> configurations = new ObjectMap<>(); protected TextureRegion[] generatedIcons; - protected TextureRegion[] variantRegions, editorVariantRegions; + protected TextureRegion[] editorVariantRegions; public TextureRegion region, editorIcon; public @Load("@-team") TextureRegion teamRegion; - public TextureRegion[] teamRegions; + public TextureRegion[] teamRegions, variantRegions; protected static final Seq tempTiles = new Seq<>(); protected static final Seq tempTileEnts = new Seq<>(); @@ -263,7 +266,11 @@ public class Block extends UnlockableContent{ if(tile.build != null){ tile.build.draw(); }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(){ //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(){ @@ -830,6 +838,15 @@ public class Block extends UnlockableContent{ for(Team team : Team.all){ 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 @@ -846,6 +863,13 @@ public class Block extends UnlockableContent{ 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; var gen = icons(); diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index cde36ba964..d8d1c620b4 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -15,8 +15,6 @@ import mindustry.world.meta.*; import static mindustry.Vars.*; public class Wall extends Block{ - public int variants = 0; - /** Lighting chance. -1 to disable */ public float lightningChance = -1f; 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 public TextureRegion[] icons(){ return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")}; @@ -75,11 +59,7 @@ public class Wall extends Block{ @Override public void draw(){ - if(variants == 0){ - Draw.rect(region, x, y); - }else{ - Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], x, y); - } + super.draw(); //draw flashing white overlay if enabled if(flashHit){ diff --git a/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java b/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java index af7e2c985b..e5e2c05545 100644 --- a/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/ArmoredConveyor.java @@ -8,6 +8,7 @@ public class ArmoredConveyor extends Conveyor{ public ArmoredConveyor(String name){ super(name); + noSideBlend = true; } @Override diff --git a/core/src/mindustry/world/blocks/distribution/Duct.java b/core/src/mindustry/world/blocks/distribution/Duct.java index c2a63f238e..b485fe6341 100644 --- a/core/src/mindustry/world/blocks/distribution/Duct.java +++ b/core/src/mindustry/world/blocks/distribution/Duct.java @@ -38,6 +38,7 @@ public class Duct extends Block implements Autotiler{ itemCapacity = 1; noUpdateDisabled = true; rotate = true; + noSideBlend = true; envEnabled = Env.space | Env.terrestrial | Env.underwater; } diff --git a/core/src/mindustry/world/blocks/distribution/StackConveyor.java b/core/src/mindustry/world/blocks/distribution/StackConveyor.java index 7c7007cb54..030319a447 100644 --- a/core/src/mindustry/world/blocks/distribution/StackConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/StackConveyor.java @@ -12,7 +12,6 @@ import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; -import mindustry.ui.*; import mindustry.world.*; import mindustry.world.blocks.*; 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); }else if(state == stateUnload){ //router mode 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) || (otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) && !(world.build(otherx, othery) instanceof StackConveyorBuild s && s.state == stateUnload) && diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index 7cee47c4d0..762a5e4f9d 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -20,8 +20,6 @@ import mindustry.world.blocks.*; import static mindustry.Vars.*; public class Floor extends Block{ - /** number of different variant regions to use */ - public int variants = 3; /** edge fallback, used mainly for ores */ public String edge = "stone"; /** Multiplies unit velocity by this when walked on. */ @@ -76,6 +74,12 @@ public class Floor extends Block{ public Floor(String name){ super(name); + variants = 3; + } + + public Floor(String name, int variants){ + super(name); + this.variants = variants; } @Override @@ -85,7 +89,6 @@ public class Floor extends Block{ //load variant regions for drawing if(variants > 0){ variantRegions = new TextureRegion[variants]; - for(int i = 0; i < variants; i++){ variantRegions[i] = Core.atlas.find(name + (i + 1)); } @@ -93,7 +96,6 @@ public class Floor extends Block{ variantRegions = new TextureRegion[1]; variantRegions[0] = Core.atlas.find(name); } - int size = (int)(tilesize / Draw.scl); if(Core.atlas.has(name + "-edge")){ edges = Core.atlas.find(name + "-edge").split(size, size); @@ -130,19 +132,12 @@ public class Floor extends Block{ @Override public void createIcons(MultiPacker 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){ 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 edge = Core.atlas.getPixmap("edge-stencil"); Pixmap result = new Pixmap(edge.width, edge.height); diff --git a/core/src/mindustry/world/blocks/environment/MetalFloor.java b/core/src/mindustry/world/blocks/environment/MetalFloor.java deleted file mode 100644 index fd26f90183..0000000000 --- a/core/src/mindustry/world/blocks/environment/MetalFloor.java +++ /dev/null @@ -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); - } -} diff --git a/core/src/mindustry/world/blocks/environment/Prop.java b/core/src/mindustry/world/blocks/environment/Prop.java index 1056748bce..6adfff5edb 100644 --- a/core/src/mindustry/world/blocks/environment/Prop.java +++ b/core/src/mindustry/world/blocks/environment/Prop.java @@ -7,8 +7,6 @@ import mindustry.content.*; import mindustry.world.*; public class Prop extends Block{ - public int variants; - public Prop(String name){ super(name); breakable = true; @@ -28,17 +26,4 @@ public class Prop extends Block{ public TextureRegion[] icons(){ 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)); - } - } - } } diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index f38644e5f5..a12ed08399 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -174,6 +174,7 @@ public class LogicBlock extends Block{ public boolean active = true, valid; public int x, y; public String name; + Building lastBuild; public LogicLink(int x, int y, String name, boolean valid){ this.x = x; @@ -405,20 +406,22 @@ public class LogicBlock extends Block{ if(!l.active) continue; - boolean valid = validLink(world.build(l.x, l.y)); - if(valid != l.valid){ + var cur = world.build(l.x, l.y); + + boolean valid = validLink(cur); + if(valid != l.valid || (l.lastBuild != null && l.lastBuild != cur)){ + l.lastBuild = cur; changed = true; l.valid = valid; if(valid){ - Building lbuild = world.build(l.x, l.y); //this prevents conflicts l.name = ""; //finds a new matching name after toggling - l.name = findLinkName(lbuild.block); + l.name = findLinkName(cur.block); //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 updates = true; diff --git a/core/src/mindustry/world/draw/DrawLiquid.java b/core/src/mindustry/world/draw/DrawLiquid.java new file mode 100644 index 0000000000..16cfd14934 --- /dev/null +++ b/core/src/mindustry/world/draw/DrawLiquid.java @@ -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}; + } +} diff --git a/core/src/mindustry/world/draw/DrawRotator.java b/core/src/mindustry/world/draw/DrawRotator.java index 166245fa6c..5d75b77825 100644 --- a/core/src/mindustry/world/draw/DrawRotator.java +++ b/core/src/mindustry/world/draw/DrawRotator.java @@ -6,21 +6,23 @@ import mindustry.world.*; import mindustry.world.blocks.production.GenericCrafter.*; public class DrawRotator extends DrawBlock{ - public TextureRegion rotator; + public TextureRegion rotator, top; @Override public void draw(GenericCrafterBuild build){ Draw.rect(build.block.region, build.x, build.y); Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); + if(top.found()) Draw.rect(top, build.x, build.y); } @Override public void load(Block block){ rotator = Core.atlas.find(block.name + "-rotator"); + top = Core.atlas.find(block.name + "-top"); } @Override 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}; } } diff --git a/servers_v6.json b/servers_v6.json index 79c86fc799..dfcd37de1b 100644 --- a/servers_v6.json +++ b/servers_v6.json @@ -101,7 +101,7 @@ }, { "name": "Sakura", - "address": ["160.16.207.141"] + "address": ["160.16.207.141", "160.16.207.141:21527", "160.16.207.141:31587"] }, { "name": "MeowLand", diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index 6f7ba3f5c5..626986b5ce 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -220,7 +220,7 @@ public class Generators{ TextureRegion[] regions = block.getGeneratedIcons(); - if(block instanceof Floor){ + if(block.variants > 0){ for(TextureRegion region : block.variantRegions()){ GenRegion gen = (GenRegion)region; if(gen.path == null) continue;