mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
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:
parent
19d3e20328
commit
ef5fae289c
1 changed files with 10 additions and 6 deletions
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue