diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index 0dfcc8ddb8..9caace999a 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -1332,7 +1332,7 @@ public class MapObjectives implements Iterable, Eachable> 5; if(ctype == displayDrawType){ if(id != index && id < displays.size && id >= 0 && displays.get(id).buffer != null){ - Tmp.tr1.set(displays.get(id).buffer.getTexture()); - Draw.rect(Tmp.tr1, x, y, p2, p2, p3 + 90); + displays.get(id).getBufferRegion(Tmp.tr1); + Draw.rect(Tmp.tr1, x, y, p2, p2 / Tmp.tr1.ratio(), p3); } }else if(ctype < ContentType.all.length && Vars.content.getByID(ContentType.all[ctype], id) instanceof UnlockableContent u){ var icon = u.fullIcon; diff --git a/core/src/mindustry/world/blocks/logic/TileableLogicDisplay.java b/core/src/mindustry/world/blocks/logic/TileableLogicDisplay.java index 72365b5eb2..84773bae2d 100644 --- a/core/src/mindustry/world/blocks/logic/TileableLogicDisplay.java +++ b/core/src/mindustry/world/blocks/logic/TileableLogicDisplay.java @@ -27,6 +27,7 @@ public class TileableLogicDisplay extends LogicDisplay{ public int maxDisplayDimensions = 16; public @Load(value = "@-#", length = 47) TextureRegion[] tileRegion; public @Load("@-back") TextureRegion backRegion; + public int frameSize = 6; public TileableLogicDisplay(String name){ super(name); @@ -128,8 +129,8 @@ public class TileableLogicDisplay extends LogicDisplay{ @Override public double sense(LAccess sensor){ return switch(sensor){ - case displayWidth -> tilesWidth * 32f - 12f; // accounts for display frame (2 * 6 pixels) - case displayHeight -> tilesHeight * 32f - 12f; + case displayWidth -> tilesWidth * 32f - frameSize * 2; // accounts for display frame (2 * 6 pixels) + case displayHeight -> tilesHeight * 32f - frameSize * 2; default -> super.sense(sensor); }; } @@ -157,6 +158,13 @@ public class TileableLogicDisplay extends LogicDisplay{ } } + @Override + public void getBufferRegion(TextureRegion region){ + if(buffer != null){ + region.set(buffer.getTexture(), 0, buffer.getTexture().height - frameSize*2, buffer.getTexture().width - frameSize*2, -(buffer.getTexture().height - frameSize*2)); + } + } + @Override public void draw(){ //TODO if this is called before draw() on the root display is called, it will wipe it @@ -219,7 +227,7 @@ public class TileableLogicDisplay extends LogicDisplay{ int rtx = (tile.x - originX), rty = (tile.y - originY); // Offset the region to account for display frame (6 pixels) - Tmp.tr1.set(rootDisplay.buffer.getTexture(), rtx * 32 - 6, rty * 32 - 6, 32, 32); + Tmp.tr1.set(rootDisplay.buffer.getTexture(), rtx * 32 - frameSize, rty * 32 - frameSize, 32, 32); Draw.rect(Tmp.tr1, x, y, tilesize, -tilesize); } });