Hovering over blocks with a selection displays the selection (#10323)

* Selection display

Should this go in building or block?

* Apparently serpulo liquid icons are not square???

* simplify

* simplify further

* Add disabling w/ setting

Probably needs a better name

* Better name

* h
This commit is contained in:
MEEPofFaith
2025-02-08 18:21:09 -08:00
committed by GitHub
parent 07e573ac42
commit e9ecb2a576
10 changed files with 53 additions and 2 deletions

View File

@@ -1220,6 +1220,7 @@ setting.bloomblur.name = Bloom Blur
setting.effects.name = Display Effects setting.effects.name = Display Effects
setting.destroyedblocks.name = Display Destroyed Blocks setting.destroyedblocks.name = Display Destroyed Blocks
setting.blockstatus.name = Display Block Status setting.blockstatus.name = Display Block Status
setting.displayselection.name = Display Block Configs on Hover
setting.conveyorpathfinding.name = Conveyor Placement Pathfinding setting.conveyorpathfinding.name = Conveyor Placement Pathfinding
setting.sensitivity.name = Controller Sensitivity setting.sensitivity.name = Controller Sensitivity
setting.saveinterval.name = Save Interval setting.saveinterval.name = Save Interval

View File

@@ -1201,6 +1201,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
block.drawOverlay(x, y, rotation); 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(){ public void drawDisabled(){
Draw.color(Color.scarlet); Draw.color(Color.scarlet);
Draw.alpha(0.8f); Draw.alpha(0.8f);

View File

@@ -453,6 +453,7 @@ public class SettingsMenuDialog extends BaseDialog{
graphics.checkPref("drawlight", true); graphics.checkPref("drawlight", true);
graphics.checkPref("destroyedblocks", true); graphics.checkPref("destroyedblocks", true);
graphics.checkPref("blockstatus", false); graphics.checkPref("blockstatus", false);
graphics.checkPref("displayselection", true);
graphics.checkPref("playerchat", true); graphics.checkPref("playerchat", true);
if(!mobile){ if(!mobile){
graphics.checkPref("coreitems", true); graphics.checkPref("coreitems", true);

View File

@@ -128,6 +128,12 @@ public class DirectionalUnloader extends Block{
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(unloadItem);
}
@Override @Override
public void buildConfiguration(Table table){ public void buildConfiguration(Table table){
ItemSelection.buildTable(DirectionalUnloader.this, table, content.items(), () -> unloadItem, this::configure); ItemSelection.buildTable(DirectionalUnloader.this, table, content.items(), () -> unloadItem, this::configure);

View File

@@ -89,6 +89,12 @@ public class DuctRouter extends Block{
} }
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}
@Override @Override
public void updateTile(){ public void updateTile(){
progress += edelta() / speed * 2f; progress += edelta() / speed * 2f;

View File

@@ -83,6 +83,12 @@ public class Sorter extends Block{
super.draw(); super.draw();
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}
@Override @Override
public boolean acceptItem(Building source, Item item){ public boolean acceptItem(Building source, Item item){
Building to = getTileTarget(item, source, false); Building to = getTileTarget(item, source, false);

View File

@@ -78,6 +78,12 @@ public class ItemSource extends Block{
super.draw(); super.draw();
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(outputItem);
}
@Override @Override
public void updateTile(){ public void updateTile(){
if(outputItem == null) return; if(outputItem == null) return;
@@ -121,4 +127,4 @@ public class ItemSource extends Block{
outputItem = content.item(read.s()); outputItem = content.item(read.s());
} }
} }
} }

View File

@@ -83,6 +83,12 @@ public class LiquidSource extends Block{
Draw.rect(block.region, x, y); Draw.rect(block.region, x, y);
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(source);
}
@Override @Override
public void buildConfiguration(Table table){ public void buildConfiguration(Table table){
ItemSelection.buildTable(LiquidSource.this, table, content.liquids(), () -> source, this::configure, selectionRows, selectionColumns); ItemSelection.buildTable(LiquidSource.this, table, content.liquids(), () -> source, this::configure, selectionRows, selectionColumns);
@@ -111,4 +117,4 @@ public class LiquidSource extends Block{
source = id == -1 ? null : content.liquid(id); source = id == -1 ? null : content.liquid(id);
} }
} }
} }

View File

@@ -233,6 +233,12 @@ public class Unloader extends Block{
Draw.color(); Draw.color();
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(sortItem);
}
@Override @Override
public void buildConfiguration(Table table){ public void buildConfiguration(Table table){
ItemSelection.buildTable(Unloader.this, table, content.items(), () -> sortItem, this::configure, selectionRows, selectionColumns); ItemSelection.buildTable(Unloader.this, table, content.items(), () -> sortItem, this::configure, selectionRows, selectionColumns);

View File

@@ -50,6 +50,12 @@ public class UnitCargoUnloadPoint extends Block{
} }
} }
@Override
public void drawSelect(){
super.drawSelect();
drawItemSelection(item);
}
@Override @Override
public void updateTile(){ public void updateTile(){
super.updateTile(); super.updateTile();