diff --git a/li/cil/oc/Settings.scala b/li/cil/oc/Settings.scala index 46fa91139..91b78f682 100644 --- a/li/cil/oc/Settings.scala +++ b/li/cil/oc/Settings.scala @@ -164,7 +164,17 @@ object Settings { def get = settings def load(file: File) = { - val defaults = ConfigFactory.defaultReference().withOnlyPath("opencomputers") + // typesafe config's internal method for loading the reference.conf file + // seems to fail on some systems (as does their parseResource method), so + // we'll have to load the default config manually. This was reported on the + // Minecraft Forums, I could not reproduce the issue, but this version has + // reportedly fixed the problem. + val defaults = { + val in = classOf[Settings].getResourceAsStream("/reference.conf") + val config = ConfigFactory.parseReader(new BufferedReader(new InputStreamReader(in))) + in.close() + config + } try { val config = ConfigFactory.parseFile(file).withFallback(defaults) settings = new Settings(config.getConfig("opencomputers")) diff --git a/li/cil/oc/server/component/Computer.scala b/li/cil/oc/server/component/Computer.scala index 44cc174aa..c819e246a 100644 --- a/li/cil/oc/server/component/Computer.scala +++ b/li/cil/oc/server/component/Computer.scala @@ -699,9 +699,6 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con } try { - // Push a couple of functions that override original Lua API functions or - // that add new functionality to it. - // Push a couple of functions that override original Lua API functions or // that add new functionality to it. lua.getGlobal("os") @@ -776,7 +773,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con // clutter it. lua.newTable() - // Allow getting the real world time via os.realTime() for timeouts. + // Allow getting the real world time for timeouts. lua.pushScalaFunction(lua => { lua.pushNumber(System.currentTimeMillis() / 1000.0) 1 @@ -786,7 +783,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con // The time the computer has been running, as opposed to the CPU time. lua.pushScalaFunction(lua => { // World time is in ticks, and each second has 20 ticks. Since we - // want os.uptime() to return real seconds, though, we'll divide it + // want uptime() to return real seconds, though, we'll divide it // accordingly. lua.pushNumber((worldTime - timeStarted) / 20.0) 1 @@ -831,7 +828,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con }) lua.setField(-2, "pushSignal") - // And it's ROM address. + // And its ROM address. lua.pushScalaFunction(lua => { rom.foreach(rom => Option(rom.node.address) match { case None => lua.pushNil()