New environment blocks

This commit is contained in:
Anuken
2022-01-22 13:33:16 -05:00
parent f4701f6b8a
commit 97da66cd44
32 changed files with 119 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

View File

@@ -483,6 +483,8 @@ toolmode.fillteams = Fill Teams
toolmode.fillteams.description = Fill teams instead of blocks. toolmode.fillteams.description = Fill teams instead of blocks.
toolmode.drawteams = Draw Teams toolmode.drawteams = Draw Teams
toolmode.drawteams.description = Draw teams instead of blocks. 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. filters.empty = [lightgray]No filters! Add one with the button below.

View File

@@ -511,3 +511,9 @@
63193=yellow-stone-plates|block-yellow-stone-plates-ui 63193=yellow-stone-plates|block-yellow-stone-plates-ui
63192=rough-rhyolite|block-rough-rhyolite-ui 63192=rough-rhyolite|block-rough-rhyolite-ui
63191=rhyolite-boulder|block-rhyolite-boulder-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

View File

@@ -40,17 +40,17 @@ public class Blocks{
//environment //environment
air, spawn, cliff, deepwater, water, taintedWater, deepTaintedWater, tar, slag, cryofluid, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater, space, empty, 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, arkyciteFloor, arkyicStone,
redmat, bluemat, redmat, bluemat,
stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
redweed, purbush, coralChunk, yellowCoral, 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, ferricStone, ferricCraters, carbonStone, beryllicStone, crystallineStone, crystalFloor, yellowStonePlates,
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt, iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt,
//boulders //boulders
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, carbonBoulder, ferricBoulder, beryllicBoulder, yellowStoneBoulder, 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, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
pebbles, tendrils, pebbles, tendrils,
@@ -180,6 +180,7 @@ public class Blocks{
drownTime = 200f; drownTime = 200f;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.9f; albedo = 0.9f;
supportsOverlay = true;
}}; }};
water = new Floor("shallow-water"){{ water = new Floor("shallow-water"){{
@@ -191,6 +192,7 @@ public class Blocks{
isLiquid = true; isLiquid = true;
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.9f; albedo = 0.9f;
supportsOverlay = true;
}}; }};
taintedWater = new Floor("tainted-water"){{ taintedWater = new Floor("tainted-water"){{
@@ -203,6 +205,7 @@ public class Blocks{
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.9f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.15f); attributes.set(Attribute.spores, 0.15f);
supportsOverlay = true;
}}; }};
deepTaintedWater = new Floor("deep-tainted-water"){{ deepTaintedWater = new Floor("deep-tainted-water"){{
@@ -216,6 +219,7 @@ public class Blocks{
cacheLayer = CacheLayer.water; cacheLayer = CacheLayer.water;
albedo = 0.9f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.15f); attributes.set(Attribute.spores, 0.15f);
supportsOverlay = true;
}}; }};
darksandTaintedWater = new ShallowLiquid("darksand-tainted-water"){{ darksandTaintedWater = new ShallowLiquid("darksand-tainted-water"){{
@@ -223,18 +227,21 @@ public class Blocks{
statusDuration = 60f; statusDuration = 60f;
albedo = 0.9f; albedo = 0.9f;
attributes.set(Attribute.spores, 0.1f); attributes.set(Attribute.spores, 0.1f);
supportsOverlay = true;
}}; }};
sandWater = new ShallowLiquid("sand-water"){{ sandWater = new ShallowLiquid("sand-water"){{
speedMultiplier = 0.8f; speedMultiplier = 0.8f;
statusDuration = 50f; statusDuration = 50f;
albedo = 0.9f; albedo = 0.9f;
supportsOverlay = true;
}}; }};
darksandWater = new ShallowLiquid("darksand-water"){{ darksandWater = new ShallowLiquid("darksand-water"){{
speedMultiplier = 0.8f; speedMultiplier = 0.8f;
statusDuration = 50f; statusDuration = 50f;
albedo = 0.9f; albedo = 0.9f;
supportsOverlay = true;
}}; }};
tar = new Floor("tar"){{ tar = new Floor("tar"){{
@@ -416,6 +423,16 @@ public class Blocks{
variants = 3; 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"){{ redIce = new Floor("red-ice"){{
//TODO red ice boulder //TODO red ice boulder
dragMultiplier = 0.4f; dragMultiplier = 0.4f;
@@ -557,6 +574,15 @@ public class Blocks{
redIce.asFloor().wall = this; 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"){{ sandWall = new StaticWall("sand-wall"){{
sandWater.asFloor().wall = water.asFloor().wall = deepwater.asFloor().wall = this; sandWater.asFloor().wall = water.asFloor().wall = deepwater.asFloor().wall = this;
attributes.set(Attribute.sand, 2f); attributes.set(Attribute.sand, 2f);
@@ -698,6 +724,12 @@ public class Blocks{
rhyolite.asFloor().decoration = roughRhyolite.asFloor().decoration = this; 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); metalFloor = new Floor("metal-floor", 0);
metalFloorDamaged = new Floor("metal-floor-damaged", 3); metalFloorDamaged = new Floor("metal-floor-damaged", 3);

View File

@@ -87,7 +87,7 @@ public class EditorTile extends Tile{
return; return;
} }
if(!floor.hasSurface() && overlay.asFloor().needsSurface) return; if(!floor.hasSurface() && overlay.asFloor().needsSurface && (overlay instanceof OreBlock || !floor.supportsOverlay)) return;
if(overlay() == overlay) return; if(overlay() == overlay) return;
op(OpType.overlay, this.overlay.id); op(OpType.overlay, this.overlay.id);
super.setOverlay(overlay); super.setOverlay(overlay);

View File

@@ -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; edit = true;
draggable = true; draggable = true;
@@ -61,10 +62,12 @@ public enum EditorTool{
editor.drawBlocksReplace(x, y); editor.drawBlocksReplace(x, y);
}else if(mode == 1){ }else if(mode == 1){
//square mode //square mode
editor.drawBlocks(x, y, true, tile -> true); editor.drawBlocks(x, y, true, false, tile -> true);
}else if(mode == 2){ }else if(mode == 2){
//draw teams //draw teams
editor.drawCircle(x, y, tile -> tile.setTeam(editor.drawTeam)); editor.drawCircle(x, y, tile -> tile.setTeam(editor.drawTeam));
}else if(mode == 3){
editor.drawBlocks(x, y, false, true, tile -> tile.floor().isLiquid);
} }
} }

View File

@@ -116,14 +116,14 @@ public class MapEditor{
} }
public void drawBlocks(int x, int y){ 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<Tile> tester){ public void drawBlocks(int x, int y, Boolf<Tile> tester){
drawBlocks(x, y, false, tester); drawBlocks(x, y, false, false, tester);
} }
public void drawBlocks(int x, int y, boolean square, Boolf<Tile> tester){ public void drawBlocks(int x, int y, boolean square, boolean forceOverlay, Boolf<Tile> tester){
if(drawBlock.isMultiblock()){ if(drawBlock.isMultiblock()){
x = Mathf.clamp(x, (drawBlock.size - 1) / 2, width() - drawBlock.size / 2 - 1); 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); 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(!tester.get(tile)) return;
if(isFloor){ if(isFloor){
tile.setFloor(drawBlock.asFloor()); if(forceOverlay){
tile.setOverlay(drawBlock.asFloor());
}else{
tile.setFloor(drawBlock.asFloor());
}
}else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){ }else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){
if(drawBlock.rotate && tile.build != null && tile.build.rotation != rotation){ if(drawBlock.rotate && tile.build != null && tile.build.rotation != rotation){
addTileOp(TileOp.get(tile.x, tile.y, (byte)OpType.rotation.ordinal(), (byte)rotation)); addTileOp(TileOp.get(tile.x, tile.y, (byte)OpType.rotation.ordinal(), (byte)rotation));

View File

@@ -149,6 +149,9 @@ public class MapRenderer implements Disposable{
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 || overlay.wallOre) && !overlay.isAir()){ }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)]; region = overlay.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, tile.overlay().editorVariantRegions().length - 1)];
}else{ }else{
region = clearEditor; region = clearEditor;

View File

@@ -10,6 +10,7 @@ import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.environment.*;
public abstract class GenerateFilter{ public abstract class GenerateFilter{
public int seed = 0; 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)); 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.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()){ if(!tile.block().synthetic() && !block.synthetic()){
tile.setBlock(block); tile.setBlock(block);
@@ -49,7 +50,7 @@ public abstract class GenerateFilter{
apply(in); apply(in);
tile.setFloor(in.floor.asFloor()); 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()){ if(!tile.block().synthetic() && !in.block.synthetic()){
tile.setBlock(in.block); tile.setBlock(in.block);

View File

@@ -402,13 +402,13 @@ public abstract class BasicGenerator implements WorldGenerator{
for(int i = 0; i < max; i++){ for(int i = 0; i < max; i++){
Tile tile = tiles.geti(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 cx = -cap; cx <= cap; cx++){
for(int cy = -cap; cy <= cap; cy++){ for(int cy = -cap; cy <= cap; cy++){
if(cx*cx + cy*cy <= r2){ if(cx*cx + cy*cy <= r2){
Tile other = tiles.get(tile.x + cx, tile.y + cy); Tile other = tiles.get(tile.x + cx, tile.y + cy);
if(other != null && other.floor() != floor){ if(other != null){
other.setFloor(dest); other.setFloor(dest);
} }
} }

View File

@@ -25,6 +25,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
Block[][] arr = { Block[][] arr = {
{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.carbonStone} {Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.carbonStone}
//{Blocks.redStone, Blocks.redStone, Blocks.redStone, Blocks.rhyolite, Blocks.carbonStone}
//TODO basalt bad //TODO basalt bad
//{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.crystallineStone, Blocks.carbonStone} //{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){ if(floor == Blocks.yellowStonePlates && noise(x + 78 + y, y, 3, 0.8f, 6f, 1f) > 0.44f){
floor = Blocks.yellowStone; 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)); inverseFloodFill(tiles.getn(spawnX, spawnY));
//TODO veins, blend after inverse flood fill?
blend(Blocks.redStoneWall, Blocks.denseRedStone, 4);
//make sure enemies have room //make sure enemies have room
erase(endX, endY, 6); erase(endX, endY, 6);

View File

@@ -16,6 +16,8 @@ import mindustry.graphics.MultiPacker.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import java.util.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class Floor extends Block{ public class Floor extends Block{
@@ -47,6 +49,10 @@ public class Floor extends Block{
public float liquidMultiplier = 1f; public float liquidMultiplier = 1f;
/** whether this block is liquid. */ /** whether this block is liquid. */
public boolean isLiquid; 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 */ /** shallow water flag used for generation */
public boolean shallow = false; public boolean shallow = false;
/** if true, this block cannot be mined by players. useful for annoying things like sand. */ /** 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; public boolean needsSurface = true;
/** If true, this ore is allowed on walls. */ /** If true, this ore is allowed on walls. */
public boolean wallOre = false; public boolean wallOre = false;
/** Actual ID used for blend groups. Internal. */
public int blendId = -1;
protected TextureRegion[][] edges; protected TextureRegion[][] edges;
protected Seq<Block> blenders = new Seq<>(); protected Seq<Block> blenders = new Seq<>();
protected Bits blended = new Bits(256); protected Bits blended = new Bits(256);
protected int[] dirs = new int[8];
protected TextureRegion edgeRegion; protected TextureRegion edgeRegion;
public Floor(String name){ public Floor(String name){
@@ -109,6 +118,8 @@ public class Floor extends Block{
public void init(){ public void init(){
super.init(); super.init();
blendId = blendGroup.id;
if(wall == Blocks.air){ if(wall == Blocks.air){
wall = content.block(name + "-wall"); wall = content.block(name + "-wall");
if(wall == null) wall = content.block(name.replace("darksand", "dune") + "-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()); Mathf.rand.setSeed(tile.pos());
Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy()); Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy());
Draw.alpha(1f);
drawEdges(tile); drawEdges(tile);
drawOverlay(tile); drawOverlay(tile);
} }
public void drawOverlay(Tile tile){ public void drawOverlay(Tile tile){
Floor floor = tile.overlay(); 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); floor.drawBase(tile);
if(isLiquid){
Draw.alpha(1f);
}
} }
} }
@@ -206,6 +224,7 @@ public class Floor extends Block{
public void drawNonLayer(Tile tile, CacheLayer layer){ public void drawNonLayer(Tile tile, CacheLayer layer){
Mathf.rand.setSeed(tile.pos()); Mathf.rand.setSeed(tile.pos());
Arrays.fill(dirs, 0);
blenders.clear(); blenders.clear();
blended.clear(); blended.clear();
@@ -215,38 +234,44 @@ public class Floor extends Block{
if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){ if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){
if(!blended.getAndSet(other.floor().id)){ if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor()); blenders.add(other.floor());
dirs[i] = other.floorID();
} }
} }
} }
drawBlended(tile); drawBlended(tile, false);
} }
protected void drawEdges(Tile tile){ protected void drawEdges(Tile tile){
blenders.clear(); blenders.clear();
blended.clear(); blended.clear();
Arrays.fill(dirs, 0);
CacheLayer realCache = tile.floor().cacheLayer;
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i]; Point2 point = Geometry.d8[i];
Tile other = tile.nearby(point); 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)){ if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor()); 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); blenders.sort(a -> a.id);
for(Block block : blenders){ for(Block block : blenders){
for(int i = 0; i < 8; i++){ for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i]; Point2 point = Geometry.d8[i];
Tile other = tile.nearby(point); 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); TextureRegion region = edge((Floor)block, 1 - point.x, 1 - point.y);
Draw.rect(region, tile.worldx(), tile.worldy()); Draw.rect(region, tile.worldx(), tile.worldy());
} }
@@ -258,7 +283,7 @@ public class Floor extends Block{
protected void drawEdgesFlat(Tile tile, boolean sameLayer){ protected void drawEdgesFlat(Tile tile, boolean sameLayer){
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
Tile other = tile.nearby(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; Color color = other.floor().mapColor;
Draw.color(color.r, color.g, color.b, 1f); Draw.color(color.r, color.g, color.b, 1f);
Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90); Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90);
@@ -267,13 +292,19 @@ public class Floor extends Block{
Draw.color(); 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(){ protected TextureRegion[][] edges(){
return ((Floor)blendGroup).edges; return ((Floor)blendGroup).edges;
} }
protected boolean doEdge(Floor other){ protected boolean doEdge(Tile tile, Tile otherTile, Floor other){
return other.blendGroup.id > blendGroup.id || edges() == null; return other.realBlendId(otherTile) > realBlendId(tile) || edges() == null;
} }
TextureRegion edge(Floor block, int x, int y){ TextureRegion edge(Floor block, int x, int y){

View File

@@ -1,6 +1,7 @@
package mindustry.world.blocks.environment; package mindustry.world.blocks.environment;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*; import arc.util.*;
import mindustry.world.*; import mindustry.world.*;
@@ -15,9 +16,11 @@ public class StaticTree extends StaticWall{
@Override @Override
public void drawBase(Tile tile){ 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; TextureRegion r = Tmp.tr1;
r.set(region); r.set(reg);
int crop = (region.width - tilesize*4) / 2; int crop = (r.width - tilesize*4) / 2;
float ox = 0; float ox = 0;
float oy = 0; float oy = 0;

View File

@@ -144,7 +144,7 @@ public class PayloadDeconstructor extends PayloadBlock{
time += edelta(); time += edelta();
for(int i = 0; i < reqs.length; i++){ for(int i = 0; i < reqs.length; i++){
accum[i] += reqs[i].amount * realShift; accum[i] += reqs[i].amount * state.rules.deconstructRefundMultiplier * realShift;
} }
} }