Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hovering over blocks with a selection displays the selection #10323

Merged
merged 7 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,7 @@ setting.bloomblur.name = Bloom Blur
setting.effects.name = Display Effects
setting.destroyedblocks.name = Display Destroyed Blocks
setting.blockstatus.name = Display Block Status
setting.displayselection.name = Display Block Configs on Hover
setting.conveyorpathfinding.name = Conveyor Placement Pathfinding
setting.sensitivity.name = Controller Sensitivity
setting.saveinterval.name = Save Interval
Expand Down
7 changes: 7 additions & 0 deletions core/src/mindustry/entities/comp/BuildingComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,13 @@ public void drawSelect(){
block.drawOverlay(x, y, rotation);
}

public void drawItemSelection(UnlockableContent selection){
if(selection != null && Core.settings.getBool("displayselection", true)){
TextureRegion region = selection.fullIcon;
Draw.rect(region, x, y + block.size * tilesize / 2f + 4, 8f * region.ratio(), 8f);
}
}

public void drawDisabled(){
Draw.color(Color.scarlet);
Draw.alpha(0.8f);
Expand Down
1 change: 1 addition & 0 deletions core/src/mindustry/ui/dialogs/SettingsMenuDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ void addSettings(){
graphics.checkPref("drawlight", true);
graphics.checkPref("destroyedblocks", true);
graphics.checkPref("blockstatus", false);
graphics.checkPref("displayselection", true);
graphics.checkPref("playerchat", true);
if(!mobile){
graphics.checkPref("coreitems", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public void draw(){

}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(unloadItem);
}

@Override
public void buildConfiguration(Table table){
ItemSelection.buildTable(DirectionalUnloader.this, table, content.items(), () -> unloadItem, this::configure);
Expand Down
6 changes: 6 additions & 0 deletions core/src/mindustry/world/blocks/distribution/DuctRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public void draw(){
}
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}

@Override
public void updateTile(){
progress += edelta() / speed * 2f;
Expand Down
6 changes: 6 additions & 0 deletions core/src/mindustry/world/blocks/distribution/Sorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public void draw(){
super.draw();
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}

@Override
public boolean acceptItem(Building source, Item item){
Building to = getTileTarget(item, source, false);
Expand Down
8 changes: 7 additions & 1 deletion core/src/mindustry/world/blocks/sandbox/ItemSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public void draw(){
super.draw();
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(outputItem);
}

@Override
public void updateTile(){
if(outputItem == null) return;
Expand Down Expand Up @@ -120,4 +126,4 @@ public void read(Reads read, byte revision){
outputItem = content.item(read.s());
}
}
}
}
8 changes: 7 additions & 1 deletion core/src/mindustry/world/blocks/sandbox/LiquidSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public void draw(){
Draw.rect(block.region, x, y);
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(source);
}

@Override
public void buildConfiguration(Table table){
ItemSelection.buildTable(LiquidSource.this, table, content.liquids(), () -> source, this::configure, selectionRows, selectionColumns);
Expand Down Expand Up @@ -111,4 +117,4 @@ public void read(Reads read, byte revision){
source = id == -1 ? null : content.liquid(id);
}
}
}
}
6 changes: 6 additions & 0 deletions core/src/mindustry/world/blocks/storage/Unloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ public void draw(){
Draw.color();
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}

@Override
public void buildConfiguration(Table table){
ItemSelection.buildTable(Unloader.this, table, content.items(), () -> sortItem, this::configure, selectionRows, selectionColumns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public void draw(){
}
}

@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(item);
}

@Override
public void updateTile(){
super.updateTile();
Expand Down
Loading