mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-12 19:09:34 +07:00
main.js required now
This commit is contained in:
parent
4c45716149
commit
49ab7ceb77
@ -460,38 +460,24 @@ public class Mods implements Loadable{
|
|||||||
eachEnabled(mod -> {
|
eachEnabled(mod -> {
|
||||||
if(mod.root.child("scripts").exists()){
|
if(mod.root.child("scripts").exists()){
|
||||||
content.setCurrentMod(mod);
|
content.setCurrentMod(mod);
|
||||||
if(mod.meta.mainScript == null){
|
Fi main = mod.root.child("scripts").child("main.js");
|
||||||
mod.scripts = mod.root.child("scripts").findAll(f -> f.extension().equals("js"));
|
if(main.exists() && !main.isDirectory()){
|
||||||
Log.debug("[{0}] Found {1} scripts.", mod.meta.name, mod.scripts.size);
|
try{
|
||||||
|
if(scripts == null){
|
||||||
for(Fi file : mod.scripts){
|
scripts = platform.createScripts();
|
||||||
try{
|
}
|
||||||
if(scripts == null){
|
scripts.run(mod, main);
|
||||||
scripts = platform.createScripts();
|
}catch(Throwable e){
|
||||||
}
|
Core.app.post(() -> {
|
||||||
scripts.run(mod, file);
|
Log.err("Error loading main script {0} for mod {1}.", main.name(), mod.meta.name);
|
||||||
}catch(Throwable e){
|
e.printStackTrace();
|
||||||
Core.app.post(() -> {
|
});
|
||||||
Log.err("Error loading script {0} for mod {1}.", file.name(), mod.meta.name);
|
}
|
||||||
e.printStackTrace();
|
}else{
|
||||||
});
|
Core.app.post(() -> {
|
||||||
break;
|
Log.err("No main.js found for mod {1}.", mod.meta.name);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
Fi file = mod.root.child("scripts").child(mod.meta.mainScript + ".js");
|
|
||||||
try{
|
|
||||||
if(scripts == null){
|
|
||||||
scripts = platform.createScripts();
|
|
||||||
}
|
|
||||||
scripts.run(mod, file);
|
|
||||||
}catch(Throwable e){
|
|
||||||
Core.app.post(() -> {
|
|
||||||
Log.err("Error loading main script {0} for mod {1}.", file.name(), mod.meta.name);
|
|
||||||
e.printStackTrace();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}finally{
|
}finally{
|
||||||
|
Loading…
Reference in New Issue
Block a user