diff --git a/core/assets/sprites/block_colors.png b/core/assets/sprites/block_colors.png index a12b196251..ffc950ea7e 100644 Binary files a/core/assets/sprites/block_colors.png and b/core/assets/sprites/block_colors.png differ diff --git a/core/assets/sprites/fallback/sprites4.png b/core/assets/sprites/fallback/sprites4.png index d347e5f304..2eb2a849eb 100644 Binary files a/core/assets/sprites/fallback/sprites4.png and b/core/assets/sprites/fallback/sprites4.png differ diff --git a/core/assets/sprites/sprites2.png b/core/assets/sprites/sprites2.png index cb8841d584..412b96bfb9 100644 Binary files a/core/assets/sprites/sprites2.png and b/core/assets/sprites/sprites2.png differ diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 05d7b69273..a7cf9b2cca 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -33,7 +33,7 @@ public class BlockIndexer{ /** Maps each team ID to a quarant. A quadrant is a grid of bits, where each bit is set if and only if there is a block of that team in that quadrant. */ private GridBits[] structQuadrants; /** Stores all damaged tile entities by team. */ - private BuildingArray[] damagedTiles = new BuildingArray[Team.all.length]; + private ObjectSet[] damagedTiles = new ObjectSet[Team.all.length]; /** All ores available on this map. */ private ObjectSet allOres = new ObjectSet<>(); /** Stores teams that are present here as tiles. */ @@ -70,7 +70,7 @@ public class BlockIndexer{ Events.on(WorldLoadEvent.class, event -> { scanOres.clear(); scanOres.addAll(Item.getAllOres()); - damagedTiles = new BuildingArray[Team.all.length]; + damagedTiles = new ObjectSet[Team.all.length]; flagMap = new TileArray[Team.all.length][BlockFlag.all.length]; unitCaps = new int[Team.all.length]; activeTeams = new Seq<>(Team.class); @@ -139,14 +139,14 @@ public class BlockIndexer{ } /** Returns all damaged tiles by team. */ - public BuildingArray getDamaged(Team team){ - returnArray.clear(); + public ObjectSet getDamaged(Team team){ + breturnArray.clear(); if(damagedTiles[team.id] == null){ - damagedTiles[team.id] = new BuildingArray(); + damagedTiles[team.id] = new ObjectSet<>(); } - BuildingArray set = damagedTiles[team.id]; + ObjectSet set = damagedTiles[team.id]; for(Building build : set){ if((!build.isValid() || build.team != team || !build.damaged()) || build.block instanceof ConstructBlock){ breturnArray.add(build); @@ -214,7 +214,7 @@ public class BlockIndexer{ public void notifyTileDamaged(Building entity){ if(damagedTiles[entity.team.id] == null){ - damagedTiles[entity.team.id] = new BuildingArray(); + damagedTiles[entity.team.id] = new ObjectSet(); } damagedTiles[entity.team.id].add(entity); @@ -476,35 +476,4 @@ public class BlockIndexer{ return tiles.iterator(); } } - - //TODO copy-pasted code, generics would be nice here - public static class BuildingArray implements Iterable{ - private Seq tiles = new Seq<>(false, 16); - private IntSet contained = new IntSet(); - - public void add(Building tile){ - if(contained.add(tile.pos())){ - tiles.add(tile); - } - } - - public void remove(Building tile){ - if(contained.remove(tile.pos())){ - tiles.remove(tile); - } - } - - public int size(){ - return tiles.size; - } - - public Building first(){ - return tiles.first(); - } - - @Override - public Iterator iterator(){ - return tiles.iterator(); - } - } } diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 93c0f45a8b..1617e6dbd9 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1011,7 +1011,7 @@ public class Blocks implements ContentList{ mechanicalPump = new Pump("mechanical-pump"){{ requirements(Category.liquid, with(Items.copper, 15, Items.metaglass, 10)); - pumpAmount = 0.1f; + pumpAmount = 0.11f; }}; rotaryPump = new Pump("rotary-pump"){{ @@ -1136,7 +1136,7 @@ public class Blocks implements ContentList{ requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30)); powerProduction = 5.5f; itemDuration = 90f; - consumes.liquid(Liquids.water, 0.06f); + consumes.liquid(Liquids.water, 0.07f); hasLiquids = true; size = 2; }}; @@ -1269,7 +1269,7 @@ public class Blocks implements ContentList{ hasItems = true; consumes.power(0.80f); - consumes.liquid(Liquids.water, 0.18f); + consumes.liquid(Liquids.water, 0.2f); }}; oilExtractor = new Fracker("oil-extractor"){{ diff --git a/core/src/mindustry/editor/EditorTile.java b/core/src/mindustry/editor/EditorTile.java index 1b237d2dbf..62d9677434 100644 --- a/core/src/mindustry/editor/EditorTile.java +++ b/core/src/mindustry/editor/EditorTile.java @@ -2,6 +2,7 @@ package mindustry.editor; import arc.func.*; import arc.util.ArcAnnotate.*; +import arc.util.*; import mindustry.content.*; import mindustry.editor.DrawOperation.*; import mindustry.game.*; @@ -20,7 +21,7 @@ public class EditorTile extends Tile{ @Override public void setFloor(@NonNull Floor type){ - if(state.isGame()){ + if(skip()){ super.setFloor(type); return; } @@ -41,13 +42,11 @@ public class EditorTile extends Tile{ @Override public void setBlock(Block type, Team team, int rotation){ - if(state.isGame()){ + if(skip()){ super.setBlock(type, team, rotation); return; } - if(this.block == type && (build == null || build.rotation == rotation)) return; - if(rotation != 0) op(OpType.rotation, (byte)rotation); if(team() != Team.derelict) op(OpType.team, (byte)team().id); op(OpType.block, block.id); @@ -56,7 +55,7 @@ public class EditorTile extends Tile{ @Override public void setTeam(Team team){ - if(state.isGame()){ + if(skip()){ super.setTeam(team); return; } @@ -68,7 +67,7 @@ public class EditorTile extends Tile{ @Override public void setOverlay(Block overlay){ - if(state.isGame()){ + if(skip()){ super.setOverlay(overlay); return; } @@ -81,7 +80,7 @@ public class EditorTile extends Tile{ @Override protected void fireChanged(){ - if(state.isGame()){ + if(skip()){ super.fireChanged(); }else{ ui.editor.editor.renderer().updatePoint(x, y); @@ -90,14 +89,14 @@ public class EditorTile extends Tile{ @Override public void recache(){ - if(state.isGame()){ + if(skip()){ super.recache(); } } @Override protected void changeEntity(Team team, Prov entityprov, int rotation){ - if(state.isGame()){ + if(skip()){ super.changeEntity(team, entityprov, rotation); return; } @@ -118,6 +117,10 @@ public class EditorTile extends Tile{ } } + private boolean skip(){ + return state.isGame() || ui.editor.editor.isLoading(); + } + private void op(OpType type, short value){ ui.editor.editor.addTileOp(TileOp.get(x, y, (byte)type.ordinal(), value)); } diff --git a/core/src/mindustry/editor/MapEditor.java b/core/src/mindustry/editor/MapEditor.java index bbef2125ed..33272b1438 100644 --- a/core/src/mindustry/editor/MapEditor.java +++ b/core/src/mindustry/editor/MapEditor.java @@ -31,6 +31,10 @@ public class MapEditor{ public Block drawBlock = Blocks.stone; public Team drawTeam = Team.sharded; + public boolean isLoading(){ + return loading; + } + public StringMap getTags(){ return tags; } @@ -52,7 +56,7 @@ public class MapEditor{ if(map.file.parent().parent().name().equals("1127400") && steam){ tags.put("steamid", map.file.parent().name()); } - MapIO.loadMap(map, context); + load(() -> MapIO.loadMap(map, context)); renderer.resize(width(), height()); loading = false; } diff --git a/core/src/mindustry/editor/MapRenderer.java b/core/src/mindustry/editor/MapRenderer.java index 0976ccbcb2..919c534128 100644 --- a/core/src/mindustry/editor/MapRenderer.java +++ b/core/src/mindustry/editor/MapRenderer.java @@ -116,7 +116,7 @@ public class MapRenderer implements Disposable{ wx * tilesize + wall.offset + (tilesize - width) / 2f, wy * tilesize + wall.offset + (tilesize - height) / 2f, width, height, - tile.build == null || !wall.rotate ? 0 : tile.build.rotdeg() - 90); + tile.build == null || !wall.rotate ? 0 : tile.build.rotdeg()); }else{ region = floor.editorVariantRegions()[Mathf.randomSeed(idxWall, 0, floor.editorVariantRegions().length - 1)]; diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index cdf35ab3c3..cbc0100943 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -115,7 +115,9 @@ public class Fonts{ /** Called from a static context for use in the loading screen.*/ public static void loadDefaultFont(){ - UI.packer = new PixmapPacker(2048, 2048, Format.rgba8888, 2, true); + int max = Gl.getInt(Gl.maxTextureSize); + + UI.packer = new PixmapPacker(max >= 4096 ? 4096 : 2048, 2048, Format.rgba8888, 2, true); FileHandleResolver resolver = new InternalFileHandleResolver(); Core.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver)); Core.assets.setLoader(Font.class, null, new FreetypeFontLoader(resolver){ diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index 8c6a9f6c9d..b9cae3a128 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -232,18 +232,22 @@ public class Generators{ boolean hasEmpty = false; Color average = new Color(); + float asum = 0f; for(int x = 0; x < image.width; x++){ for(int y = 0; y < image.height; y++){ Color color = image.getColor(x, y); - average.r += color.r; - average.g += color.g; - average.b += color.b; + average.r += color.r*color.a; + average.g += color.g*color.a; + average.b += color.b*color.a; + asum += color.a; if(color.a < 0.9f){ hasEmpty = true; } } } - average.mul(1f / (image.width * image.height)); + + average.mul(1f / asum); + if(block instanceof Floor){ average.mul(0.8f); }else{