Better colored floor/wall support
This commit is contained in:
@@ -78,6 +78,24 @@ public class HudFragment{
|
||||
.name("editor/search").maxTextLength(maxNameLength).get().setMessageText("@players.search");
|
||||
}).growX().pad(-2).padLeft(6f);
|
||||
cont.row();
|
||||
cont.collapser(t -> {
|
||||
t.button(b -> {
|
||||
b.margin(4f);
|
||||
b.left();
|
||||
b.table(Tex.pane, in -> {
|
||||
in.image(Tex.whiteui).update(i -> {
|
||||
if(control.input.block != null && control.input.block.lastConfig instanceof Integer col){
|
||||
i.color.set(col | 0xff);
|
||||
}
|
||||
}).grow();
|
||||
}).margin(4).size(50f).padRight(10);
|
||||
b.add("@color");
|
||||
}, Styles.cleart, () -> ui.picker.show(control.input.block != null && control.input.block.lastConfig instanceof Integer col ? new Color(col | 0xff) : new Color(Color.white), false, col -> {
|
||||
if(control.input.block != null){
|
||||
control.input.block.lastConfig = col.rgba8888();
|
||||
}
|
||||
})).left().width(250f).pad(3f).row();
|
||||
}, () -> control.input.block != null && control.input.block.showColorEdit).growX().row();
|
||||
cont.add(pane).expandY().top().left();
|
||||
|
||||
rebuildBlockSelection(blockSelection, "");
|
||||
|
||||
@@ -126,39 +126,41 @@ public class PlacementFragment{
|
||||
}
|
||||
|
||||
boolean updatePick(InputHandler input){
|
||||
if(Core.input.keyTap(Binding.pick) && player.isBuilder() && !Core.scene.hasDialog()){ //mouse eyedropper select
|
||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||
Tile tile = world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
if(tile != null && Core.input.keyTap(Binding.pick) && player.isBuilder() && !Core.scene.hasDialog()){ //mouse eyedropper select
|
||||
var build = tile.build;
|
||||
|
||||
//can't middle click buildings in fog
|
||||
if(build != null && build.inFogTo(player.team())){
|
||||
build = null;
|
||||
}
|
||||
|
||||
Block tryRecipe = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||
Block tryBlock = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||
Object tryConfig = build == null || !build.block.copyConfig ? null : build.config();
|
||||
|
||||
if(tryBlock != null && tryBlock.showColorEdit && tryConfig == null){
|
||||
tryConfig = tile.extraData;
|
||||
}
|
||||
|
||||
for(BuildPlan req : player.unit().plans()){
|
||||
if(!req.breaking && req.block.bounds(req.x, req.y, Tmp.r1).contains(Core.input.mouseWorld())){
|
||||
tryRecipe = req.block;
|
||||
tryBlock = req.block;
|
||||
tryConfig = req.config;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(tryRecipe == null && state.rules.editor){
|
||||
var tile = world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
if(tile != null){
|
||||
tryRecipe =
|
||||
if(tryBlock == null && state.rules.editor){
|
||||
tryBlock =
|
||||
tile.block() != Blocks.air ? tile.block() :
|
||||
tile.overlay() != Blocks.air ? tile.overlay() :
|
||||
tile.floor() != Blocks.air ? tile.floor() : null;
|
||||
}
|
||||
}
|
||||
|
||||
if(tryRecipe != null && ((tryRecipe.isVisible() && unlocked(tryRecipe)) || state.rules.editor)){
|
||||
input.block = tryRecipe;
|
||||
tryRecipe.lastConfig = tryConfig;
|
||||
if(tryRecipe.isVisible()){
|
||||
if(tryBlock != null && ((tryBlock.isVisible() && unlocked(tryBlock)) || state.rules.editor)){
|
||||
input.block = tryBlock;
|
||||
tryBlock.lastConfig = tryConfig;
|
||||
if(tryBlock.isVisible()){
|
||||
currentCategory = input.block.category;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user