Log script messages to debug instead of info.

This commit is contained in:
KingRainbow44
2022-06-26 12:20:48 -04:00
parent 34f7c6e780
commit 447360594d
4 changed files with 75 additions and 75 deletions

View File

@@ -44,16 +44,16 @@ public class ScriptLoader {
if (sm != null) {
throw new Exception("Script loader already initialized");
}
// Create script engine
sm = new ScriptEngineManager();
engine = sm.getEngineByName("luaj");
factory = getEngine().getFactory();
// Lua stuff
fileType = "lua";
serializer = new LuaSerializer();
// Set engine to replace require as a temporary fix to missing scripts
LuajContext ctx = (LuajContext) engine.getContext();
ctx.globals.set("require", new OneArgFunction() {
@@ -62,11 +62,11 @@ public class ScriptLoader {
return LuaValue.ZERO;
}
});
LuaTable table = new LuaTable();
Arrays.stream(EntityType.values()).forEach(e -> table.set(e.name().toUpperCase(), e.getValue()));
ctx.globals.set("EntityType", table);
ctx.globals.set("EventType", CoerceJavaToLua.coerce(new EventType())); // TODO - make static class to avoid instantiating a new class every scene
ctx.globals.set("GadgetState", CoerceJavaToLua.coerce(new ScriptGadgetState()));
ctx.globals.set("RegionShape", CoerceJavaToLua.coerce(new ScriptRegionShape()));
@@ -75,11 +75,11 @@ public class ScriptLoader {
scriptLibLua = CoerceJavaToLua.coerce(scriptLib);
ctx.globals.set("ScriptLib", scriptLibLua);
}
public static ScriptEngine getEngine() {
return engine;
}
public static String getScriptType() {
return fileType;
}
@@ -109,7 +109,7 @@ public class ScriptLoader {
return sc.get();
}
Grasscutter.getLogger().info("Loading script " + path);
Grasscutter.getLogger().debug("Loading script " + path);
File file = new File(path);