From f1ec26f82ba15c9d09bc2d5b9fd7607b04bb1882 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 11 Oct 2020 14:10:55 -0400 Subject: [PATCH] Correct logic control position rendering --- core/src/mindustry/graphics/OverlayRenderer.java | 9 +++++++++ .../mindustry/world/blocks/logic/LogicBlock.java | 16 ---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/core/src/mindustry/graphics/OverlayRenderer.java b/core/src/mindustry/graphics/OverlayRenderer.java index ea988e5e78..e796b0b168 100644 --- a/core/src/mindustry/graphics/OverlayRenderer.java +++ b/core/src/mindustry/graphics/OverlayRenderer.java @@ -7,6 +7,7 @@ import arc.math.*; import arc.math.geom.*; import arc.util.*; import mindustry.*; +import mindustry.ai.types.*; import mindustry.gen.*; import mindustry.input.*; import mindustry.ui.*; @@ -151,6 +152,14 @@ public class OverlayRenderer{ input.drawOverSelect(); + if(ui.hudfrag.blockfrag.hover() instanceof Unit unit && unit.controller() instanceof LogicAI ai && ai.controller instanceof Building build){ + Draw.z(Layer.overlayUI); + Drawf.square(build.x, build.y, build.block.size * tilesize/2f + 2f); + if(!unit.within(build, unit.hitSize * 2f)){ + Drawf.arrow(unit.x, unit.y, build.x, build.y, unit.hitSize *2f, 4f); + } + } + //draw selection overlay when dropping item if(input.isDroppingItem()){ Vec2 v = Core.input.mouseWorld(input.getMouseX(), input.getMouseY()); diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index f3962a5448..aecf5d4149 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -1,7 +1,6 @@ package mindustry.world.blocks.logic; import arc.func.*; -import arc.graphics.g2d.*; import arc.math.geom.*; import arc.scene.ui.layout.*; import arc.struct.Bits; @@ -9,7 +8,6 @@ import arc.struct.*; import arc.util.*; import arc.util.io.*; import mindustry.*; -import mindustry.ai.types.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.io.*; @@ -425,7 +423,6 @@ public class LogicBlock extends Block{ @Override public void buildConfiguration(Table table){ - table.button(Icon.pencil, Styles.clearTransi, () -> { Vars.ui.logic.show(code, code -> { configure(compress(code, relativeConnections())); @@ -433,19 +430,6 @@ public class LogicBlock extends Block{ }).size(40); } - @Override - public void draw(){ - super.draw(); - - if(ui.hudfrag.blockfrag.hover() instanceof Unit unit && unit.controller() instanceof LogicAI ai && ai.controller == this){ - Draw.z(Layer.overlayUI); - Drawf.square(x, y, size * tilesize/2f + 2f); - if(!unit.within(this, unit.hitSize * 2f)){ - Drawf.arrow(unit.x, unit.y, x, y, unit.hitSize *2f, 4f); - } - } - } - @Override public boolean onConfigureTileTapped(Building other){ if(this == other){