mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-02 04:13:44 +07:00
Added content order
This commit is contained in:
parent
0a50e7dc48
commit
76f85df33f
@ -728,6 +728,9 @@ public class Mods implements Loadable{
|
|||||||
Seq<LoadRun> runs = new Seq<>();
|
Seq<LoadRun> runs = new Seq<>();
|
||||||
|
|
||||||
for(LoadedMod mod : orderedMods()){
|
for(LoadedMod mod : orderedMods()){
|
||||||
|
ObjectMap<String, LoadRun> currentRun = new ObjectMap<>();
|
||||||
|
String[] contentOrder = mod.meta.contentOrder;
|
||||||
|
|
||||||
if(mod.root.child("content").exists()){
|
if(mod.root.child("content").exists()){
|
||||||
Fi contentRoot = mod.root.child("content");
|
Fi contentRoot = mod.root.child("content");
|
||||||
for(ContentType type : ContentType.all){
|
for(ContentType type : ContentType.all){
|
||||||
@ -735,15 +738,34 @@ public class Mods implements Loadable{
|
|||||||
Fi folder = contentRoot.child(lower + (lower.endsWith("s") ? "" : "s"));
|
Fi folder = contentRoot.child(lower + (lower.endsWith("s") ? "" : "s"));
|
||||||
if(folder.exists()){
|
if(folder.exists()){
|
||||||
for(Fi file : folder.findAll(f -> f.extension().equals("json") || f.extension().equals("hjson"))){
|
for(Fi file : folder.findAll(f -> f.extension().equals("json") || f.extension().equals("hjson"))){
|
||||||
runs.add(new LoadRun(type, file, mod));
|
if(contentOrder == null){
|
||||||
|
runs.add(new LoadRun(type, file, mod));
|
||||||
|
}else{
|
||||||
|
currentRun.put(file.nameWithoutExtension(), new LoadRun(type, file, mod));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Seq<String> added = new Seq<>();
|
||||||
|
if(contentOrder != null){
|
||||||
|
for (String contentName : contentOrder){
|
||||||
|
LoadRun run = currentRun.get(contentName);
|
||||||
|
if(run != null){
|
||||||
|
runs.add(run);
|
||||||
|
added.add(contentName);
|
||||||
|
}else{
|
||||||
|
Log.warn("Cannot find content defined in contentOrder: @", contentName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Seq<String> left = currentRun.keys().toSeq();
|
||||||
|
left.removeAll(added);
|
||||||
|
runs.addAll(left.map(name -> currentRun.get(name)).sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
//make sure mod content is in proper order
|
|
||||||
runs.sort();
|
|
||||||
for(LoadRun l : runs){
|
for(LoadRun l : runs){
|
||||||
Content current = content.getLastAdded();
|
Content current = content.getLastAdded();
|
||||||
try{
|
try{
|
||||||
@ -1210,6 +1232,8 @@ public class Mods implements Loadable{
|
|||||||
public float texturescale = 1.0f;
|
public float texturescale = 1.0f;
|
||||||
/** If true, bleeding is skipped and no content icons are generated. */
|
/** If true, bleeding is skipped and no content icons are generated. */
|
||||||
public boolean pregenerated;
|
public boolean pregenerated;
|
||||||
|
/** If set, load the mod content in this order by content names */
|
||||||
|
public String[] contentOrder;
|
||||||
|
|
||||||
public String displayName(){
|
public String displayName(){
|
||||||
//useless, kept for legacy reasons
|
//useless, kept for legacy reasons
|
||||||
|
Loading…
Reference in New Issue
Block a user