From dcf75222d9e7ab9142c699dbfb20338b0ea87a96 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 27 Feb 2020 10:04:56 -0500 Subject: [PATCH] Cleanup --- core/src/mindustry/core/ContentLoader.java | 2 +- core/src/mindustry/entities/def/FlyingComp.java | 4 ++-- core/src/mindustry/io/MapIO.java | 6 ++++-- core/src/mindustry/maps/planet/TestPlanetGenerator.java | 2 +- core/src/mindustry/type/UnitType.java | 6 +++--- core/src/mindustry/ui/dialogs/PlanetDialog.java | 4 +--- core/src/mindustry/world/Block.java | 4 ++-- core/src/mindustry/world/ColorMapper.java | 2 +- core/src/mindustry/world/blocks/Cliff.java | 4 ++-- core/src/mindustry/world/blocks/Floor.java | 4 ++-- core/src/mindustry/world/blocks/OreBlock.java | 4 ++-- gradle.properties | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/core/src/mindustry/core/ContentLoader.java b/core/src/mindustry/core/ContentLoader.java index 6ed5fea4bb..282b06fe49 100644 --- a/core/src/mindustry/core/ContentLoader.java +++ b/core/src/mindustry/core/ContentLoader.java @@ -134,7 +134,7 @@ public class ContentLoader{ if(color == 0 || color == 255) continue; Block block = block(i); - Color.rgba8888ToColor(block.minimapColor, color); + Color.rgba8888ToColor(block.mapColor, color); block.hasColor = true; } } diff --git a/core/src/mindustry/entities/def/FlyingComp.java b/core/src/mindustry/entities/def/FlyingComp.java index d5a20724b4..c94c44a0e2 100644 --- a/core/src/mindustry/entities/def/FlyingComp.java +++ b/core/src/mindustry/entities/def/FlyingComp.java @@ -66,7 +66,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{ if(isGrounded() && floor.isLiquid){ if((splashTimer += Mathf.dst(deltaX(), deltaY())) >= 7f){ - floor.walkEffect.at(x, y, 0, floor.minimapColor); + floor.walkEffect.at(x, y, 0, floor.mapColor); splashTimer = 0f; } } @@ -75,7 +75,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{ drownTime += Time.delta() * 1f / floor.drownTime; drownTime = Mathf.clamp(drownTime); if(Mathf.chance(Time.delta() * 0.05f)){ - floor.drownUpdateEffect.at(x, y, 0f, floor.minimapColor); + floor.drownUpdateEffect.at(x, y, 0f, floor.mapColor); } //TODO is the netClient check necessary? diff --git a/core/src/mindustry/io/MapIO.java b/core/src/mindustry/io/MapIO.java index 5657962e6d..1dd39e6d5e 100644 --- a/core/src/mindustry/io/MapIO.java +++ b/core/src/mindustry/io/MapIO.java @@ -147,13 +147,15 @@ public class MapIO{ if(wall.synthetic()){ return team.color.rgba(); } - return Color.rgba8888(wall.solid ? wall.minimapColor : ore == Blocks.air ? floor.minimapColor : ore.minimapColor); + return Color.rgba8888(wall.solid ? wall.mapColor : ore == Blocks.air ? floor.mapColor : ore.mapColor); } public static Pixmap writeImage(Tiles tiles){ Pixmap pix = new Pixmap(tiles.width, tiles.height); for(Tile tile : tiles){ - int color = tile.block().hasColor && !tile.block().synthetic() ? tile.block().minimapColor.rgba() : tile.floor().minimapColor.rgba(); + //while synthetic blocks are possible, most of their data is lost, so in order to avoid questions like + //"why is there air under my drill" and "why are all my conveyors facing right", they are disabled + int color = tile.block().hasColor && !tile.block().synthetic() ? tile.block().mapColor.rgba() : tile.floor().mapColor.rgba(); pix.draw(tile.x, tiles.height - 1 - tile.y, color); } return pix; diff --git a/core/src/mindustry/maps/planet/TestPlanetGenerator.java b/core/src/mindustry/maps/planet/TestPlanetGenerator.java index 7bf4f59ec9..c7be060cc7 100644 --- a/core/src/mindustry/maps/planet/TestPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/TestPlanetGenerator.java @@ -60,7 +60,7 @@ public class TestPlanetGenerator extends PlanetGenerator{ public Color getColor(Vec3 position){ Block block = getBlock(position); //replace salt with sand color - return block == Blocks.salt ? Blocks.sand.minimapColor : block.minimapColor; + return block == Blocks.salt ? Blocks.sand.mapColor : block.mapColor; } @Override diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index adba81184f..1867d1ff1a 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -231,7 +231,7 @@ public class UnitType extends UnlockableContent{ Floor floor = unit.floorOn(); if(floor.isLiquid){ - Draw.color(Color.white, floor.minimapColor, 0.5f); + Draw.color(Color.white, floor.mapColor, 0.5f); } for(int i : Mathf.signs){ @@ -242,7 +242,7 @@ public class UnitType extends UnlockableContent{ } if(floor.isLiquid){ - Draw.color(Color.white, floor.minimapColor, unit.drownTime() * 0.4f); + Draw.color(Color.white, floor.mapColor, unit.drownTime() * 0.4f); }else{ Draw.color(Color.white); } @@ -255,7 +255,7 @@ public class UnitType extends UnlockableContent{ public void applyColor(Unitc unit){ Draw.mixcol(Color.white, unit.hitTime()); if(unit.drownTime() > 0 && unit.floorOn().isDeep()){ - Draw.mixcol(unit.floorOn().minimapColor, unit.drownTime() * 0.8f); + Draw.mixcol(unit.floorOn().mapColor, unit.drownTime() * 0.8f); } } diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 3c7a63f956..daa2070371 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -106,9 +106,7 @@ public class PlanetDialog extends FloatingDialog{ cont.clear(); titleTable.remove(); - cont.addRect((x, y, w, h) -> { - render(); - }).grow(); + cont.addRect((x, y, w, h) -> render()).grow(); } private void render(){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 91c81d17c9..0bc210b03d 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -102,7 +102,7 @@ public class Block extends BlockStorage{ * The color of this block when displayed on the minimap or map preview. * Do not set manually! This is overriden when loading for most blocks. */ - public Color minimapColor = new Color(0, 0, 0, 1); + public Color mapColor = new Color(0, 0, 0, 1); /** Whether this block has a minimap color. */ public boolean hasColor = false; /** Whether units target this block. */ @@ -765,7 +765,7 @@ public class Block extends BlockStorage{ if(!synthetic()){ PixmapRegion image = Core.atlas.getPixmap((AtlasRegion)icon(Cicon.full)); - minimapColor.set(image.getPixel(image.width/2, image.height/2)); + mapColor.set(image.getPixel(image.width/2, image.height/2)); } getGeneratedIcons(); diff --git a/core/src/mindustry/world/ColorMapper.java b/core/src/mindustry/world/ColorMapper.java index 8eea201ec9..9df2e81e1c 100644 --- a/core/src/mindustry/world/ColorMapper.java +++ b/core/src/mindustry/world/ColorMapper.java @@ -16,7 +16,7 @@ public class ColorMapper{ color2block.clear(); for(Block block : Vars.content.blocks()){ - color2block.put(block.minimapColor.rgba(), block); + color2block.put(block.mapColor.rgba(), block); } color2block.put(Color.rgba8888(0, 0, 0, 1), Blocks.air); diff --git a/core/src/mindustry/world/blocks/Cliff.java b/core/src/mindustry/world/blocks/Cliff.java index 6b53b6785d..2089d7f679 100644 --- a/core/src/mindustry/world/blocks/Cliff.java +++ b/core/src/mindustry/world/blocks/Cliff.java @@ -21,7 +21,7 @@ public class Cliff extends Block{ int r = tile.rotation(); for(int i = 0; i < 8; i++){ if((r & (1 << i)) != 0){ - Draw.color(Tmp.c1.set(tile.floor().minimapColor).mul(1.3f + (i >= 4 ? -0.4f : 0.3f))); + Draw.color(Tmp.c1.set(tile.floor().mapColor).mul(1.3f + (i >= 4 ? -0.4f : 0.3f))); Draw.rect(region, tile.worldx(), tile.worldy(), 11f, 11f, i * 45f); } } @@ -31,6 +31,6 @@ public class Cliff extends Block{ @Override public int minimapColor(Tile tile){ - return Tmp.c1.set(tile.floor().minimapColor).mul(1.2f).rgba(); + return Tmp.c1.set(tile.floor().mapColor).mul(1.2f).rgba(); } } diff --git a/core/src/mindustry/world/blocks/Floor.java b/core/src/mindustry/world/blocks/Floor.java index 4c9afd2a2e..6abb1de2ce 100644 --- a/core/src/mindustry/world/blocks/Floor.java +++ b/core/src/mindustry/world/blocks/Floor.java @@ -110,7 +110,7 @@ public class Floor extends Block{ if(wall == null) wall = Blocks.air; if(decoration == Blocks.air){ - decoration = content.blocks().min(b -> b instanceof Rock && b.breakable ? minimapColor.diff(b.minimapColor) : Float.POSITIVE_INFINITY); + decoration = content.blocks().min(b -> b instanceof Rock && b.breakable ? mapColor.diff(b.mapColor) : Float.POSITIVE_INFINITY); } } @@ -219,7 +219,7 @@ public class Floor extends Block{ for(int i = 0; i < 4; i++){ Tile other = tile.getNearby(i); if(other != null && doEdge(other.floor(), sameLayer)){ - Color color = other.floor().minimapColor; + Color color = other.floor().mapColor; Draw.color(color.r, color.g, color.b, 1f); Draw.rect(edgeRegion, tile.worldx(), tile.worldy(), i*90); } diff --git a/core/src/mindustry/world/blocks/OreBlock.java b/core/src/mindustry/world/blocks/OreBlock.java index 6938ffa37d..bf3a402262 100644 --- a/core/src/mindustry/world/blocks/OreBlock.java +++ b/core/src/mindustry/world/blocks/OreBlock.java @@ -19,7 +19,7 @@ public class OreBlock extends OverlayFloor{ this.localizedName = ore.localizedName; this.itemDrop = ore; this.variants = 3; - this.minimapColor.set(ore.color); + this.mapColor.set(ore.color); } /** For mod use only!*/ @@ -31,7 +31,7 @@ public class OreBlock extends OverlayFloor{ public void setup(Item ore){ this.localizedName = ore.localizedName; this.itemDrop = ore; - this.minimapColor.set(ore.color); + this.mapColor.set(ore.color); } @Override diff --git a/gradle.properties b/gradle.properties index 7f841592d5..2b37ed7cd1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=307ea4c34bfa0d16098865a354103a85973398b0 +archash=f2bb11a4dbb6febed118a772ce61a253e1d863c5