Logic unit control

This commit is contained in:
Anuken
2020-10-05 15:42:37 -04:00
parent 8e49d73765
commit 7088ae89b3
37 changed files with 661 additions and 202 deletions

View File

@@ -28,7 +28,7 @@ public class Router extends Block{
@Override
public void updateTile(){
if(lastItem == null && items.any()){
items.clear();
lastItem = items.first();
}
if(lastItem != null){

View File

@@ -331,6 +331,7 @@ public class LogicBlock extends Block{
@Override
public void updateTile(){
executor.team = team;
//check for previously invalid links to add after configuration
boolean changed = false;

View File

@@ -75,15 +75,15 @@ public class LogicDisplay extends Block{
p1 = DisplayCmd.p1(c), p2 = DisplayCmd.p2(c), p3 = DisplayCmd.p3(c), p4 = DisplayCmd.p4(c);
switch(type){
case commandClear: Core.graphics.clear(x/255f, y/255f, p1/255f, 1f); break;
case commandLine: Lines.line(x, y, p1, p2); break;
case commandRect: Fill.crect(x, y, p1, p2); break;
case commandLineRect: Lines.rect(x, y, p1, p2); break;
case commandPoly: Fill.poly(x, y, Math.min(p1, maxSides), p2, p3); break;
case commandLinePoly: Lines.poly(x, y, Math.min(p1, maxSides), p2, p3); break;
case commandTriangle: Fill.tri(x, y, p1, p2, p3, p4); break;
case commandColor: this.color = Color.toFloatBits(x, y, p1, p2); Draw.color(this.color); break;
case commandStroke: this.stroke = x; Lines.stroke(x); break;
case commandClear -> Core.graphics.clear(x / 255f, y / 255f, p1 / 255f, 1f);
case commandLine -> Lines.line(x, y, p1, p2);
case commandRect -> Fill.crect(x, y, p1, p2);
case commandLineRect -> Lines.rect(x, y, p1, p2);
case commandPoly -> Fill.poly(x, y, Math.min(p1, maxSides), p2, p3);
case commandLinePoly -> Lines.poly(x, y, Math.min(p1, maxSides), p2, p3);
case commandTriangle -> Fill.tri(x, y, p1, p2, p3, p4);
case commandColor -> Draw.color(this.color = Color.toFloatBits(x, y, p1, p2));
case commandStroke -> Lines.stroke(this.stroke = x);
}
}

View File

@@ -50,11 +50,11 @@ public class Reconstructor extends UnitBlock{
() -> e.unit() == null ? "[lightgray]" + Iconc.cancel :
Core.bundle.format("bar.unitcap",
Fonts.getUnicodeStr(e.unit().name),
teamIndex.countType(e.team, e.unit()),
e.team.data().countType(e.unit()),
Units.getCap(e.team)
),
() -> Pal.power,
() -> e.unit() == null ? 0f : (float)teamIndex.countType(e.team, e.unit()) / Units.getCap(e.team)
() -> e.unit() == null ? 0f : (float)e.team.data().countType(e.unit()) / Units.getCap(e.team)
));
}

View File

@@ -21,8 +21,6 @@ import mindustry.world.blocks.payloads.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class UnitFactory extends UnitBlock{
public int[] capacities;
@@ -71,11 +69,11 @@ public class UnitFactory extends UnitBlock{
() -> e.unit() == null ? "[lightgray]" + Iconc.cancel :
Core.bundle.format("bar.unitcap",
Fonts.getUnicodeStr(e.unit().name),
teamIndex.countType(e.team, e.unit()),
e.team.data().countType(e.unit()),
Units.getCap(e.team)
),
() -> Pal.power,
() -> e.unit() == null ? 0f : (float)teamIndex.countType(e.team, e.unit()) / Units.getCap(e.team)
() -> e.unit() == null ? 0f : (float)e.team.data().countType(e.unit()) / Units.getCap(e.team)
));
}