Faster, smaller server / Bundle check cleanup

This commit is contained in:
Anuken
2019-03-09 19:12:54 -05:00
parent 2a35e22dd2
commit a0905d5695
14 changed files with 124 additions and 77 deletions

View File

@@ -19,8 +19,8 @@ public class Zones implements ContentList{
public void load(){
groundZero = new Zone("groundZero", new MapGenerator("groundZero", 1)){{
baseLaunchCost = ItemStack.with(Items.copper, -50);
startingItems = ItemStack.list(Items.copper, 50);
baseLaunchCost = ItemStack.with(Items.copper, -100);
startingItems = ItemStack.list(Items.copper, 100);
alwaysUnlocked = true;
conditionWave = 5;
launchPeriod = 5;

View File

@@ -39,6 +39,8 @@ public class BundleLoader{
}
private static void loadBundle(){
if(headless) return;
try{
//try loading external bundle
FileHandle handle = Core.files.local("bundle");

View File

@@ -5,8 +5,6 @@ import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.Pal;
@@ -42,11 +40,6 @@ public class Item extends UnlockableContent implements Comparable<Item>{
super(name);
this.color = color;
this.description = Core.bundle.getOrNull("item." + this.name + ".description");
if(!Core.bundle.has("item." + this.name + ".name")){
Log.err("Warning: item '" + name + "' is missing a localized name. Add the following to bundle.properties:");
Log.err("item." + this.name + ".name = " + Strings.capitalize(name.replace('-', '_')));
}
}
public void load(){

View File

@@ -5,8 +5,6 @@ import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.function.Supplier;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.traits.TypeTrait;
import io.anuke.mindustry.entities.type.BaseUnit;
@@ -46,11 +44,6 @@ public class UnitType extends UnlockableContent{
this.description = Core.bundle.getOrNull("unit." + name + ".description");
TypeTrait.registerType(type, mainConstructor);
if(!Core.bundle.has("unit." + this.name + ".name")){
Log.err("Warning: unit '" + name + "' is missing a localized name. Add the follow to bundle.properties:");
Log.err("unit." + this.name + ".name=" + Strings.capitalize(name.replace('-', '_')));
}
}
@Override

View File

@@ -1,20 +1,14 @@
package io.anuke.mindustry.world.meta;
import io.anuke.arc.Core;
import io.anuke.arc.collection.ObjectMap.Entry;
import io.anuke.arc.collection.OrderedMap;
import io.anuke.arc.util.Log;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.meta.values.*;
import java.util.Locale;
/**Hold and organizes a list of block stats.*/
public class BlockStats{
private static final boolean errorWhenMissing = false;
private final OrderedMap<StatCategory, OrderedMap<BlockStat, StatValue>> map = new OrderedMap<>();
private boolean dirty;
@@ -50,22 +44,6 @@ public class BlockStats{
/**Adds a stat value.*/
public void add(BlockStat stat, StatValue value){
if(!Core.bundle.has("blocks." + stat.name().toLowerCase(Locale.ROOT))){
if(!errorWhenMissing){
Log.err("Warning: No bundle entry for stat type \"" + stat + "\"!");
}else{
throw new RuntimeException("No bundle entry for stat type \"" + stat + "\"!");
}
}
if(!Core.bundle.has("category." + stat.category.name().toLowerCase(Locale.ROOT))){
if(!errorWhenMissing){
Log.err("Warning: No bundle entry for stat category \"" + stat.category + "\"!");
}else{
throw new RuntimeException("No bundle entry for stat category \"" + stat.category + "\"!");
}
}
if(map.containsKey(stat.category) && map.get(stat.category).containsKey(stat)){
throw new RuntimeException("Duplicate stat entry: \"" + stat + "\" in block.");
}

View File

@@ -16,10 +16,6 @@ public class NumberValue implements StatValue{
public NumberValue(float value, StatUnit unit){
this.unit = unit;
this.value = value;
if(unit != StatUnit.none && unit.localized().contains("???")){
throw new RuntimeException("No bundle definition found for unit: '" + unit + "'");
}
}
@Override