WallCrafter progress
This commit is contained in:
@@ -17,7 +17,9 @@ public class Attribute{
|
||||
/** Oil content. Used for oil extractor yield. */
|
||||
oil = add("oil"),
|
||||
/** Light coverage. Negative values decrease solar panel efficiency. */
|
||||
light = add("light");
|
||||
light = add("light"),
|
||||
/** Silicate content. Used for sand extraction. */
|
||||
silicate = add("silicate");
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
|
||||
@@ -112,14 +112,18 @@ public class StatValues{
|
||||
};
|
||||
}
|
||||
|
||||
public static StatValue floorEfficiency(Floor floor, float multiplier, boolean startZero){
|
||||
public static StatValue blockEfficiency(Block floor, float multiplier, boolean startZero){
|
||||
return table -> table.stack(
|
||||
new Image(floor.uiIcon).setScaling(Scaling.fit),
|
||||
new Table(t -> t.top().right().add((multiplier < 0 ? "[scarlet]" : startZero ? "[accent]" : "[accent]+") + (int)((multiplier) * 100) + "%").style(Styles.outlineLabel))
|
||||
);
|
||||
}
|
||||
|
||||
public static StatValue floors(Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
return blocks(attr, floating, scale, startZero, true);
|
||||
}
|
||||
|
||||
public static StatValue blocks(Attribute attr, boolean floating, float scale, boolean startZero, boolean checkFloors){
|
||||
return table -> table.table(c -> {
|
||||
Runnable[] rebuild = {null};
|
||||
Map[] lastMap = {null};
|
||||
@@ -130,14 +134,14 @@ public class StatValues{
|
||||
|
||||
if(state.isGame()){
|
||||
var blocks = Vars.content.blocks()
|
||||
.select(block -> block instanceof Floor f && indexer.isBlockPresent(block) && f.attributes.get(attr) != 0 && !(f.isLiquid && !floating))
|
||||
.select(block -> (!checkFloors || block instanceof Floor) && indexer.isBlockPresent(block) && block.attributes.get(attr) != 0 && !((block instanceof Floor f && f.isLiquid) && !floating))
|
||||
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)));
|
||||
|
||||
if(blocks.any()){
|
||||
int i = 0;
|
||||
for(var block : blocks){
|
||||
|
||||
floorEfficiency(block, block.attributes.get(attr) * scale, startZero).display(c);
|
||||
blockEfficiency(block, block.attributes.get(attr) * scale, startZero).display(c);
|
||||
if(++i % 5 == 0){
|
||||
c.row();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Stats{
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
add(stat, StatValues.floors(attr, floating, scale, startZero));
|
||||
add(stat, StatValues.blocks(attr, floating, scale, startZero));
|
||||
}
|
||||
|
||||
/** Adds a single string value with this stat. */
|
||||
|
||||
Reference in New Issue
Block a user