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)){
|
if(Core.input.keyTap(Binding.blockInfo)){
|
||||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
if(hovered() instanceof Unit unit && unit.type.unlockedNow()){
|
||||||
Block hovering = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
ui.content.show(unit.type());
|
||||||
Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block != null ? input.block : hovering;
|
}else{
|
||||||
if(displayBlock != null && displayBlock.unlockedNow()){
|
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
ui.content.show(displayBlock);
|
Block hovering = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||||
Events.fire(new BlockInfoEvent());
|
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