Fixed startup crashing
This commit is contained in:
@@ -342,6 +342,9 @@ no = No
|
|||||||
info.title = Info
|
info.title = Info
|
||||||
error.title = [crimson]An error has occured
|
error.title = [crimson]An error has occured
|
||||||
error.crashtitle = An error has occured
|
error.crashtitle = An error has occured
|
||||||
|
blocks.input = Input
|
||||||
|
blocks.output = Output
|
||||||
|
blocks.booster = Booster
|
||||||
blocks.outputspeed = Drill Speed: {0}/
|
blocks.outputspeed = Drill Speed: {0}/
|
||||||
blocks.efficiency = Efficiency: {0}%
|
blocks.efficiency = Efficiency: {0}%
|
||||||
blocks.unknown = [LIGHT_GRAY]???
|
blocks.unknown = [LIGHT_GRAY]???
|
||||||
@@ -367,7 +370,7 @@ blocks.outputitemcapacity = Output Item Capacity
|
|||||||
blocks.itemcapacity = Item Capacity
|
blocks.itemcapacity = Item Capacity
|
||||||
blocks.basepowergeneration = Base Power Generation
|
blocks.basepowergeneration = Base Power Generation
|
||||||
blocks.powertransferspeed = Power Transfer
|
blocks.powertransferspeed = Power Transfer
|
||||||
blocks.productiontime = Production Time:
|
blocks.productiontime = Production Time
|
||||||
blocks.repairtime = Block Full Repair Time
|
blocks.repairtime = Block Full Repair Time
|
||||||
blocks.range = Range
|
blocks.range = Range
|
||||||
blocks.inputliquid = Input Liquid
|
blocks.inputliquid = Input Liquid
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.collection.OrderedMap;
|
import io.anuke.arc.collection.OrderedMap;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
@@ -45,7 +46,7 @@ public class ContentDisplay{
|
|||||||
BlockStats stats = block.stats;
|
BlockStats stats = block.stats;
|
||||||
|
|
||||||
for(StatCategory cat : stats.toMap().keys()){
|
for(StatCategory cat : stats.toMap().keys()){
|
||||||
OrderedMap<BlockStat, StatValue> map = stats.toMap().get(cat);
|
OrderedMap<BlockStat, Array<StatValue>> map = stats.toMap().get(cat);
|
||||||
|
|
||||||
if(map.size == 0) continue;
|
if(map.size == 0) continue;
|
||||||
|
|
||||||
@@ -56,7 +57,11 @@ public class ContentDisplay{
|
|||||||
table.table(inset -> {
|
table.table(inset -> {
|
||||||
inset.left();
|
inset.left();
|
||||||
inset.add("[LIGHT_GRAY]" + stat.localized() + ":[] ");
|
inset.add("[LIGHT_GRAY]" + stat.localized() + ":[] ");
|
||||||
map.get(stat).display(inset);
|
Array<StatValue> arr = map.get(stat);
|
||||||
|
for(StatValue value : arr){
|
||||||
|
value.display(inset);
|
||||||
|
}
|
||||||
|
//map.get(stat).display(inset);
|
||||||
}).fillX().padLeft(10);
|
}).fillX().padLeft(10);
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class LiquidDisplay extends Table{
|
|||||||
t.add(Strings.toFixed(amount, 2));
|
t.add(Strings.toFixed(amount, 2));
|
||||||
add(t);
|
add(t);
|
||||||
}
|
}
|
||||||
}}).size(8*3);
|
}}).size(8*4);
|
||||||
add(liquid.localizedName()).padLeft(3);
|
add(liquid.localizedName()).padLeft(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class GenericCrafter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
stats.add(BlockStat.productionTime, craftTime / 60f, StatUnit.itemsSecond);
|
stats.add(BlockStat.productionTime, craftTime / 60f, StatUnit.seconds);
|
||||||
|
|
||||||
if(outputItem != null){
|
if(outputItem != null){
|
||||||
stats.add(BlockStat.output, outputItem);
|
stats.add(BlockStat.output, outputItem);
|
||||||
@@ -65,7 +65,6 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureRegion[] generateIcons(){
|
public TextureRegion[] generateIcons(){
|
||||||
return drawIcons == null ? super.generateIcons() : drawIcons.get();
|
return drawIcons == null ? super.generateIcons() : drawIcons.get();
|
||||||
@@ -131,8 +130,6 @@ public class GenericCrafter extends Block{
|
|||||||
return itemCapacity;
|
return itemCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class GenericCrafterEntity extends TileEntity{
|
public static class GenericCrafterEntity extends TileEntity{
|
||||||
public float progress;
|
public float progress;
|
||||||
public float totalProgress;
|
public float totalProgress;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.world.meta;
|
package io.anuke.mindustry.world.meta;
|
||||||
|
|
||||||
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.collection.ObjectMap.Entry;
|
import io.anuke.arc.collection.ObjectMap.Entry;
|
||||||
import io.anuke.arc.collection.OrderedMap;
|
import io.anuke.arc.collection.OrderedMap;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
@@ -10,7 +11,7 @@ import io.anuke.mindustry.world.meta.values.*;
|
|||||||
|
|
||||||
/**Hold and organizes a list of block stats.*/
|
/**Hold and organizes a list of block stats.*/
|
||||||
public class BlockStats{
|
public class BlockStats{
|
||||||
private final OrderedMap<StatCategory, OrderedMap<BlockStat, StatValue>> map = new OrderedMap<>();
|
private final OrderedMap<StatCategory, OrderedMap<BlockStat, Array<StatValue>>> map = new OrderedMap<>();
|
||||||
private boolean dirty;
|
private boolean dirty;
|
||||||
|
|
||||||
/**Adds a single float value with this stat, formatted to 2 decimal places.*/
|
/**Adds a single float value with this stat, formatted to 2 decimal places.*/
|
||||||
@@ -50,15 +51,15 @@ public class BlockStats{
|
|||||||
|
|
||||||
/**Adds a stat value.*/
|
/**Adds a stat value.*/
|
||||||
public void add(BlockStat stat, StatValue value){
|
public void add(BlockStat stat, StatValue value){
|
||||||
if(map.containsKey(stat.category) && map.get(stat.category).containsKey(stat)){
|
//if(map.containsKey(stat.category) && map.get(stat.category).containsKey(stat)){
|
||||||
throw new RuntimeException("Duplicate stat entry: \"" + stat + "\" in block.");
|
// throw new RuntimeException("Duplicate stat entry: \"" + stat + "\" in block.");
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(!map.containsKey(stat.category)){
|
if(!map.containsKey(stat.category)){
|
||||||
map.put(stat.category, new OrderedMap<>());
|
map.put(stat.category, new OrderedMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
map.get(stat.category).put(stat, value);
|
map.get(stat.category).getOr(stat, Array::new).add(value);
|
||||||
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
@@ -74,11 +75,11 @@ public class BlockStats{
|
|||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderedMap<StatCategory, OrderedMap<BlockStat, StatValue>> toMap(){
|
public OrderedMap<StatCategory, OrderedMap<BlockStat, Array<StatValue>>> toMap(){
|
||||||
//sort stats by index if they've been modified
|
//sort stats by index if they've been modified
|
||||||
if(dirty){
|
if(dirty){
|
||||||
map.orderedKeys().sort();
|
map.orderedKeys().sort();
|
||||||
for(Entry<StatCategory, OrderedMap<BlockStat, StatValue>> entry : map.entries()){
|
for(Entry<StatCategory, OrderedMap<BlockStat, Array<StatValue>>> entry : map.entries()){
|
||||||
entry.value.orderedKeys().sort();
|
entry.value.orderedKeys().sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user