Correct logic control position rendering

This commit is contained in:
Anuken 2020-10-11 14:10:55 -04:00
parent 7df575e76a
commit f1ec26f82b
2 changed files with 9 additions and 16 deletions

View File

@ -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());

View File

@ -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){