Better colored floor/wall support
This commit is contained in:
@@ -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