mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
testing script loading stuff
is not allowed in console, only from `LoadedMod`s.
This commit is contained in:
parent
864c73f791
commit
677debd475
1 changed files with 4 additions and 0 deletions
|
|
@ -68,6 +68,10 @@ public class Scripts implements Disposable{
|
|||
}
|
||||
|
||||
public void run(LoadedMod mod, Fi file){
|
||||
new RequireBuilder()
|
||||
.setModuleScriptProvider(new SoftCachingModuleScriptProvider(
|
||||
new UrlModuleSourceProvider(Arrays.asList(new URI[] {file.child("scripts").file().toURI()}), null)))
|
||||
.setSandboxed(true).createRequire(context, scope).install(scope);
|
||||
run(wrapper.replace("$SCRIPT_NAME$", mod.name + "/" + file.nameWithoutExtension()).replace("$CODE$", file.readString()).replace("$MOD_NAME$", mod.name), file.name());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue