Allow block info hotkey to also work on units (#10894)
* Allow the block info key to also work on units * Follow code formatting guidelines
This commit is contained in:
@@ -251,12 +251,16 @@ public class PlacementFragment{
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.blockInfo)){
|
||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||
Block hovering = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||
Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block != null ? input.block : hovering;
|
||||
if(displayBlock != null && displayBlock.unlockedNow()){
|
||||
ui.content.show(displayBlock);
|
||||
Events.fire(new BlockInfoEvent());
|
||||
if(hovered() instanceof Unit unit && unit.type.unlockedNow()){
|
||||
ui.content.show(unit.type());
|
||||
}else{
|
||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||
Block hovering = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||
Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block != null ? input.block : hovering;
|
||||
if(displayBlock != null && displayBlock.unlockedNow()){
|
||||
ui.content.show(displayBlock);
|
||||
Events.fire(new BlockInfoEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user