Merge pull request #3155 from summetdev/processor-units

Hovering over a processor will show the unit it's controlling.
This commit is contained in:
Anuken
2020-10-27 13:42:37 -04:00
committed by GitHub
2 changed files with 20 additions and 4 deletions

View File

@@ -136,16 +136,24 @@ public class Drawf{
Draw.reset();
}
public static void square(float x, float y, float radius, Color color){
public static void square(float x, float y, float radius, float rotation, Color color){
Lines.stroke(3f, Pal.gray);
Lines.square(x, y, radius + 1f, 45);
Lines.square(x, y, radius + 1f, rotation);
Lines.stroke(1f, color);
Lines.square(x, y, radius + 1f, 45);
Lines.square(x, y, radius + 1f, rotation);
Draw.reset();
}
public static void square(float x, float y, float radius, float rotation){
square(x, y, radius, rotation, Pal.accent);
}
public static void square(float x, float y, float radius, Color color){
square(x, y, radius, 45, color);
}
public static void square(float x, float y, float radius){
square(x, y, radius, Pal.accent);
square(x, y, radius, 45);
}
public static void arrow(float x, float y, float x2, float y2, float length, float radius){

View File

@@ -8,6 +8,7 @@ import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.ai.types.*;
import mindustry.core.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@@ -431,6 +432,13 @@ public class LogicBlock extends Block{
}
}
@Override
public void drawSelect() {
Groups.unit.each(u -> u.controller() instanceof LogicAI ai && ai.controller == this, unit -> {
Drawf.square(unit.x, unit.y, unit.hitSize, unit.rotation + 45);
});
}
public boolean validLink(Building other){
return other != null && other.isValid() && other.team == team && other.within(this, range + other.block.size*tilesize/2f) && !(other instanceof ConstructBuild);
}