mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 10:25:42 +07:00
Improved drillable stat display
This commit is contained in:
parent
d98f26d35b
commit
50530e7534
@ -160,7 +160,8 @@ public class Drill extends Block{
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.drillTier, StatValues.blocks(b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= tier && f.itemDrop != blockedItem));
|
||||
stats.add(Stat.drillTier, StatValues.blocks(b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null &&
|
||||
f.itemDrop.hardness <= tier && f.itemDrop != blockedItem && (indexer.isBlockPresent(f) || state.isMenu())));
|
||||
|
||||
stats.add(Stat.drillSpeed, 60f / drillTime * size * size, StatUnit.itemsSecond);
|
||||
if(liquidBoostIntensity != 1){
|
||||
|
@ -196,15 +196,20 @@ public class StatValues{
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static StatValue content(Seq<UnlockableContent> list){
|
||||
return content(list, i -> true);
|
||||
}
|
||||
|
||||
public static <T extends UnlockableContent> StatValue content(Seq<T> list, Boolf<T> check){
|
||||
return table -> table.table(l -> {
|
||||
l.left();
|
||||
|
||||
boolean any = false;
|
||||
for(int i = 0; i < list.size; i++){
|
||||
var item = list.get(i);
|
||||
|
||||
if(item instanceof Block block && block.itemDrop != null && !block.itemDrop.unlockedNow()) continue;
|
||||
if(!check.get(item)) continue;
|
||||
any = true;
|
||||
|
||||
if(item.uiIcon.found()) l.image(item.uiIcon).size(iconSmall).padRight(2).padLeft(2).padTop(3).padBottom(3);
|
||||
l.add(item.localizedName).left().padLeft(1).padRight(4).colspan(item.uiIcon.found() ? 1 : 2);
|
||||
@ -212,11 +217,15 @@ public class StatValues{
|
||||
l.row();
|
||||
}
|
||||
}
|
||||
|
||||
if(!any){
|
||||
l.add("@none.inmap");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static StatValue blocks(Boolf<Block> pred){
|
||||
return blocks(content.blocks().select(pred));
|
||||
return content(content.blocks(), pred);
|
||||
}
|
||||
|
||||
public static StatValue blocks(Seq<Block> list){
|
||||
|
Loading…
Reference in New Issue
Block a user