Updated Rhino

This commit is contained in:
Anuken 2021-06-09 08:32:09 -04:00
parent 91c0235ff5
commit 1895c7b8e0
2 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ allprojects{
if(!project.hasProperty("versionType")) versionType = 'official' if(!project.hasProperty("versionType")) versionType = 'official'
appName = 'Mindustry' appName = 'Mindustry'
steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94' steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94'
rhinoVersion = '099aed6c82f8094b3ba39a273b8d2ba7bdcc6443' rhinoVersion = '55bf0dac1cfa7770672fd26112512c733ca9d5dc'
loadVersionProps = { loadVersionProps = {
return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p } return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p }

View File

@ -60,7 +60,7 @@ public class Scripts implements Disposable{
public String runConsole(String text){ public String runConsole(String text){
try{ try{
Object o = context.evaluateString(scope, text, "console.js", 1, null); Object o = context.evaluateString(scope, text, "console.js", 1);
if(o instanceof NativeJavaObject n) o = n.unwrap(); if(o instanceof NativeJavaObject n) o = n.unwrap();
if(o instanceof Undefined) o = "undefined"; if(o instanceof Undefined) o = "undefined";
return String.valueOf(o); return String.valueOf(o);
@ -172,11 +172,11 @@ public class Scripts implements Disposable{
try{ try{
if(currentMod != null){ if(currentMod != null){
//inject script info into file //inject script info into file
context.evaluateString(scope, "modName = \"" + currentMod.name + "\"\nscriptName = \"" + file + "\"", "initscript.js", 1, null); context.evaluateString(scope, "modName = \"" + currentMod.name + "\"\nscriptName = \"" + file + "\"", "initscript.js", 1);
} }
context.evaluateString(scope, context.evaluateString(scope,
wrap ? "(function(){'use strict';\n" + script + "\n})();" : script, wrap ? "(function(){'use strict';\n" + script + "\n})();" : script,
file, 0, null); file, 0);
return true; return true;
}catch(Throwable t){ }catch(Throwable t){
if(currentMod != null){ if(currentMod != null){
@ -224,7 +224,7 @@ public class Scripts implements Disposable{
if(!module.exists() || module.isDirectory()) return null; if(!module.exists() || module.isDirectory()) return null;
return new ModuleSource( return new ModuleSource(
new InputStreamReader(new ByteArrayInputStream((module.readString()).getBytes())), new InputStreamReader(new ByteArrayInputStream((module.readString()).getBytes())),
null, new URI(moduleId), root.file().toURI(), validator); new URI(moduleId), root.file().toURI(), validator);
} }
} }
} }