Implemented #1093
This commit is contained in:
@@ -24,6 +24,7 @@ public enum BlockStat{
|
||||
powerConnections(StatCategory.power),
|
||||
basePowerGeneration(StatCategory.power),
|
||||
|
||||
tiles(StatCategory.crafting),
|
||||
input(StatCategory.crafting),
|
||||
output(StatCategory.crafting),
|
||||
productionTime(StatCategory.crafting),
|
||||
@@ -45,7 +46,8 @@ public enum BlockStat{
|
||||
ammo(StatCategory.shooting),
|
||||
|
||||
booster(StatCategory.optional),
|
||||
boostEffect(StatCategory.optional);
|
||||
boostEffect(StatCategory.optional),
|
||||
affinities(StatCategory.optional);
|
||||
|
||||
public final StatCategory category;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package mindustry.world.meta;
|
||||
|
||||
import arc.struct.Array;
|
||||
import arc.struct.ObjectMap.Entry;
|
||||
import arc.struct.OrderedMap;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.ObjectMap.*;
|
||||
import mindustry.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.values.*;
|
||||
|
||||
/** Hold and organizes a list of block stats. */
|
||||
@@ -36,6 +38,13 @@ public class BlockStats{
|
||||
add(stat, new LiquidValue(liquid, amount, perSecond));
|
||||
}
|
||||
|
||||
public void add(BlockStat stat, Attribute attr){
|
||||
for(Block block : Vars.content.blocks()){
|
||||
if(!block.isFloor() || Mathf.zero(block.asFloor().attributes.get(attr))) continue;
|
||||
add(stat, new FloorValue(block.asFloor()));
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds a single string value with this stat. */
|
||||
public void add(BlockStat stat, String format, Object... args){
|
||||
add(stat, new StringValue(format, args));
|
||||
|
||||
21
core/src/mindustry/world/meta/values/FloorValue.java
Normal file
21
core/src/mindustry/world/meta/values/FloorValue.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class FloorValue implements StatValue{
|
||||
private final Floor floor;
|
||||
|
||||
public FloorValue(Floor floor){
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
table.add(new Image(floor.icon(Cicon.small))).padRight(3);
|
||||
table.add(floor.localizedName).padRight(3);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user