Bugfixes / Copy over plugins to mod folder

This commit is contained in:
Anuken
2019-10-24 18:04:39 -04:00
parent cbfcb5de2c
commit 955dc5f48d
7 changed files with 51 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.mod;
import io.anuke.arc.*;
import io.anuke.arc.audio.*;
import io.anuke.arc.audio.mock.*;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.*;
import io.anuke.arc.files.*;
@@ -52,6 +53,7 @@ public class ContentParser{
});
put(Sound.class, (type, data) -> {
if(fieldOpt(Sounds.class, data) != null) return fieldOpt(Sounds.class, data);
if(Vars.headless) return new MockSound();
String path = "sounds/" + data.asString() + (Vars.ios ? ".mp3" : ".ogg");
ModLoadingSound sound = new ModLoadingSound();

View File

@@ -169,9 +169,11 @@ public class Mods implements Loadable{
for(FileHandle file : modDirectory.list()){
if(!file.extension().equals("jar") && !file.extension().equals("zip") && !(file.isDirectory() && file.child("mod.json").exists())) continue;
Log.debug("[Mods] Loading mod {0}", file);
try{
LoadedMod mod = loadMod(file, false);
if(mod.enabled()){
if(mod.enabled() || headless){
loaded.add(mod);
}else{
disabled.add(mod);
@@ -286,7 +288,7 @@ public class Mods implements Loadable{
try{
//this binds the content but does not load it entirely
Content loaded = parser.parse(mod, file.nameWithoutExtension(), file.readString("UTF-8"), file, type);
Log.info("[{0}] Loaded '{1}'.", mod.meta.name,
Log.debug("[{0}] Loaded '{1}'.", mod.meta.name,
(loaded instanceof UnlockableContent ? ((UnlockableContent)loaded).localizedName : loaded));
}catch(Exception e){
throw new RuntimeException("Failed to parse content file '" + file + "' for mod '" + mod.meta.name + "'.", e);