From fc58f5b0038854fb606708ed0802a353d9ddb734 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 23 Jan 2022 23:19:44 -0500 Subject: [PATCH] Shadows under blocks in minimap --- core/src/mindustry/content/Blocks.java | 2 +- .../mindustry/graphics/MinimapRenderer.java | 23 +++++++++++++++++++ core/src/mindustry/io/MapIO.java | 2 +- tools/src/mindustry/tools/Generators.java | 3 +-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 97576c8c77..7ed54de28f 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2384,7 +2384,7 @@ public class Blocks{ plasmaBore = new BeamDrill("plasma-bore"){{ requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 30)); consumes.power(0.15f); - drillTime = 150f; + drillTime = 160f; tier = 4; size = 2; range = 4; diff --git a/core/src/mindustry/graphics/MinimapRenderer.java b/core/src/mindustry/graphics/MinimapRenderer.java index 6bae42920e..7c58d05ba8 100644 --- a/core/src/mindustry/graphics/MinimapRenderer.java +++ b/core/src/mindustry/graphics/MinimapRenderer.java @@ -9,6 +9,7 @@ import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; import arc.util.pooling.*; +import mindustry.content.*; import mindustry.entities.*; import mindustry.game.EventType.*; import mindustry.gen.*; @@ -37,6 +38,24 @@ public class MinimapRenderer{ //TODO don't update when the minimap is off? if(!ui.editor.isShown()){ update(event.tile); + + //update floor below block. + if(event.tile.block().solid && event.tile.y > 0){ + Tile tile = world.tile(event.tile.x, event.tile.y - 1); + if(tile.block() == Blocks.air){ + update(tile); + } + } + } + }); + + Events.on(TilePreChangeEvent.class, e -> { + //update floor below a *recently removed* block. + if(e.tile.block().solid && e.tile.y > 0){ + Tile tile = world.tile(e.tile.x, e.tile.y - 1); + if(tile.block() == Blocks.air){ + Core.app.post(() -> update(tile)); + } } }); @@ -205,6 +224,10 @@ public class MinimapRenderer{ Color color = Tmp.c1.set(bc == 0 ? MapIO.colorFor(tile.block(), tile.floor(), tile.overlay(), tile.team()) : bc); color.mul(1f - Mathf.clamp(world.getDarkness(tile.x, tile.y) / 4f)); + if(tile.block() == Blocks.air && tile.y < world.height() - 1 && world.tile(tile.x, tile.y + 1).block().solid){ + color.mul(0.7f); + } + return color.rgba(); } diff --git a/core/src/mindustry/io/MapIO.java b/core/src/mindustry/io/MapIO.java index d7c6c8a49f..f1571e1b6c 100644 --- a/core/src/mindustry/io/MapIO.java +++ b/core/src/mindustry/io/MapIO.java @@ -165,7 +165,7 @@ public class MapIO{ if(wall.synthetic()){ return team.color.rgba(); } - return (wall.solid ? wall.mapColor : !overlay.useColor ? floor.mapColor : overlay.mapColor).rgba(); + return (((Floor)overlay).wallOre ? overlay.mapColor : wall.solid ? wall.mapColor : !overlay.useColor ? floor.mapColor : overlay.mapColor).rgba(); } public static Pixmap writeImage(Tiles tiles){ diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index ab33eac9cb..592c311826 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -357,7 +357,6 @@ public class Generators{ region.path.delete(); - // save(out, region.name); } @@ -411,7 +410,7 @@ public class Generators{ average.mul(1f / asum); - if(block instanceof Floor){ + if(block instanceof Floor && !((Floor)block).wallOre){ average.mul(0.77f); }else{ average.mul(1.1f);