From bf8f5656318c0f4cfc399d17e1c892c77e434621 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 24 Jul 2018 09:18:04 -0400 Subject: [PATCH] Fixed ore-cliff blending --- core/src/io/anuke/mindustry/world/blocks/Floor.java | 4 +++- core/src/io/anuke/mindustry/world/blocks/OreBlock.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/world/blocks/Floor.java b/core/src/io/anuke/mindustry/world/blocks/Floor.java index 72b8fbdec1..e1fbc0a850 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Floor.java +++ b/core/src/io/anuke/mindustry/world/blocks/Floor.java @@ -12,6 +12,7 @@ import io.anuke.mindustry.type.StatusEffect; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Effects.Effect; +import io.anuke.ucore.function.BiPredicate; import io.anuke.ucore.function.Predicate; import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.util.Geometry; @@ -60,6 +61,7 @@ public class Floor extends Block{ protected TextureRegion[] variantRegions; protected Vector2[] offsets; protected Predicate blends = block -> block != this && !block.blendOverride(this); + protected BiPredicate tileBlends = (tile, other) -> false; protected boolean blend = true; public Floor(String name){ @@ -178,7 +180,7 @@ public class Floor extends Block{ Floor floor = other.floor(); - if((floor.id <= this.id && !(tile.getElevation() != -1 && other.getElevation() > tile.getElevation())) || !blends.test(floor) || (floor.cacheLayer.ordinal() > this.cacheLayer.ordinal() && !sameLayer) || + if((floor.id <= this.id && !(tile.getElevation() != -1 && other.getElevation() > tile.getElevation())) || (!blends.test(floor) && !tileBlends.test(tile, other)) || (floor.cacheLayer.ordinal() > this.cacheLayer.ordinal() && !sameLayer) || (sameLayer && floor.cacheLayer == this.cacheLayer)) continue; TextureRegion region = floor.edgeRegions[i]; diff --git a/core/src/io/anuke/mindustry/world/blocks/OreBlock.java b/core/src/io/anuke/mindustry/world/blocks/OreBlock.java index 57c7f67aa2..1f33c90895 100644 --- a/core/src/io/anuke/mindustry/world/blocks/OreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/OreBlock.java @@ -19,6 +19,7 @@ public class OreBlock extends Floor{ this.variants = 3; this.minimapColor = ore.color; this.blends = block -> block instanceof OreBlock && ((OreBlock) block).base != base; + this.tileBlends = (tile, other) -> tile.getElevation() < other.getElevation(); this.edge = base.name; }