diff --git a/core/assets-raw/sprites/blocks/environment/dense-red-stone1.png b/core/assets-raw/sprites/blocks/environment/dense-red-stone1.png new file mode 100644 index 0000000000..d45750c6a4 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/dense-red-stone1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/dense-red-stone2.png b/core/assets-raw/sprites/blocks/environment/dense-red-stone2.png new file mode 100644 index 0000000000..acb47bc1fc Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/dense-red-stone2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/dense-red-stone3.png b/core/assets-raw/sprites/blocks/environment/dense-red-stone3.png new file mode 100644 index 0000000000..1bbaab57e7 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/dense-red-stone3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/dense-red-stone4.png b/core/assets-raw/sprites/blocks/environment/dense-red-stone4.png new file mode 100644 index 0000000000..4297994f0c Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/dense-red-stone4.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-diamond-wall1.png b/core/assets-raw/sprites/blocks/environment/red-diamond-wall1.png new file mode 100644 index 0000000000..cc4225fb76 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-diamond-wall1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-diamond-wall2.png b/core/assets-raw/sprites/blocks/environment/red-diamond-wall2.png new file mode 100644 index 0000000000..f9020a83c5 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-diamond-wall2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-diamond-wall3.png b/core/assets-raw/sprites/blocks/environment/red-diamond-wall3.png new file mode 100644 index 0000000000..e6f4523e0a Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-diamond-wall3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone-wall-large.png b/core/assets-raw/sprites/blocks/environment/red-stone-wall-large.png new file mode 100644 index 0000000000..9afd5b1afb Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone-wall-large.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone-wall1.png b/core/assets-raw/sprites/blocks/environment/red-stone-wall1.png new file mode 100644 index 0000000000..a64e9f29b4 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone-wall1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone-wall2.png b/core/assets-raw/sprites/blocks/environment/red-stone-wall2.png new file mode 100644 index 0000000000..8b1befd21e Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone-wall2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone-wall3.png b/core/assets-raw/sprites/blocks/environment/red-stone-wall3.png new file mode 100644 index 0000000000..b573bd36ac Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone-wall3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone1.png b/core/assets-raw/sprites/blocks/environment/red-stone1.png new file mode 100644 index 0000000000..3af3ec80b3 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone2.png b/core/assets-raw/sprites/blocks/environment/red-stone2.png new file mode 100644 index 0000000000..25137c4a0b Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone3.png b/core/assets-raw/sprites/blocks/environment/red-stone3.png new file mode 100644 index 0000000000..0be130de13 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/red-stone4.png b/core/assets-raw/sprites/blocks/environment/red-stone4.png new file mode 100644 index 0000000000..ed4401a87e Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/red-stone4.png differ diff --git a/core/assets-raw/sprites/blocks/props/red-stone-boulder1.png b/core/assets-raw/sprites/blocks/props/red-stone-boulder1.png new file mode 100644 index 0000000000..27fdd14a35 Binary files /dev/null and b/core/assets-raw/sprites/blocks/props/red-stone-boulder1.png differ diff --git a/core/assets-raw/sprites/blocks/props/red-stone-boulder2.png b/core/assets-raw/sprites/blocks/props/red-stone-boulder2.png new file mode 100644 index 0000000000..40d7a7be5f Binary files /dev/null and b/core/assets-raw/sprites/blocks/props/red-stone-boulder2.png differ diff --git a/core/assets-raw/sprites/blocks/props/red-stone-boulder3.png b/core/assets-raw/sprites/blocks/props/red-stone-boulder3.png new file mode 100644 index 0000000000..e85c09ee17 Binary files /dev/null and b/core/assets-raw/sprites/blocks/props/red-stone-boulder3.png differ diff --git a/core/assets-raw/sprites/blocks/props/red-stone-boulder4.png b/core/assets-raw/sprites/blocks/props/red-stone-boulder4.png new file mode 100644 index 0000000000..9cf450c2eb Binary files /dev/null and b/core/assets-raw/sprites/blocks/props/red-stone-boulder4.png differ diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a95a45ffc6..deadde3775 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -483,6 +483,8 @@ toolmode.fillteams = Fill Teams toolmode.fillteams.description = Fill teams instead of blocks. toolmode.drawteams = Draw Teams toolmode.drawteams.description = Draw teams instead of blocks. +toolmode.underliquid = Under Liquids +toolmode.underliquid.description = Draw floors under liquid tiles. filters.empty = [lightgray]No filters! Add one with the button below. diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 9af5d1a3c7..c26f50834b 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -511,3 +511,9 @@ 63193=yellow-stone-plates|block-yellow-stone-plates-ui 63192=rough-rhyolite|block-rough-rhyolite-ui 63191=rhyolite-boulder|block-rhyolite-boulder-ui +63190=red-stone|block-red-stone-ui +63189=dense-red-stone|block-dense-red-stone-ui +63188=red-stone-wall|block-red-stone-wall-ui +63187=red-dimaond-wall|block-red-dimaond-wall-ui +63186=red-stone-boulder|block-red-stone-boulder-ui +63185=red-diamond-wall|block-red-diamond-wall-ui diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 2cbe1e24be..06501850ee 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -40,17 +40,17 @@ public class Blocks{ //environment air, spawn, cliff, deepwater, water, taintedWater, deepTaintedWater, tar, slag, cryofluid, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater, space, empty, - dacite, rhyolite, rhyoliteCrater, roughRhyolite, regolith, yellowStone, redIce, + dacite, rhyolite, rhyoliteCrater, roughRhyolite, regolith, yellowStone, redIce, redStone, denseRedStone, arkyciteFloor, arkyicStone, redmat, bluemat, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, redweed, purbush, coralChunk, yellowCoral, - regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, arkyicWall, crystallineStoneWall, + regolithWall, yellowStoneWall, rhyoliteWall, steamVent, carbonWall, redIceWall, ferricStoneWall, beryllicStoneWall, arkyicWall, crystallineStoneWall, redStoneWall, redDiamondWall, ferricStone, ferricCraters, carbonStone, beryllicStone, crystallineStone, crystalFloor, yellowStonePlates, iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt, //boulders shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder, - arkyicBoulder, crystalCluster, vibrantCrystalCluster, crystalBlocks, crystallineBoulder, redIceBoulder, rhyoliteBoulder, + arkyicBoulder, crystalCluster, vibrantCrystalCluster, crystalBlocks, crystallineBoulder, redIceBoulder, rhyoliteBoulder, redStoneBoulder, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal, pebbles, tendrils, @@ -180,6 +180,7 @@ public class Blocks{ drownTime = 200f; cacheLayer = CacheLayer.water; albedo = 0.9f; + supportsOverlay = true; }}; water = new Floor("shallow-water"){{ @@ -191,6 +192,7 @@ public class Blocks{ isLiquid = true; cacheLayer = CacheLayer.water; albedo = 0.9f; + supportsOverlay = true; }}; taintedWater = new Floor("tainted-water"){{ @@ -203,6 +205,7 @@ public class Blocks{ cacheLayer = CacheLayer.water; albedo = 0.9f; attributes.set(Attribute.spores, 0.15f); + supportsOverlay = true; }}; deepTaintedWater = new Floor("deep-tainted-water"){{ @@ -216,6 +219,7 @@ public class Blocks{ cacheLayer = CacheLayer.water; albedo = 0.9f; attributes.set(Attribute.spores, 0.15f); + supportsOverlay = true; }}; darksandTaintedWater = new ShallowLiquid("darksand-tainted-water"){{ @@ -223,18 +227,21 @@ public class Blocks{ statusDuration = 60f; albedo = 0.9f; attributes.set(Attribute.spores, 0.1f); + supportsOverlay = true; }}; sandWater = new ShallowLiquid("sand-water"){{ speedMultiplier = 0.8f; statusDuration = 50f; albedo = 0.9f; + supportsOverlay = true; }}; darksandWater = new ShallowLiquid("darksand-water"){{ speedMultiplier = 0.8f; statusDuration = 50f; albedo = 0.9f; + supportsOverlay = true; }}; tar = new Floor("tar"){{ @@ -416,6 +423,16 @@ public class Blocks{ variants = 3; }}; + redStone = new Floor("red-stone"){{ + attributes.set(Attribute.water, -1f); + variants = 4; + }}; + + denseRedStone = new Floor("dense-red-stone"){{ + attributes.set(Attribute.water, -1f); + variants = 4; + }}; + redIce = new Floor("red-ice"){{ //TODO red ice boulder dragMultiplier = 0.4f; @@ -557,6 +574,15 @@ public class Blocks{ redIce.asFloor().wall = this; }}; + redStoneWall = new StaticWall("red-stone-wall"){{ + redStone.asFloor().wall = denseRedStone.asFloor().wall = this; + attributes.set(Attribute.sand, 1.5f); + }}; + + redDiamondWall = new StaticTree("red-diamond-wall"){{ + variants = 3; + }}; + sandWall = new StaticWall("sand-wall"){{ sandWater.asFloor().wall = water.asFloor().wall = deepwater.asFloor().wall = this; attributes.set(Attribute.sand, 2f); @@ -698,6 +724,12 @@ public class Blocks{ rhyolite.asFloor().decoration = roughRhyolite.asFloor().decoration = this; }}; + redStoneBoulder = new Prop("red-stone-boulder"){{ + variants = 4; + denseRedStone.asFloor().decoration = redStone.asFloor().decoration = this; + }}; + + metalFloor = new Floor("metal-floor", 0); metalFloorDamaged = new Floor("metal-floor-damaged", 3); diff --git a/core/src/mindustry/editor/EditorTile.java b/core/src/mindustry/editor/EditorTile.java index 146f1427f5..04cf329ff8 100644 --- a/core/src/mindustry/editor/EditorTile.java +++ b/core/src/mindustry/editor/EditorTile.java @@ -87,7 +87,7 @@ public class EditorTile extends Tile{ return; } - if(!floor.hasSurface() && overlay.asFloor().needsSurface) return; + if(!floor.hasSurface() && overlay.asFloor().needsSurface && (overlay instanceof OreBlock || !floor.supportsOverlay)) return; if(overlay() == overlay) return; op(OpType.overlay, this.overlay.id); super.setOverlay(overlay); diff --git a/core/src/mindustry/editor/EditorTool.java b/core/src/mindustry/editor/EditorTool.java index b560d56e5b..23d2c00c29 100644 --- a/core/src/mindustry/editor/EditorTool.java +++ b/core/src/mindustry/editor/EditorTool.java @@ -45,7 +45,8 @@ public enum EditorTool{ }); } }, - pencil(KeyCode.b, "replace", "square", "drawteams"){ + //the "under liquid" rendering is too buggy to make public + pencil(KeyCode.b, "replace", "square", "drawteams"/*, "underliquid"*/){ { edit = true; draggable = true; @@ -61,10 +62,12 @@ public enum EditorTool{ editor.drawBlocksReplace(x, y); }else if(mode == 1){ //square mode - editor.drawBlocks(x, y, true, tile -> true); + editor.drawBlocks(x, y, true, false, tile -> true); }else if(mode == 2){ //draw teams editor.drawCircle(x, y, tile -> tile.setTeam(editor.drawTeam)); + }else if(mode == 3){ + editor.drawBlocks(x, y, false, true, tile -> tile.floor().isLiquid); } } diff --git a/core/src/mindustry/editor/MapEditor.java b/core/src/mindustry/editor/MapEditor.java index 79609b22fb..497f70aa41 100644 --- a/core/src/mindustry/editor/MapEditor.java +++ b/core/src/mindustry/editor/MapEditor.java @@ -116,14 +116,14 @@ public class MapEditor{ } public void drawBlocks(int x, int y){ - drawBlocks(x, y, false, tile -> true); + drawBlocks(x, y, false, false, tile -> true); } public void drawBlocks(int x, int y, Boolf tester){ - drawBlocks(x, y, false, tester); + drawBlocks(x, y, false, false, tester); } - public void drawBlocks(int x, int y, boolean square, Boolf tester){ + public void drawBlocks(int x, int y, boolean square, boolean forceOverlay, Boolf tester){ if(drawBlock.isMultiblock()){ x = Mathf.clamp(x, (drawBlock.size - 1) / 2, width() - drawBlock.size / 2 - 1); y = Mathf.clamp(y, (drawBlock.size - 1) / 2, height() - drawBlock.size / 2 - 1); @@ -137,7 +137,11 @@ public class MapEditor{ if(!tester.get(tile)) return; if(isFloor){ - tile.setFloor(drawBlock.asFloor()); + if(forceOverlay){ + tile.setOverlay(drawBlock.asFloor()); + }else{ + tile.setFloor(drawBlock.asFloor()); + } }else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){ if(drawBlock.rotate && tile.build != null && tile.build.rotation != rotation){ addTileOp(TileOp.get(tile.x, tile.y, (byte)OpType.rotation.ordinal(), (byte)rotation)); diff --git a/core/src/mindustry/editor/MapRenderer.java b/core/src/mindustry/editor/MapRenderer.java index 17bf9f4213..73eae4e683 100644 --- a/core/src/mindustry/editor/MapRenderer.java +++ b/core/src/mindustry/editor/MapRenderer.java @@ -149,6 +149,9 @@ public class MapRenderer implements Disposable{ offsetX = tilesize / 2f - region.width / 2f * Draw.scl; offsetY = tilesize / 2f - region.height / 2f * Draw.scl; }else if((wall == Blocks.air || overlay.wallOre) && !overlay.isAir()){ + if(floor.isLiquid){ + mesh.setColor(Tmp.c1.set(1f, 1f, 1f, floor.overlayAlpha)); + } region = overlay.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)]; }else{ region = clearEditor; diff --git a/core/src/mindustry/maps/filters/GenerateFilter.java b/core/src/mindustry/maps/filters/GenerateFilter.java index c8ecdd39bb..b2bc430bf4 100644 --- a/core/src/mindustry/maps/filters/GenerateFilter.java +++ b/core/src/mindustry/maps/filters/GenerateFilter.java @@ -10,6 +10,7 @@ import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.gen.*; import mindustry.world.*; +import mindustry.world.blocks.environment.*; public abstract class GenerateFilter{ public int seed = 0; @@ -37,7 +38,7 @@ public abstract class GenerateFilter{ Block block = Vars.content.block(PackTile.block(b)), floor = Vars.content.block(PackTile.floor(b)), overlay = Vars.content.block(PackTile.overlay(b)); tile.setFloor(floor.asFloor()); - tile.setOverlay(!floor.asFloor().hasSurface() && overlay.asFloor().needsSurface ? Blocks.air : overlay); + tile.setOverlay(!floor.asFloor().hasSurface() && overlay.asFloor().needsSurface && overlay instanceof OreBlock ? Blocks.air : overlay); if(!tile.block().synthetic() && !block.synthetic()){ tile.setBlock(block); @@ -49,7 +50,7 @@ public abstract class GenerateFilter{ apply(in); tile.setFloor(in.floor.asFloor()); - tile.setOverlay(!in.floor.asFloor().hasSurface() && in.overlay.asFloor().needsSurface ? Blocks.air : in.overlay); + tile.setOverlay(!in.floor.asFloor().hasSurface() && in.overlay.asFloor().needsSurface && in.overlay instanceof OreBlock ? Blocks.air : in.overlay); if(!tile.block().synthetic() && !in.block.synthetic()){ tile.setBlock(in.block); diff --git a/core/src/mindustry/maps/generators/BasicGenerator.java b/core/src/mindustry/maps/generators/BasicGenerator.java index a3a1754dba..4fcbbacb5b 100644 --- a/core/src/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/mindustry/maps/generators/BasicGenerator.java @@ -402,13 +402,13 @@ public abstract class BasicGenerator implements WorldGenerator{ for(int i = 0; i < max; i++){ Tile tile = tiles.geti(i); - if(tile.floor() == floor){ + if(tile.floor() == floor || tile.block() == floor){ for(int cx = -cap; cx <= cap; cx++){ for(int cy = -cap; cy <= cap; cy++){ if(cx*cx + cy*cy <= r2){ Tile other = tiles.get(tile.x + cx, tile.y + cy); - if(other != null && other.floor() != floor){ + if(other != null){ other.setFloor(dest); } } diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index 040dd3704e..7d0aeaa6d3 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -25,6 +25,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ Block[][] arr = { {Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.carbonStone} + //{Blocks.redStone, Blocks.redStone, Blocks.redStone, Blocks.rhyolite, Blocks.carbonStone} //TODO basalt bad //{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.crystallineStone, Blocks.carbonStone} }; @@ -193,10 +194,17 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ if(floor == Blocks.yellowStonePlates && noise(x + 78 + y, y, 3, 0.8f, 6f, 1f) > 0.44f){ floor = Blocks.yellowStone; } + + if(floor == Blocks.redStone && noise(x + 78 - y, y, 4, 0.73f, 20f, 1f) > 0.65f){ + floor = Blocks.denseRedStone; + } }); inverseFloodFill(tiles.getn(spawnX, spawnY)); + //TODO veins, blend after inverse flood fill? + blend(Blocks.redStoneWall, Blocks.denseRedStone, 4); + //make sure enemies have room erase(endX, endY, 6); diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index 87f6e45812..edf2e8759f 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -16,6 +16,8 @@ import mindustry.graphics.MultiPacker.*; import mindustry.type.*; import mindustry.world.*; +import java.util.*; + import static mindustry.Vars.*; public class Floor extends Block{ @@ -47,6 +49,10 @@ public class Floor extends Block{ public float liquidMultiplier = 1f; /** whether this block is liquid. */ public boolean isLiquid; + /** for liquid floors, this is the opacity of the overlay drawn on top. */ + public float overlayAlpha = 0.65f; + /** whether this floor supports an overlay floor */ + public boolean supportsOverlay = false; /** shallow water flag used for generation */ public boolean shallow = false; /** if true, this block cannot be mined by players. useful for annoying things like sand. */ @@ -67,10 +73,13 @@ public class Floor extends Block{ public boolean needsSurface = true; /** If true, this ore is allowed on walls. */ public boolean wallOre = false; + /** Actual ID used for blend groups. Internal. */ + public int blendId = -1; protected TextureRegion[][] edges; protected Seq blenders = new Seq<>(); protected Bits blended = new Bits(256); + protected int[] dirs = new int[8]; protected TextureRegion edgeRegion; public Floor(String name){ @@ -109,6 +118,8 @@ public class Floor extends Block{ public void init(){ super.init(); + blendId = blendGroup.id; + if(wall == Blocks.air){ wall = content.block(name + "-wall"); if(wall == null) wall = content.block(name.replace("darksand", "dune") + "-wall"); @@ -168,14 +179,21 @@ public class Floor extends Block{ Mathf.rand.setSeed(tile.pos()); Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy()); + Draw.alpha(1f); drawEdges(tile); drawOverlay(tile); } public void drawOverlay(Tile tile){ Floor floor = tile.overlay(); - if(floor != Blocks.air && floor != this){ //ore should never have itself on top, but it's possible, so prevent a crash in that case + if(floor != Blocks.air && floor != this){ + if(isLiquid){ + Draw.alpha(overlayAlpha); + } floor.drawBase(tile); + if(isLiquid){ + Draw.alpha(1f); + } } } @@ -206,6 +224,7 @@ public class Floor extends Block{ public void drawNonLayer(Tile tile, CacheLayer layer){ Mathf.rand.setSeed(tile.pos()); + Arrays.fill(dirs, 0); blenders.clear(); blended.clear(); @@ -215,38 +234,44 @@ public class Floor extends Block{ if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){ if(!blended.getAndSet(other.floor().id)){ blenders.add(other.floor()); + dirs[i] = other.floorID(); } } } - drawBlended(tile); + drawBlended(tile, false); } protected void drawEdges(Tile tile){ blenders.clear(); blended.clear(); + Arrays.fill(dirs, 0); + CacheLayer realCache = tile.floor().cacheLayer; for(int i = 0; i < 8; i++){ Point2 point = Geometry.d8[i]; Tile other = tile.nearby(point); - if(other != null && doEdge(other.floor()) && other.floor().cacheLayer == cacheLayer && other.floor().edges() != null){ + + if(other != null && doEdge(tile, other, other.floor()) && other.floor().cacheLayer == realCache && other.floor().edges() != null){ + if(!blended.getAndSet(other.floor().id)){ blenders.add(other.floor()); } + dirs[i] = other.floorID(); } } - drawBlended(tile); + drawBlended(tile, true); } - protected void drawBlended(Tile tile){ + protected void drawBlended(Tile tile, boolean checkId){ blenders.sort(a -> a.id); for(Block block : blenders){ for(int i = 0; i < 8; i++){ Point2 point = Geometry.d8[i]; Tile other = tile.nearby(point); - if(other != null && other.floor() == block){ + if(other != null && other.floor() == block && (!checkId || dirs[i] == block.id)){ TextureRegion region = edge((Floor)block, 1 - point.x, 1 - point.y); Draw.rect(region, tile.worldx(), tile.worldy()); } @@ -258,7 +283,7 @@ public class Floor extends Block{ protected void drawEdgesFlat(Tile tile, boolean sameLayer){ for(int i = 0; i < 4; i++){ Tile other = tile.nearby(i); - if(other != null && doEdge(other.floor())){ + if(other != null && doEdge(tile, other, other.floor())){ Color color = other.floor().mapColor; Draw.color(color.r, color.g, color.b, 1f); Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90); @@ -267,13 +292,19 @@ public class Floor extends Block{ Draw.color(); } + public int realBlendId(Tile tile){ + if(tile.floor().isLiquid && !tile.overlay().isAir() && !(tile.overlay() instanceof OreBlock)){ + return -((tile.overlay().blendId) | (tile.floor().blendId << 15)); + } + return blendId; + } protected TextureRegion[][] edges(){ return ((Floor)blendGroup).edges; } - protected boolean doEdge(Floor other){ - return other.blendGroup.id > blendGroup.id || edges() == null; + protected boolean doEdge(Tile tile, Tile otherTile, Floor other){ + return other.realBlendId(otherTile) > realBlendId(tile) || edges() == null; } TextureRegion edge(Floor block, int x, int y){ diff --git a/core/src/mindustry/world/blocks/environment/StaticTree.java b/core/src/mindustry/world/blocks/environment/StaticTree.java index 0cea162c2c..7ec5984513 100644 --- a/core/src/mindustry/world/blocks/environment/StaticTree.java +++ b/core/src/mindustry/world/blocks/environment/StaticTree.java @@ -1,6 +1,7 @@ package mindustry.world.blocks.environment; import arc.graphics.g2d.*; +import arc.math.*; import arc.util.*; import mindustry.world.*; @@ -15,9 +16,11 @@ public class StaticTree extends StaticWall{ @Override public void drawBase(Tile tile){ + TextureRegion reg = variants > 0 ? variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))] : region; + TextureRegion r = Tmp.tr1; - r.set(region); - int crop = (region.width - tilesize*4) / 2; + r.set(reg); + int crop = (r.width - tilesize*4) / 2; float ox = 0; float oy = 0; diff --git a/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java b/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java index 00db606106..29c25120a6 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadDeconstructor.java @@ -144,7 +144,7 @@ public class PayloadDeconstructor extends PayloadBlock{ time += edelta(); for(int i = 0; i < reqs.length; i++){ - accum[i] += reqs[i].amount * realShift; + accum[i] += reqs[i].amount * state.rules.deconstructRefundMultiplier * realShift; } }