Logic config replication / logicUnitBuild rule / Copy-able ConstructBlocks

This commit is contained in:
Anuken
2021-02-21 10:23:46 -05:00
parent 02d8f679b5
commit 61d9dea487
8 changed files with 37 additions and 11 deletions

View File

@@ -447,7 +447,7 @@ public class LExecutor{
}
}
case build -> {
if(unit.canBuild() && exec.obj(p3) instanceof Block block){
if(state.rules.logicUnitBuild && unit.canBuild() && exec.obj(p3) instanceof Block block){
int x = World.toTile(x1 - block.offset/tilesize), y = World.toTile(y1 - block.offset/tilesize);
int rot = exec.numi(p4);
@@ -458,12 +458,14 @@ public class LExecutor{
ai.plan.stuck = false;
}
var conf = exec.obj(p5);
ai.plan.set(x, y, rot, block);
ai.plan.config = exec.obj(p5) instanceof Content c ? c : null;
ai.plan.config = conf instanceof Content c ? c : conf instanceof Building b ? b : null;
unit.clearBuilding();
Tile tile = ai.plan.tile();
if(ai.plan.tile() != null){
if(tile != null && !(tile.block() == block && tile.build != null && tile.build.rotation == rot)){
unit.updateBuilding = true;
unit.addBuild(ai.plan);
}

View File

@@ -829,7 +829,11 @@ public class LStatements{
table.button(b -> {
b.label(() -> type.name());
b.clicked(() -> showSelect(b, LUnitControl.all, type, t -> {
type = t;
if(t == LUnitControl.build && !Vars.state.rules.logicUnitBuild){
Vars.ui.showInfo("@logic.nounitbuild");
}else{
type = t;
}
rebuild(table);
}, 2, cell -> cell.size(120, 50)));
}, Styles.logict, () -> {}).size(120, 40).color(table.color).left().padLeft(2);

View File

@@ -1,6 +1,7 @@
package mindustry.logic;
public enum LUnitControl{
idle,
stop,
move("x", "y"),
approach("x", "y", "radius"),