Unfinished generation tool

This commit is contained in:
Anuken
2019-03-15 00:13:54 -04:00
parent 43bcf0cf3b
commit 7d1a8f5404
28 changed files with 575 additions and 156 deletions
+13 -3
View File
@@ -13,7 +13,7 @@ import io.anuke.mindustry.io.MapIO;
import static io.anuke.mindustry.Vars.world;
public class Map{
public class Map implements Comparable<Map>{
/** Whether this is a custom map.*/
public final boolean custom;
/** Metadata. Author description, display name, etc.*/
@@ -54,10 +54,10 @@ public class Map{
}catch(Exception e){
Log.err("Malformed waves: {0}", tags.get("waves"));
e.printStackTrace();
return DefaultWaves.getDefaultSpawns();
return DefaultWaves.get();
}
}else{
return DefaultWaves.getDefaultSpawns();
return DefaultWaves.get();
}
}
@@ -90,6 +90,16 @@ public class Map{
return tags.containsKey(name);
}
@Override
public int compareTo(Map map){
int type = -Boolean.compare(custom, map.custom);
if(type != 0){
return type;
}else{
return name().compareTo(map.name());
}
}
@Override
public String toString(){
return "Map{" +
@@ -113,6 +113,7 @@ public class Maps implements Disposable{
map.texture = new Texture(MapIO.generatePreview(data));
}
maps.add(map);
maps.sort();
}catch(IOException e){
throw new RuntimeException(e);
}
@@ -181,6 +182,7 @@ public class Maps implements Disposable{
}
maps.add(map);
maps.sort();
}
private void loadCustomMaps(){